GNU Info

Info Node: (gcc-300.info)Preprocessor Options

(gcc-300.info)Preprocessor Options


Next: Assembler Options Prev: Optimize Options Up: Invoking GCC
Enter node , (file) or (file)node

Options Controlling the Preprocessor
====================================

   These options control the C preprocessor, which is run on each C
source file before actual compilation.

   If you use the `-E' option, nothing is done except preprocessing.
Some of these options make sense only together with `-E' because they
cause the preprocessor output to be unsuitable for actual compilation.

`-include FILE'
     Process FILE as input before processing the regular input file.
     In effect, the contents of FILE are compiled first.  Any `-D' and
     `-U' options on the command line are always processed before
     `-include FILE', regardless of the order in which they are
     written.  All the `-include' and `-imacros' options are processed
     in the order in which they are written.

`-imacros FILE'
     Process FILE as input, discarding the resulting output, before
     processing the regular input file.  Because the output generated
     from FILE is discarded, the only effect of `-imacros FILE' is to
     make the macros defined in FILE available for use in the main
     input.  All the `-include' and `-imacros' options are processed in
     the order in which they are written.

`-idirafter DIR'
     Add the directory DIR to the second include path.  The directories
     on the second include path are searched when a header file is not
     found in any of the directories in the main include path (the one
     that `-I' adds to).

`-iprefix PREFIX'
     Specify PREFIX as the prefix for subsequent `-iwithprefix' options.

`-iwithprefix DIR'
     Add a directory to the second include path.  The directory's name
     is made by concatenating PREFIX and DIR, where PREFIX was
     specified previously with `-iprefix'.  If you have not specified a
     prefix yet, the directory containing the installed passes of the
     compiler is used as the default.

`-iwithprefixbefore DIR'
     Add a directory to the main include path.  The directory's name is
     made by concatenating PREFIX and DIR, as in the case of
     `-iwithprefix'.

`-isystem DIR'
     Add a directory to the beginning of the second include path,
     marking it as a system directory, so that it gets the same special
     treatment as is applied to the standard system directories.

`-nostdinc'
     Do not search the standard system directories for header files.
     Only the directories you have specified with `-I' options (and the
     current directory, if appropriate) are searched.  Note: Directory
     Options, for information on `-I'.

     By using both `-nostdinc' and `-I-', you can limit the include-file
     search path to only those directories you specify explicitly.

`-remap'
     When searching for a header file in a directory, remap file names
     if a file named `header.gcc' exists in that directory.  This can
     be used to work around limitations of file systems with file name
     restrictions.  The `header.gcc' file should contain a series of
     lines with two tokens on each line: the first token is the name to
     map, and the second token is the actual name to use.

`-undef'
     Do not predefine any nonstandard macros.  (Including architecture
     flags).

`-E'
     Run only the C preprocessor.  Preprocess all the C source files
     specified and output the results to standard output or to the
     specified output file.

`-C'
     Tell the preprocessor not to discard comments.  Used with the `-E'
     option.

`-P'
     Tell the preprocessor not to generate `#line' directives.  Used
     with the `-E' option.

`-M'
     Instead of outputting the result of preprocessing, output a rule
     suitable for `make' describing the dependencies of the main source
     file.  The preprocessor outputs one `make' rule containing the
     object file name for that source file, a colon, and the names of
     all the included files.  Unless overridden explicitly, the object
     file name consists of the basename of the source file with any
     suffix replaced with object file suffix.  If there are many
     included files then the rule is split into several lines using
     `\'-newline.

     `-M' implies `-E'.

`-MM'
     Like `-M', but mention only the files included with `#include
     "FILE"'.  System header files included with `#include <FILE>' are
     omitted.

`-MD'
     Like `-M' but the dependency information is written to a file
     rather than stdout.  `gcc' will use the same file name and
     directory as the object file, but with the suffix `.d' instead.

     This is in addition to compiling the main file as specified--`-MD'
     does not inhibit ordinary compilation the way `-M' does, unless
     you also specify `-MG'.

     With Mach, you can use the utility `md' to merge multiple
     dependency files into a single dependency file suitable for using
     with the `make' command.

`-MMD'
     Like `-MD' except mention only user header files, not system
     -header files.

`-MF FILE'
     When used with `-M' or `-MM', specifies a file to write the
     dependencies to.  This allows the preprocessor to write the
     preprocessed file to stdout normally.  If no `-MF' switch is
     given, CPP sends the rules to stdout and suppresses normal
     preprocessed output.

     Another way to specify output of a `make' rule is by setting the
     environment variable `DEPENDENCIES_OUTPUT' (Note: Environment
     Variables).

`-MG'
     When used with `-M' or `-MM', `-MG' says to treat missing header
     files as generated files and assume they live in the same
     directory as the source file.  It suppresses preprocessed output,
     as a missing header file is ordinarily an error.

     This feature is used in automatic updating of makefiles.

`-MP'
     This option instructs CPP to add a phony target for each dependency
     other than the main file, causing each to depend on nothing.  These
     dummy rules work around errors `make' gives if you remove header
     files without updating the `Makefile' to match.

     This is typical output:-

          /tmp/test.o: /tmp/test.c /tmp/test.h
          
          /tmp/test.h:

`-MQ TARGET'

`-MT TARGET'
     By default CPP uses the main file name, including any path, and
     appends the object suffix, normally ".o", to it to obtain the name
     of the target for dependency generation.  With `-MT' you can
     specify a target yourself, overriding the default one.

     If you want multiple targets, you can specify them as a single
     argument to `-MT', or use multiple `-MT' options.

     The targets you specify are output in the order they appear on the
     command line.  `-MQ' is identical to `-MT', except that the target
     name is quoted for Make, but with `-MT' it isn't.  For example,
     `-MT '$(objpfx)foo.o'' gives

          $(objpfx)foo.o: /tmp/foo.c

     but `-MQ '$(objpfx)foo.o'' gives

          $$(objpfx)foo.o: /tmp/foo.c

     The default target is automatically quoted, as if it were given
     with `-MQ'.

`-H'
     Print the name of each header file used, in addition to other
     normal activities.

`-AQUESTION(ANSWER)'
     Assert the answer ANSWER for QUESTION, in case it is tested with a
     preprocessing conditional such as `#if #QUESTION(ANSWER)'.  `-A-'
     disables the standard assertions that normally describe the target
     machine.

`-DMACRO'
     Define macro MACRO with the string `1' as its definition.

`-DMACRO=DEFN'
     Define macro MACRO as DEFN.  All instances of `-D' on the command
     line are processed before any `-U' options.

     Any `-D' and `-U' options on the command line are processed in
     order, and always before `-imacros FILE', regardless of the order
     in which they are written.

`-UMACRO'
     Undefine macro MACRO.  `-U' options are evaluated after all `-D'
     options, but before any `-include' and `-imacros' options.

     Any `-D' and `-U' options on the command line are processed in
     order, and always before `-imacros FILE', regardless of the order
     in which they are written.

`-dM'
     Tell the preprocessor to output only a list of the macro
     definitions that are in effect at the end of preprocessing.  Used
     with the `-E' option.

`-dD'
     Tell the preprocessing to pass all macro definitions into the
     output, in their proper sequence in the rest of the output.

`-dN'
     Like `-dD' except that the macro arguments and contents are
     omitted.  Only `#define NAME' is included in the output.

`-dI'
     Output `#include' directives in addition to the result of
     preprocessing.

`-fpreprocessed'
     Indicate to the preprocessor that the input file has already been
     preprocessed.  This suppresses things like macro expansion,
     trigraph conversion, escaped newline splicing, and processing of
     most directives.  In this mode the integrated preprocessor is
     little more than a tokenizer for the front ends.

     `-fpreprocessed' is implicit if the input file has one of the
     extensions `i', `ii' or `mi' indicating it has already been
     preprocessed.

`-trigraphs'
     Process ISO standard trigraph sequences.  These are three-character
     sequences, all starting with `??', that are defined by ISO C to
     stand for single characters.  For example, `??/' stands for `\',
     so `'??/n'' is a character constant for a newline.  By default,
     GCC ignores trigraphs, but in standard-conforming modes it
     converts them.  See the `-std' and `-ansi' options.

     The nine trigraph sequences are
    `??('
          ==> `['

    `??)'
          ==> `]'

    `??<'
          ==> `{'

    `??>'
          ==> `}'

    `??='
          ==> `#'

    `??/'
          ==> `\'

    `??''
          ==> `^'

    `??!'
          ==> `|'

    `??-'
          ==> `~'

     Trigraph support is not popular, so many compilers do not
     implement it properly.  Portable code should not rely on trigraphs
     being either converted or ignored.

`-Wp,OPTION'
     Pass OPTION as an option to the preprocessor.  If OPTION contains
     commas, it is split into multiple options at the commas.


automatically generated by info2www version 1.2.2.9