https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66058

--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, May 08, 2015 at 12:31:39PM +0000, matthew.thompson at nasa dot gov
wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66058
> 
> --- Comment #3 from Matt Thompson <matthew.thompson at nasa dot gov> ---
> (In reply to kargl from comment #2)
> > (In reply to Matt Thompson from comment #1)
> > > 
> > > I've tried various gfortran flags, but for the life of me, none seem to 
> > > get
> > > this to work.
> > 
> > You're getting the expected behaviour implied by the .F extention.
> > The pre-processor is doing what it is should (from n1256.pdf)
> > 
> >     Each instance of a backslash character (\) immediately followed
> >     by a new-line character is deleted, splicing physical source
> >     lines to form logical source lines.  Only the last backslash on
> >     any physical source line shall be eligible for being part of
> >     such a splice. A source file that is not empty shall end in a
> >     new-line character, which shall not be immediately preceded
> >     by a backslash character before any such splicing takes place.
> > 
> > The option that you are looking for is -xf95.  It tells gfortran
> > to ignore the .F extension and treat the code as Fortran 95 without
> > doing the pre-processing.
> 
> Ahh. Okay, thanks. It might be nice to put a reference to -x in the gfortran
> manpage. It always confuses me that some Fortran options are only visible in
> the gcc manpage...
> 

gfortran supports most (all?) of the options that gcc supports.
It was decided to not reproduce the gcc manual within the gfortran
manual.  You'll find in Sec. 2, this statement:

   The 'gfortran' command supports all the options supported by the 'gcc'
   command.  Only options specific to GNU Fortran are documented here.

In looking through Sec. 1.3 that details the .F behaviour, I find

   Many Fortran compilers including GNU Fortran allow passing the source
   code through a C preprocessor (CPP; sometimes also called the Fortran
   preprocessor, FPP) to allow for conditional compilation.  In the case
   of GNU Fortran, this is the GNU C Preprocessor in the traditional mode.
   On systems with case-preserving file names, the preprocessor is
   automatically invoked if the filename extension is '.F', '.FOR', '.FTN',
   '.fpp', '.FPP', '.F90', '.F95', '.F03' or '.F08'.  To manually invoke
   the preprocessor on any file, use '-cpp', to disable preprocessing on
   files where the preprocessor is run automatically, use '-nocpp'.

so the -nocpp option should also work.

Reply via email to