Next: Error and Warning Options, Previous: Fortran Dialect Options, Up: Invoking GNU Fortran
Preprocessor related options. See section Preprocessing and conditional compilation for more detailed information on preprocessing in gfortran.
-cpp
-nocpp
To disable preprocessing of files with any of the above listed extensions, use the negative form: -nocpp.
The preprocessor is run in traditional mode, be aware that any
restrictions of the file-format, e.g. fixed-form line width,
apply for preprocessed output as well.
-dM
'#define'
directives for all the macros defined during the execution of the
preprocessor, including predefined macros. This gives you a way
of finding out what is predefined in your version of the preprocessor.
Assuming you have no file foo.f90, the command
touch foo.f90; gfortran -cpp -dM foo.f90
will show all the predefined macros.
-dD
#define
directives
and the result of preprocessing. Both kinds of output go to the
standard output file.
-dN
-dU
'#undef'
directives are also output for macros tested but undefined at the time.
-dI
'#include'
directives in addition to the result
of preprocessing.
-fworking-directory
#line
directives are emitted whatsoever.
-idirafter
dir=
, then the =
will be replaced by
the sysroot prefix; see --sysroot and -isysroot.
-imultilib
dir-iprefix
prefix'/'
.
-isysroot
dir-iquote
dir#include "file"
;
they are not searched for #include <file>
, before all directories
specified by -I and before the standard system directories. If
dir begins with =
, then the =
will be replaced by the
sysroot prefix; see --sysroot and -isysroot.
-isystem
dir=
, then the =
will be replaced by the sysroot prefix;
see --sysroot and -isysroot.
-nostdinc
-undef
-A
predicate=
answer-A-
predicate=
answer-C
You should be prepared for side effects when using -C; it causes
the preprocessor to treat comments as tokens in their own right. For example,
comments appearing at the start of what would be a directive line have the
effect of turning that line into an ordinary source line, since the first
token on the line is no longer a '#'
.
Warning: this currently handles C-Style comments only. The preprocessor
does not yet recognize Fortran-style comments.
-CC
In addition to the side-effects of the -C option, the -CC option causes all C++-style comments inside a macro to be converted to C-style comments. This is to prevent later use of that macro from inadvertently commenting out the remainder of the source line. The -CC option is generally used to support lint comments.
Warning: this currently handles C- and C++-Style comments only. The
preprocessor does not yet recognize Fortran-style comments.
-D
name1
.
-D
name=
definition'#define'
directive.
In particular, the definition will be truncated by embedded newline
characters.
If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell's quoting syntax to protect characters such as spaces that have a meaning in the shell syntax.
If you wish to define a function-like macro on the command line, write
its argument list with surrounding parentheses before the equals sign
(if any). Parentheses are meaningful to most shells, so you will need
to quote the option. With sh and csh, -D'name(args...)=definition'
works.
-D and -U options are processed in the order they are
given on the command line. All -imacros file and -include file options
are processed after all -D and -U options.
-H
'#include'
stack it is.
-P
-U
name