cppopts.texi revision 169689
118334Speter@c Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
290075Sobrien@c Free Software Foundation, Inc.
396263Sobrien@c This is part of the CPP and GCC manuals.
418334Speter@c For copying conditions, see the file gcc.texi.
590075Sobrien
618334Speter@c ---------------------------------------------------------------------
790075Sobrien@c Options affecting the preprocessor
890075Sobrien@c ---------------------------------------------------------------------
990075Sobrien
1090075Sobrien@c If this file is included with the flag ``cppmanual'' set, it is
1118334Speter@c formatted for inclusion in the CPP manual; otherwise the main GCC manual.
1290075Sobrien
1390075Sobrien@table @gcctabopt
1490075Sobrien@item -D @var{name}
1590075Sobrien@opindex D
1618334SpeterPredefine @var{name} as a macro, with definition @code{1}.
1718334Speter
1890075Sobrien@item -D @var{name}=@var{definition}
1990075SobrienThe contents of @var{definition} are tokenized and processed as if
2090075Sobrienthey appeared during translation phase three in a @samp{#define}
2118334Speterdirective.  In particular, the definition will be truncated by
2290075Sobrienembedded newline characters.
2390075Sobrien
2490075SobrienIf you are invoking the preprocessor from a shell or shell-like
2518334Speterprogram you may need to use the shell's quoting syntax to protect
2618334Spetercharacters such as spaces that have a meaning in the shell syntax.
2718334Speter
2818334SpeterIf you wish to define a function-like macro on the command line, write
2918334Speterits argument list with surrounding parentheses before the equals sign
3018334Speter(if any).  Parentheses are meaningful to most shells, so you will need
3118334Speterto quote the option.  With @command{sh} and @command{csh},
3218334Speter@option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works.
3318334Speter
3418334Speter@option{-D} and @option{-U} options are processed in the order they
3518334Speterare given on the command line.  All @option{-imacros @var{file}} and
3618334Speter@option{-include @var{file}} options are processed after all
3718334Speter@option{-D} and @option{-U} options.
3850397Sobrien
3918334Speter@item -U @var{name}
4090075Sobrien@opindex U
4118334SpeterCancel any previous definition of @var{name}, either built in or
4218334Speterprovided with a @option{-D} option.
4318334Speter
4418334Speter@item -undef
4550397Sobrien@opindex undef
4650397SobrienDo not predefine any system-specific or GCC-specific macros.  The
4790075Sobrienstandard predefined macros remain defined.
4818334Speter@ifset cppmanual
4918334Speter@xref{Standard Predefined Macros}.
5050397Sobrien@end ifset
5150397Sobrien
5290075Sobrien@item -I @var{dir}
5390075Sobrien@opindex I
5418334SpeterAdd the directory @var{dir} to the list of directories to be searched
5518334Speterfor header files.
5618334Speter@ifset cppmanual
5718334Speter@xref{Search Path}.
5818334Speter@end ifset
5918334SpeterDirectories named by @option{-I} are searched before the standard
6018334Spetersystem include directories.  If the directory @var{dir} is a standard
6118334Spetersystem include directory, the option is ignored to ensure that the
6290075Sobriendefault search order for system directories and the special treatment
6390075Sobrienof system headers are not defeated
6490075Sobrien@ifset cppmanual
6590075Sobrien(@pxref{System Headers})
6690075Sobrien@end ifset
6790075Sobrien.
6890075Sobrien
6990075Sobrien@item -o @var{file}
7090075Sobrien@opindex o
7190075SobrienWrite output to @var{file}.  This is the same as specifying @var{file}
7290075Sobrienas the second non-option argument to @command{cpp}.  @command{gcc} has a
7352284Sobriendifferent interpretation of a second non-option argument, so you must
7452284Sobrienuse @option{-o} to specify the output file.
7552284Sobrien
7652284Sobrien@item -Wall
7752284Sobrien@opindex Wall
7852284SobrienTurns on all optional warnings which are desirable for normal code.
7952284SobrienAt present this is @option{-Wcomment}, @option{-Wtrigraphs},
8090075Sobrien@option{-Wmultichar} and a warning about integer promotion causing a
8118334Speterchange of sign in @code{#if} expressions.  Note that many of the
8218334Speterpreprocessor's warnings are on by default and have no options to
8352284Sobriencontrol them.
8418334Speter
8590075Sobrien@item -Wcomment
8650397Sobrien@itemx -Wcomments
8790075Sobrien@opindex Wcomment
8890075Sobrien@opindex Wcomments
8990075SobrienWarn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
9018334Spetercomment, or whenever a backslash-newline appears in a @samp{//} comment.
9118334Speter(Both forms have the same effect.)
9290075Sobrien
9390075Sobrien@item -Wtrigraphs
9490075Sobrien@opindex Wtrigraphs
9590075Sobrien@anchor{Wtrigraphs}
9690075SobrienMost trigraphs in comments cannot affect the meaning of the program.
9790075SobrienHowever, a trigraph that would form an escaped newline (@samp{??/} at
9890075Sobrienthe end of a line) can, by changing where the comment begins or ends.
9990075SobrienTherefore, only trigraphs that would form escaped newlines produce
10050397Sobrienwarnings inside a comment.
10190075Sobrien
10290075SobrienThis option is implied by @option{-Wall}.  If @option{-Wall} is not
10390075Sobriengiven, this option is still enabled unless trigraphs are enabled.  To
10490075Sobrienget trigraph conversion without warnings, but get the other
10590075Sobrien@option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
10690075Sobrien
10790075Sobrien@item -Wtraditional
10890075Sobrien@opindex Wtraditional
10918334SpeterWarn about certain constructs that behave differently in traditional and
11090075SobrienISO C@.  Also warn about ISO C constructs that have no traditional C
11190075Sobrienequivalent, and problematic constructs which should be avoided.
11218334Speter@ifset cppmanual
11390075Sobrien@xref{Traditional Mode}.
11490075Sobrien@end ifset
11590075Sobrien
11690075Sobrien@item -Wimport
11790075Sobrien@opindex Wimport
11818334SpeterWarn the first time @samp{#import} is used.
11918334Speter
12090075Sobrien@item -Wundef
12190075Sobrien@opindex Wundef
12290075SobrienWarn whenever an identifier which is not a macro is encountered in an
12390075Sobrien@samp{#if} directive, outside of @samp{defined}.  Such identifiers are
12490075Sobrienreplaced with zero.
12590075Sobrien
12690075Sobrien@item -Wunused-macros
12718334Speter@opindex Wunused-macros
12890075SobrienWarn about macros defined in the main file that are unused.  A macro
12918334Speteris @dfn{used} if it is expanded or tested for existence at least once.
13090075SobrienThe preprocessor will also warn if the macro has not been used at the
13118334Spetertime it is redefined or undefined.
13290075Sobrien
13390075SobrienBuilt-in macros, macros defined on the command line, and macros
13490075Sobriendefined in include files are not warned about.
13590075Sobrien
13690075Sobrien@emph{Note:} If a macro is actually used, but only used in skipped
13790075Sobrienconditional blocks, then CPP will report it as unused.  To avoid the
13890075Sobrienwarning in such a case, you might improve the scope of the macro's
13990075Sobriendefinition by, for example, moving it into the first skipped block.
14090075SobrienAlternatively, you could provide a dummy use with something like:
14190075Sobrien
14218334Speter@smallexample
14390075Sobrien#if defined the_macro_causing_the_warning
14490075Sobrien#endif
14518334Speter@end smallexample
14690075Sobrien
14718334Speter@item -Wendif-labels
14818334Speter@opindex Wendif-labels
14918334SpeterWarn whenever an @samp{#else} or an @samp{#endif} are followed by text.
15090075SobrienThis usually happens in code of the form
15118334Speter
15290075Sobrien@smallexample
15390075Sobrien#if FOO
15490075Sobrien@dots{}
15590075Sobrien#else FOO
15690075Sobrien@dots{}
15790075Sobrien#endif FOO
15818334Speter@end smallexample
15918334Speter
16018334Speter@noindent
16118334SpeterThe second and third @code{FOO} should be in comments, but often are not
16218334Speterin older programs.  This warning is on by default.
16390075Sobrien
16490075Sobrien@item -Werror
16590075Sobrien@opindex Werror
16690075SobrienMake all warnings into hard errors.  Source code which triggers warnings
16790075Sobrienwill be rejected.
16890075Sobrien
16990075Sobrien@item -Wsystem-headers
17090075Sobrien@opindex Wsystem-headers
17190075SobrienIssue warnings for code in system headers.  These are normally unhelpful
17290075Sobrienin finding bugs in your own code, therefore suppressed.  If you are
17390075Sobrienresponsible for the system library, you may want to see them.
17490075Sobrien
17590075Sobrien@item -w
17690075Sobrien@opindex w
17790075SobrienSuppress all warnings, including those which GNU CPP issues by default.
17890075Sobrien
17990075Sobrien@item -pedantic
18018334Speter@opindex pedantic
18190075SobrienIssue all the mandatory diagnostics listed in the C standard.  Some of
18290075Sobrienthem are left out by default, since they trigger frequently on harmless
18390075Sobriencode.
18452284Sobrien
18552284Sobrien@item -pedantic-errors
18652284Sobrien@opindex pedantic-errors
18752284SobrienIssue all the mandatory diagnostics, and make all mandatory diagnostics
18852284Sobrieninto errors.  This includes mandatory diagnostics that GCC issues
18952284Sobrienwithout @samp{-pedantic} but treats as warnings.
19052284Sobrien
19152284Sobrien@item -M
19252284Sobrien@opindex M
19352284Sobrien@cindex make
19452284Sobrien@cindex dependencies, make
19552284SobrienInstead of outputting the result of preprocessing, output a rule
19652284Sobriensuitable for @command{make} describing the dependencies of the main
19752284Sobriensource file.  The preprocessor outputs one @command{make} rule containing
19852284Sobrienthe object file name for that source file, a colon, and the names of all
19952284Sobrienthe included files, including those coming from @option{-include} or
20052284Sobrien@option{-imacros} command line options.
20152284Sobrien
20252284SobrienUnless specified explicitly (with @option{-MT} or @option{-MQ}), the
20352284Sobrienobject file name consists of the basename of the source file with any
20452284Sobriensuffix replaced with object file suffix.  If there are many included
20552284Sobrienfiles then the rule is split into several lines using @samp{\}-newline.
20652284SobrienThe rule has no commands.
20752284Sobrien
20852284SobrienThis option does not suppress the preprocessor's debug output, such as
20952284Sobrien@option{-dM}.  To avoid mixing such debug output with the dependency
21052284Sobrienrules you should explicitly specify the dependency output file with
21152284Sobrien@option{-MF}, or use an environment variable like
21252284Sobrien@env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}).  Debug output
21352284Sobrienwill still be sent to the regular output stream as normal.
21452284Sobrien
21552284SobrienPassing @option{-M} to the driver implies @option{-E}, and suppresses
21652284Sobrienwarnings with an implicit @option{-w}.
21752284Sobrien
21852284Sobrien@item -MM
21952284Sobrien@opindex MM
22052284SobrienLike @option{-M} but do not mention header files that are found in
22152284Sobriensystem header directories, nor header files that are included,
22290075Sobriendirectly or indirectly, from such a header.
22352284Sobrien
22452284SobrienThis implies that the choice of angle brackets or double quotes in an
22590075Sobrien@samp{#include} directive does not in itself determine whether that
22652284Sobrienheader will appear in @option{-MM} dependency output.  This is a
22752284Sobrienslight change in semantics from GCC versions 3.0 and earlier.
22852284Sobrien
22952284Sobrien@anchor{dashMF}
23052284Sobrien@item -MF @var{file}
23190075Sobrien@opindex MF
23252284SobrienWhen used with @option{-M} or @option{-MM}, specifies a
23390075Sobrienfile to write the dependencies to.  If no @option{-MF} switch is given
23490075Sobrienthe preprocessor sends the rules to the same place it would have sent
23552284Sobrienpreprocessed output.
23690075Sobrien
23790075SobrienWhen used with the driver options @option{-MD} or @option{-MMD},
23890075Sobrien@option{-MF} overrides the default dependency output file.
23990075Sobrien
24090075Sobrien@item -MG
24190075Sobrien@opindex MG
24290075SobrienIn conjunction with an option such as @option{-M} requesting
24352284Sobriendependency generation, @option{-MG} assumes missing header files are
24490075Sobriengenerated files and adds them to the dependency list without raising
24590075Sobrienan error.  The dependency filename is taken directly from the
24690075Sobrien@code{#include} directive without prepending any path.  @option{-MG}
24790075Sobrienalso suppresses preprocessed output, as a missing header file renders
24852284Sobrienthis useless.
24990075Sobrien
25090075SobrienThis feature is used in automatic updating of makefiles.
25190075Sobrien
25290075Sobrien@item -MP
25390075Sobrien@opindex MP
25490075SobrienThis option instructs CPP to add a phony target for each dependency
25590075Sobrienother than the main file, causing each to depend on nothing.  These
25690075Sobriendummy rules work around errors @command{make} gives if you remove header
25790075Sobrienfiles without updating the @file{Makefile} to match.
25890075Sobrien
25990075SobrienThis is typical output:
26052284Sobrien
26190075Sobrien@smallexample
26290075Sobrientest.o: test.c test.h
26390075Sobrien
26490075Sobrientest.h:
26590075Sobrien@end smallexample
26690075Sobrien
26790075Sobrien@item -MT @var{target}
26890075Sobrien@opindex MT
26990075Sobrien
27090075SobrienChange the target of the rule emitted by dependency generation.  By
27190075Sobriendefault CPP takes the name of the main input file, including any path,
27290075Sobriendeletes any file suffix such as @samp{.c}, and appends the platform's
27352284Sobrienusual object suffix.  The result is the target.
27452284Sobrien
27552284SobrienAn @option{-MT} option will set the target to be exactly the string you
27652284Sobrienspecify.  If you want multiple targets, you can specify them as a single
27752284Sobrienargument to @option{-MT}, or use multiple @option{-MT} options.
27818334Speter
27918334SpeterFor example, @option{@w{-MT '$(objpfx)foo.o'}} might give
28018334Speter
28118334Speter@smallexample
28218334Speter$(objpfx)foo.o: foo.c
28318334Speter@end smallexample
28418334Speter
28518334Speter@item -MQ @var{target}
28618334Speter@opindex MQ
28718334Speter
28818334SpeterSame as @option{-MT}, but it quotes any characters which are special to
28918334SpeterMake.  @option{@w{-MQ '$(objpfx)foo.o'}} gives
29018334Speter
29118334Speter@smallexample
29218334Speter$$(objpfx)foo.o: foo.c
29318334Speter@end smallexample
29452750Sobrien
29518334SpeterThe default target is automatically quoted, as if it were given with
29618334Speter@option{-MQ}.
29718334Speter
29818334Speter@item -MD
29918334Speter@opindex MD
30090075Sobrien@option{-MD} is equivalent to @option{-M -MF @var{file}}, except that
30118334Speter@option{-E} is not implied.  The driver determines @var{file} based on
30218334Speterwhether an @option{-o} option is given.  If it is, the driver uses its
30318334Speterargument but with a suffix of @file{.d}, otherwise it take the
30418334Speterbasename of the input file and applies a @file{.d} suffix.
30518334Speter
30618334SpeterIf @option{-MD} is used in conjunction with @option{-E}, any
30718334Speter@option{-o} switch is understood to specify the dependency output file
30818334Speter(@pxref{dashMF,,-MF}), but if used without @option{-E}, each @option{-o}
30952284Sobrienis understood to specify a target object file.
31018334Speter
31150397SobrienSince @option{-E} is not implied, @option{-MD} can be used to generate
31250397Sobriena dependency output file as a side-effect of the compilation process.
31350397Sobrien
31450397Sobrien@item -MMD
31518334Speter@opindex MMD
31618334SpeterLike @option{-MD} except mention only user header files, not system
31718334Speterheader files.
31818334Speter
31918334Speter@ifclear cppmanual
32018334Speter@item -fpch-deps
32118334Speter@opindex fpch-deps
32218334SpeterWhen using precompiled headers (@pxref{Precompiled Headers}), this flag
32318334Speterwill cause the dependency-output flags to also list the files from the
32418334Speterprecompiled header's dependencies.  If not specified only the
32518334Speterprecompiled header would be listed and not the files that were used to
32618334Spetercreate it because those files are not consulted when a precompiled
32718334Speterheader is used.
32818334Speter
32918334Speter@item -fpch-preprocess
33018334Speter@opindex fpch-preprocess
33118334SpeterThis option allows use of a precompiled header (@pxref{Precompiled
33218334SpeterHeaders}) together with @option{-E}.  It inserts a special @code{#pragma},
33318334Speter@code{#pragma GCC pch_preprocess "<filename>"} in the output to mark
33418334Speterthe place where the precompiled header was found, and its filename.  When
33518334Speter@option{-fpreprocessed} is in use, GCC recognizes this @code{#pragma} and
33618334Speterloads the PCH@.
33718334Speter
33818334SpeterThis option is off by default, because the resulting preprocessed output
33918334Speteris only really suitable as input to GCC@.  It is switched on by
34018334Speter@option{-save-temps}.
34150397Sobrien
34250397SobrienYou should not write this @code{#pragma} in your own code, but it is
34350397Sobriensafe to edit the filename if the PCH file is available in a different
34450397Sobrienlocation.  The filename may be absolute or it may be relative to GCC's
34550397Sobriencurrent directory.
34650397Sobrien
34750397Sobrien@end ifclear
34850397Sobrien@item -x c
34950397Sobrien@itemx -x c++
35050397Sobrien@itemx -x objective-c
35118334Speter@itemx -x assembler-with-cpp
35218334Speter@opindex x
35318334SpeterSpecify the source language: C, C++, Objective-C, or assembly.  This has
35452284Sobriennothing to do with standards conformance or extensions; it merely
35552284Sobrienselects which base syntax to expect.  If you give none of these options,
35652284Sobriencpp will deduce the language from the extension of the source file:
35752284Sobrien@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}.  Some other common
35818334Speterextensions for C++ and assembly are also recognized.  If cpp does not
35918334Speterrecognize the extension, it will treat the file as C; this is the most
36090075Sobriengeneric mode.
36118334Speter
36218334Speter@emph{Note:} Previous versions of cpp accepted a @option{-lang} option
36350397Sobrienwhich selected both the language and the standards conformance level.
36450397SobrienThis option has been removed, because it conflicts with the @option{-l}
36518334Speteroption.
36618334Speter
36718334Speter@item -std=@var{standard}
36818334Speter@itemx -ansi
36918334Speter@opindex ansi
37018334Speter@opindex std=
37118334SpeterSpecify the standard to which the code should conform.  Currently CPP
37218334Speterknows about C and C++ standards; others may be added in the future.
37318334Speter
37418334Speter@var{standard}
37518334Spetermay be one of:
37618334Speter@table @code
37718334Speter@item iso9899:1990
37818334Speter@itemx c89
37918334SpeterThe ISO C standard from 1990.  @samp{c89} is the customary shorthand for
38018334Speterthis version of the standard.
38118334Speter
38218334SpeterThe @option{-ansi} option is equivalent to @option{-std=c89}.
38350397Sobrien
38418334Speter@item iso9899:199409
38518334SpeterThe 1990 C standard, as amended in 1994.
38650397Sobrien
38718334Speter@item iso9899:1999
38818334Speter@itemx c99
38918334Speter@itemx iso9899:199x
39018334Speter@itemx c9x
39118334SpeterThe revised ISO C standard, published in December 1999.  Before
39218334Speterpublication, this was known as C9X@.
39318334Speter
39490075Sobrien@item gnu89
39518334SpeterThe 1990 C standard plus GNU extensions.  This is the default.
39618334Speter
39718334Speter@item gnu99
39818334Speter@itemx gnu9x
39918334SpeterThe 1999 C standard plus GNU extensions.
40018334Speter
40190075Sobrien@item c++98
40218334SpeterThe 1998 ISO C++ standard plus amendments.
40318334Speter
40418334Speter@item gnu++98
40552750SobrienThe same as @option{-std=c++98} plus GNU extensions.  This is the
40652750Sobriendefault for C++ code.
40790075Sobrien@end table
40852750Sobrien
40952750Sobrien@item -I-
41052750Sobrien@opindex I-
41152750SobrienSplit the include path.  Any directories specified with @option{-I}
41252750Sobrienoptions before @option{-I-} are searched only for headers requested with
41352750Sobrien@code{@w{#include "@var{file}"}}; they are not searched for
41452750Sobrien@code{@w{#include <@var{file}>}}.  If additional directories are
41552750Sobrienspecified with @option{-I} options after the @option{-I-}, those
41652750Sobriendirectories are searched for all @samp{#include} directives.
41752750Sobrien
41852750SobrienIn addition, @option{-I-} inhibits the use of the directory of the current
41918334Speterfile directory as the first search directory for @code{@w{#include
42090075Sobrien"@var{file}"}}.
42190075Sobrien@ifset cppmanual
42290075Sobrien@xref{Search Path}.
42390075Sobrien@end ifset
42418334SpeterThis option has been deprecated.
42590075Sobrien
42618334Speter@item -nostdinc
42790075Sobrien@opindex nostdinc
42890075SobrienDo not search the standard system directories for header files.
42990075SobrienOnly the directories you have specified with @option{-I} options
43090075Sobrien(and the directory of the current file, if appropriate) are searched.
43190075Sobrien
43290075Sobrien@item -nostdinc++
43390075Sobrien@opindex nostdinc++
43490075SobrienDo not search for header files in the C++-specific standard directories,
43590075Sobrienbut do still search the other standard directories.  (This option is
43690075Sobrienused when building the C++ library.)
43790075Sobrien
43890075Sobrien@item -include @var{file}
43990075Sobrien@opindex include
44090075SobrienProcess @var{file} as if @code{#include "file"} appeared as the first
44190075Sobrienline of the primary source file.  However, the first directory searched
44290075Sobrienfor @var{file} is the preprocessor's working directory @emph{instead of}
44318334Speterthe directory containing the main source file.  If not found there, it
44490075Sobrienis searched for in the remainder of the @code{#include "@dots{}"} search
44590075Sobrienchain as normal.
44690075Sobrien
44790075SobrienIf multiple @option{-include} options are given, the files are included
44852750Sobrienin the order they appear on the command line.
44990075Sobrien
45090075Sobrien@item -imacros @var{file}
45152750Sobrien@opindex imacros
45252750SobrienExactly like @option{-include}, except that any output produced by
45352750Sobrienscanning @var{file} is thrown away.  Macros it defines remain defined.
45452750SobrienThis allows you to acquire all the macros from a header without also
45552750Sobrienprocessing its declarations.
45690075Sobrien
45752750SobrienAll files specified by @option{-imacros} are processed before all files
45852750Sobrienspecified by @option{-include}.
45952750Sobrien
46018334Speter@item -idirafter @var{dir}
46190075Sobrien@opindex idirafter
46290075SobrienSearch @var{dir} for header files, but do it @emph{after} all
46390075Sobriendirectories specified with @option{-I} and the standard system directories
46490075Sobrienhave been exhausted.  @var{dir} is treated as a system include directory.
46552750Sobrien
46690075Sobrien@item -iprefix @var{prefix}
46790075Sobrien@opindex iprefix
46890075SobrienSpecify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
46990075Sobrienoptions.  If the prefix represents a directory, you should include the
47090075Sobrienfinal @samp{/}.
47190075Sobrien
47290075Sobrien@item -iwithprefix @var{dir}
47390075Sobrien@itemx -iwithprefixbefore @var{dir}
47490075Sobrien@opindex iwithprefix
47590075Sobrien@opindex iwithprefixbefore
47690075SobrienAppend @var{dir} to the prefix specified previously with
47790075Sobrien@option{-iprefix}, and add the resulting directory to the include search
47890075Sobrienpath.  @option{-iwithprefixbefore} puts it in the same place @option{-I}
47990075Sobrienwould; @option{-iwithprefix} puts it where @option{-idirafter} would.
48090075Sobrien
48190075Sobrien@item -isysroot @var{dir}
48290075Sobrien@opindex isysroot
48352750SobrienThis option is like the @option{--sysroot} option, but applies only to
48452750Sobrienheader files.  See the @option{--sysroot} option for more information.
48518334Speter
48652750Sobrien@item -imultilib @var{dir}
48752750Sobrien@opindex imultilib
48852750SobrienUse @var{dir} as a subdirectory of the directory containing
48918334Spetertarget-specific C++ headers.
49052750Sobrien
49152750Sobrien@item -isystem @var{dir}
49252750Sobrien@opindex isystem
49352750SobrienSearch @var{dir} for header files, after all directories specified by
49452750Sobrien@option{-I} but before the standard system directories.  Mark it
49552750Sobrienas a system directory, so that it gets the same special treatment as
49618334Speteris applied to the standard system directories.
49718334Speter@ifset cppmanual
49818334Speter@xref{System Headers}.
49918334Speter@end ifset
50018334Speter
50118334Speter@item -iquote @var{dir}
50252750Sobrien@opindex iquote
50352750SobrienSearch @var{dir} only for header files requested with
50452750Sobrien@code{@w{#include "@var{file}"}}; they are not searched for
50552750Sobrien@code{@w{#include <@var{file}>}}, before all directories specified by
50652750Sobrien@option{-I} and before the standard system directories.
50752750Sobrien@ifset cppmanual
50852750Sobrien@xref{Search Path}.
50952750Sobrien@end ifset
51018334Speter
51118334Speter@item -fdollars-in-identifiers
51218334Speter@opindex fdollars-in-identifiers
51318334Speter@anchor{fdollars-in-identifiers}
51490075SobrienAccept @samp{$} in identifiers.
51590075Sobrien@ifset cppmanual
51652750Sobrien  @xref{Identifier characters}.
51752750Sobrien@end ifset
51852750Sobrien
51952750Sobrien@item -fextended-identifiers
52052750Sobrien@opindex fextended-identifiers
52118334SpeterAccept universal character names in identifiers.  This option is
52218334Speterexperimental; in a future version of GCC, it will be enabled by
52318334Speterdefault for C99 and C++.
52490075Sobrien
52518334Speter@item -fpreprocessed
52690075Sobrien@opindex fpreprocessed
52790075SobrienIndicate to the preprocessor that the input file has already been
52890075Sobrienpreprocessed.  This suppresses things like macro expansion, trigraph
52990075Sobrienconversion, escaped newline splicing, and processing of most directives.
53018334SpeterThe preprocessor still recognizes and removes comments, so that you can
53118334Speterpass a file preprocessed with @option{-C} to the compiler without
53218334Speterproblems.  In this mode the integrated preprocessor is little more than
53390075Sobriena tokenizer for the front ends.
53490075Sobrien
53590075Sobrien@option{-fpreprocessed} is implicit if the input file has one of the
53690075Sobrienextensions @samp{.i}, @samp{.ii} or @samp{.mi}.  These are the
53790075Sobrienextensions that GCC uses for preprocessed files created by
53818334Speter@option{-save-temps}.
53990075Sobrien
54090075Sobrien@item -ftabstop=@var{width}
54190075Sobrien@opindex ftabstop
54290075SobrienSet the distance between tab stops.  This helps the preprocessor report
54318334Spetercorrect column numbers in warnings or errors, even if tabs appear on the
54490075Sobrienline.  If the value is less than 1 or greater than 100, the option is
54590075Sobrienignored.  The default is 8.
54690075Sobrien
54718334Speter@item -fexec-charset=@var{charset}
54818334Speter@opindex fexec-charset
54990075Sobrien@cindex character set, execution
55090075SobrienSet the execution character set, used for string and character
55118334Speterconstants.  The default is UTF-8.  @var{charset} can be any encoding
55290075Sobriensupported by the system's @code{iconv} library routine.
55318334Speter
55418334Speter@item -fwide-exec-charset=@var{charset}
55518334Speter@opindex fwide-exec-charset
55618334Speter@cindex character set, wide execution
55718334SpeterSet the wide execution character set, used for wide string and
55818334Spetercharacter constants.  The default is UTF-32 or UTF-16, whichever
55918334Spetercorresponds to the width of @code{wchar_t}.  As with
56018334Speter@option{-fexec-charset}, @var{charset} can be any encoding supported
56118334Speterby the system's @code{iconv} library routine; however, you will have
56218334Speterproblems with encodings that do not fit exactly in @code{wchar_t}.
56318334Speter
56418334Speter@item -finput-charset=@var{charset}
56518334Speter@opindex finput-charset
56618334Speter@cindex character set, input
56718334SpeterSet the input character set, used for translation from the character
56818334Speterset of the input file to the source character set used by GCC@.  If the
56918334Speterlocale does not specify, or GCC cannot get this information from the
57018334Speterlocale, the default is UTF-8.  This can be overridden by either the locale
57118334Speteror this command line option.  Currently the command line option takes
57218334Speterprecedence if there's a conflict.  @var{charset} can be any encoding
57318334Spetersupported by the system's @code{iconv} library routine.
57418334Speter
57518334Speter@item -fworking-directory
57690075Sobrien@opindex fworking-directory
57790075Sobrien@opindex fno-working-directory
57818334SpeterEnable generation of linemarkers in the preprocessor output that will
57918334Speterlet the compiler know the current working directory at the time of
58090075Sobrienpreprocessing.  When this option is enabled, the preprocessor will
58190075Sobrienemit, after the initial linemarker, a second linemarker with the
58290075Sobriencurrent working directory followed by two slashes.  GCC will use this
58318334Speterdirectory, when it's present in the preprocessed input, as the
58490075Sobriendirectory emitted as the current working directory in some debugging
58518334Speterinformation formats.  This option is implicitly enabled if debugging
58690075Sobrieninformation is enabled, but this can be inhibited with the negated
58790075Sobrienform @option{-fno-working-directory}.  If the @option{-P} flag is
58890075Sobrienpresent in the command line, this option has no effect, since no
58918334Speter@code{#line} directives are emitted whatsoever.
59018334Speter
59118334Speter@item -fno-show-column
59218334Speter@opindex fno-show-column
59318334SpeterDo not print column numbers in diagnostics.  This may be necessary if
59418334Speterdiagnostics are being scanned by a program that does not understand the
59518334Spetercolumn numbers, such as @command{dejagnu}.
59618334Speter
59718334Speter@item -A @var{predicate}=@var{answer}
59818334Speter@opindex A
59918334SpeterMake an assertion with the predicate @var{predicate} and answer
60018334Speter@var{answer}.  This form is preferred to the older form @option{-A
60118334Speter@var{predicate}(@var{answer})}, which is still supported, because
60218334Speterit does not use shell special characters.
60318334Speter@ifset cppmanual
60418334Speter@xref{Assertions}.
60518334Speter@end ifset
60618334Speter
60718334Speter@item -A -@var{predicate}=@var{answer}
60818334SpeterCancel an assertion with the predicate @var{predicate} and answer
60918334Speter@var{answer}.
61018334Speter
61118334Speter@item -dCHARS
61218334Speter@var{CHARS} is a sequence of one or more of the following characters,
61318334Speterand must not be preceded by a space.  Other characters are interpreted
61418334Speterby the compiler proper, or reserved for future versions of GCC, and so
61518334Speterare silently ignored.  If you specify characters whose behavior
61618334Speterconflicts, the result is undefined.
61718334Speter
61818334Speter@table @samp
61918334Speter@item M
62018334Speter@opindex dM
62118334SpeterInstead of the normal output, generate a list of @samp{#define}
62218334Speterdirectives for all the macros defined during the execution of the
62318334Speterpreprocessor, including predefined macros.  This gives you a way of
62418334Speterfinding out what is predefined in your version of the preprocessor.
62518334SpeterAssuming you have no file @file{foo.h}, the command
62618334Speter
62718334Speter@smallexample
62818334Spetertouch foo.h; cpp -dM foo.h
62918334Speter@end smallexample
63018334Speter
63118334Speter@noindent
63218334Speterwill show all the predefined macros.
63318334Speter
63418334Speter@item D
63590075Sobrien@opindex dD
63690075SobrienLike @samp{M} except in two respects: it does @emph{not} include the
63790075Sobrienpredefined macros, and it outputs @emph{both} the @samp{#define}
63890075Sobriendirectives and the result of preprocessing.  Both kinds of output go to
63990075Sobrienthe standard output file.
64090075Sobrien
64190075Sobrien@item N
64290075Sobrien@opindex dN
64390075SobrienLike @samp{D}, but emit only the macro names, not their expansions.
64490075Sobrien
64518334Speter@item I
64690075Sobrien@opindex dI
64718334SpeterOutput @samp{#include} directives in addition to the result of
64890075Sobrienpreprocessing.
64990075Sobrien@end table
65090075Sobrien
65118334Speter@item -P
65290075Sobrien@opindex P
65390075SobrienInhibit generation of linemarkers in the output from the preprocessor.
65490075SobrienThis might be useful when running the preprocessor on something that is
65518334Speternot C code, and will be sent to a program which might be confused by the
65690075Sobrienlinemarkers.
65790075Sobrien@ifset cppmanual
65890075Sobrien@xref{Preprocessor Output}.
65990075Sobrien@end ifset
66090075Sobrien
66190075Sobrien@item -C
66218334Speter@opindex C
66390075SobrienDo not discard comments.  All comments are passed through to the output
66490075Sobrienfile, except for comments in processed directives, which are deleted
66590075Sobrienalong with the directive.
66690075Sobrien
66718334SpeterYou should be prepared for side effects when using @option{-C}; it
66890075Sobriencauses the preprocessor to treat comments as tokens in their own right.
66918334SpeterFor example, comments appearing at the start of what would be a
67090075Sobriendirective line have the effect of turning that line into an ordinary
67190075Sobriensource line, since the first token on the line is no longer a @samp{#}.
67218334Speter
67390075Sobrien@item -CC
67490075SobrienDo not discard comments, including during macro expansion.  This is
67590075Sobrienlike @option{-C}, except that comments contained within macros are
67690075Sobrienalso passed through to the output file where the macro is expanded.
67790075Sobrien
67890075SobrienIn addition to the side-effects of the @option{-C} option, the
67990075Sobrien@option{-CC} option causes all C++-style comments inside a macro
68090075Sobriento be converted to C-style comments.  This is to prevent later use
68190075Sobrienof that macro from inadvertently commenting out the remainder of
68290075Sobrienthe source line.
68390075Sobrien
68490075SobrienThe @option{-CC} option is generally used to support lint comments.
68590075Sobrien
68690075Sobrien@item -traditional-cpp
68790075Sobrien@opindex traditional-cpp
68890075SobrienTry to imitate the behavior of old-fashioned C preprocessors, as
68990075Sobrienopposed to ISO C preprocessors.
69090075Sobrien@ifset cppmanual
69190075Sobrien@xref{Traditional Mode}.
69290075Sobrien@end ifset
69390075Sobrien
69490075Sobrien@item -trigraphs
69590075Sobrien@opindex trigraphs
69690075SobrienProcess trigraph sequences.
69790075Sobrien@ifset cppmanual
69818334Speter@xref{Initial processing}.
69918334Speter@end ifset
70090075Sobrien@ifclear cppmanual
70118334SpeterThese are three-character sequences, all starting with @samp{??}, that
70290075Sobrienare defined by ISO C to stand for single characters.  For example,
70390075Sobrien@samp{??/} stands for @samp{\}, so @samp{'??/n'} is a character
70418334Speterconstant for a newline.  By default, GCC ignores trigraphs, but in
70590075Sobrienstandard-conforming modes it converts them.  See the @option{-std} and
70618334Speter@option{-ansi} options.
70718334Speter
70818334SpeterThe nine trigraphs and their replacements are
70918334Speter
71018334Speter@smallexample
71190075SobrienTrigraph:       ??(  ??)  ??<  ??>  ??=  ??/  ??'  ??!  ??-
71290075SobrienReplacement:      [    ]    @{    @}    #    \    ^    |    ~
71390075Sobrien@end smallexample
71490075Sobrien@end ifclear
71590075Sobrien
71690075Sobrien@item -remap
71790075Sobrien@opindex remap
71818334SpeterEnable special code to work around file systems which only permit very
71990075Sobrienshort file names, such as MS-DOS@.
72090075Sobrien
72190075Sobrien@itemx --help
72290075Sobrien@itemx --target-help
72390075Sobrien@opindex help
72490075Sobrien@opindex target-help
72590075SobrienPrint text describing all the command line options instead of
72690075Sobrienpreprocessing anything.
72790075Sobrien
72852284Sobrien@item -v
72990075Sobrien@opindex v
73090075SobrienVerbose mode.  Print out GNU CPP's version number at the beginning of
73190075Sobrienexecution, and report the final form of the include path.
73290075Sobrien
73390075Sobrien@item -H
73490075Sobrien@opindex H
73590075SobrienPrint the name of each header file used, in addition to other normal
73690075Sobrienactivities.  Each name is indented to show how deep in the
73790075Sobrien@samp{#include} stack it is.  Precompiled header files are also
73890075Sobrienprinted, even if they are found to be invalid; an invalid precompiled
73990075Sobrienheader file is printed with @samp{...x} and a valid one with @samp{...!} .
74090075Sobrien
74190075Sobrien@item -version
74290075Sobrien@itemx --version
74390075Sobrien@opindex version
74490075SobrienPrint out GNU CPP's version number.  With one dash, proceed to
74590075Sobrienpreprocess as normal.  With two dashes, exit immediately.
74690075Sobrien@end table
74790075Sobrien