1169689Skan@c Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
296263Sobrien@c Free Software Foundation, Inc.
396263Sobrien@c This is part of the CPP and GCC manuals.
496263Sobrien@c For copying conditions, see the file gcc.texi.
596263Sobrien
696263Sobrien@c ---------------------------------------------------------------------
796263Sobrien@c Options affecting the preprocessor
896263Sobrien@c ---------------------------------------------------------------------
996263Sobrien
1096263Sobrien@c If this file is included with the flag ``cppmanual'' set, it is
1196263Sobrien@c formatted for inclusion in the CPP manual; otherwise the main GCC manual.
1296263Sobrien
1396263Sobrien@table @gcctabopt
1496263Sobrien@item -D @var{name}
1596263Sobrien@opindex D
1696263SobrienPredefine @var{name} as a macro, with definition @code{1}.
1796263Sobrien
1896263Sobrien@item -D @var{name}=@var{definition}
19132718SkanThe contents of @var{definition} are tokenized and processed as if
20132718Skanthey appeared during translation phase three in a @samp{#define}
21132718Skandirective.  In particular, the definition will be truncated by
22132718Skanembedded newline characters.
2396263Sobrien
24132718SkanIf you are invoking the preprocessor from a shell or shell-like
25132718Skanprogram you may need to use the shell's quoting syntax to protect
26132718Skancharacters such as spaces that have a meaning in the shell syntax.
27132718Skan
2896263SobrienIf you wish to define a function-like macro on the command line, write
2996263Sobrienits argument list with surrounding parentheses before the equals sign
3096263Sobrien(if any).  Parentheses are meaningful to most shells, so you will need
3196263Sobriento quote the option.  With @command{sh} and @command{csh},
3296263Sobrien@option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works.
3396263Sobrien
3496263Sobrien@option{-D} and @option{-U} options are processed in the order they
3596263Sobrienare given on the command line.  All @option{-imacros @var{file}} and
3696263Sobrien@option{-include @var{file}} options are processed after all
3796263Sobrien@option{-D} and @option{-U} options.
3896263Sobrien
3996263Sobrien@item -U @var{name}
4096263Sobrien@opindex U
4196263SobrienCancel any previous definition of @var{name}, either built in or
4296263Sobrienprovided with a @option{-D} option.
4396263Sobrien
4496263Sobrien@item -undef
4596263Sobrien@opindex undef
46119256SkanDo not predefine any system-specific or GCC-specific macros.  The
47119256Skanstandard predefined macros remain defined.
48119256Skan@ifset cppmanual
49119256Skan@xref{Standard Predefined Macros}.
50119256Skan@end ifset
5196263Sobrien
5296263Sobrien@item -I @var{dir}
5396263Sobrien@opindex I
5496263SobrienAdd the directory @var{dir} to the list of directories to be searched
5596263Sobrienfor header files.
5696263Sobrien@ifset cppmanual
5796263Sobrien@xref{Search Path}.
5896263Sobrien@end ifset
5996263SobrienDirectories named by @option{-I} are searched before the standard
60117395Skansystem include directories.  If the directory @var{dir} is a standard
61117395Skansystem include directory, the option is ignored to ensure that the
62117395Skandefault search order for system directories and the special treatment
63117395Skanof system headers are not defeated
6496263Sobrien@ifset cppmanual
6596263Sobrien(@pxref{System Headers})
6696263Sobrien@end ifset
67117395Skan.
6896263Sobrien
6996263Sobrien@item -o @var{file}
7096263Sobrien@opindex o
7196263SobrienWrite output to @var{file}.  This is the same as specifying @var{file}
7296263Sobrienas the second non-option argument to @command{cpp}.  @command{gcc} has a
7396263Sobriendifferent interpretation of a second non-option argument, so you must
7496263Sobrienuse @option{-o} to specify the output file.
7596263Sobrien
7696263Sobrien@item -Wall
7796263Sobrien@opindex Wall
78132718SkanTurns on all optional warnings which are desirable for normal code.
79132718SkanAt present this is @option{-Wcomment}, @option{-Wtrigraphs},
80132718Skan@option{-Wmultichar} and a warning about integer promotion causing a
81132718Skanchange of sign in @code{#if} expressions.  Note that many of the
82132718Skanpreprocessor's warnings are on by default and have no options to
83132718Skancontrol them.
8496263Sobrien
8596263Sobrien@item -Wcomment
8696263Sobrien@itemx -Wcomments
8796263Sobrien@opindex Wcomment
8896263Sobrien@opindex Wcomments
8996263SobrienWarn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
9096263Sobriencomment, or whenever a backslash-newline appears in a @samp{//} comment.
9196263Sobrien(Both forms have the same effect.)
9296263Sobrien
9396263Sobrien@item -Wtrigraphs
9496263Sobrien@opindex Wtrigraphs
95132718Skan@anchor{Wtrigraphs}
96132718SkanMost trigraphs in comments cannot affect the meaning of the program.
97132718SkanHowever, a trigraph that would form an escaped newline (@samp{??/} at
98132718Skanthe end of a line) can, by changing where the comment begins or ends.
99132718SkanTherefore, only trigraphs that would form escaped newlines produce
100132718Skanwarnings inside a comment.
10196263Sobrien
102132718SkanThis option is implied by @option{-Wall}.  If @option{-Wall} is not
103132718Skangiven, this option is still enabled unless trigraphs are enabled.  To
104132718Skanget trigraph conversion without warnings, but get the other
105132718Skan@option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
106132718Skan
10796263Sobrien@item -Wtraditional
10896263Sobrien@opindex Wtraditional
10996263SobrienWarn about certain constructs that behave differently in traditional and
11096263SobrienISO C@.  Also warn about ISO C constructs that have no traditional C
11196263Sobrienequivalent, and problematic constructs which should be avoided.
11296263Sobrien@ifset cppmanual
11396263Sobrien@xref{Traditional Mode}.
11496263Sobrien@end ifset
11596263Sobrien
11696263Sobrien@item -Wimport
11796263Sobrien@opindex Wimport
11896263SobrienWarn the first time @samp{#import} is used.
11996263Sobrien
12096263Sobrien@item -Wundef
12196263Sobrien@opindex Wundef
12296263SobrienWarn whenever an identifier which is not a macro is encountered in an
12396263Sobrien@samp{#if} directive, outside of @samp{defined}.  Such identifiers are
12496263Sobrienreplaced with zero.
12596263Sobrien
126117395Skan@item -Wunused-macros
127117395Skan@opindex Wunused-macros
128117395SkanWarn about macros defined in the main file that are unused.  A macro
129117395Skanis @dfn{used} if it is expanded or tested for existence at least once.
130117395SkanThe preprocessor will also warn if the macro has not been used at the
131117395Skantime it is redefined or undefined.
132117395Skan
133117395SkanBuilt-in macros, macros defined on the command line, and macros
134117395Skandefined in include files are not warned about.
135117395Skan
136169689Skan@emph{Note:} If a macro is actually used, but only used in skipped
137117395Skanconditional blocks, then CPP will report it as unused.  To avoid the
138117395Skanwarning in such a case, you might improve the scope of the macro's
139117395Skandefinition by, for example, moving it into the first skipped block.
140117395SkanAlternatively, you could provide a dummy use with something like:
141117395Skan
142117395Skan@smallexample
143117395Skan#if defined the_macro_causing_the_warning
144117395Skan#endif
145117395Skan@end smallexample
146117395Skan
147117395Skan@item -Wendif-labels
148117395Skan@opindex Wendif-labels
149117395SkanWarn whenever an @samp{#else} or an @samp{#endif} are followed by text.
150117395SkanThis usually happens in code of the form
151117395Skan
152117395Skan@smallexample
153117395Skan#if FOO
154117395Skan@dots{}
155117395Skan#else FOO
156117395Skan@dots{}
157117395Skan#endif FOO
158117395Skan@end smallexample
159117395Skan
160117395Skan@noindent
161117395SkanThe second and third @code{FOO} should be in comments, but often are not
162117395Skanin older programs.  This warning is on by default.
163117395Skan
16496263Sobrien@item -Werror
16596263Sobrien@opindex Werror
16696263SobrienMake all warnings into hard errors.  Source code which triggers warnings
16796263Sobrienwill be rejected.
16896263Sobrien
16996263Sobrien@item -Wsystem-headers
17096263Sobrien@opindex Wsystem-headers
17196263SobrienIssue warnings for code in system headers.  These are normally unhelpful
17296263Sobrienin finding bugs in your own code, therefore suppressed.  If you are
17396263Sobrienresponsible for the system library, you may want to see them.
17496263Sobrien
17596263Sobrien@item -w
17696263Sobrien@opindex w
17796263SobrienSuppress all warnings, including those which GNU CPP issues by default.
17896263Sobrien
17996263Sobrien@item -pedantic
18096263Sobrien@opindex pedantic
18196263SobrienIssue all the mandatory diagnostics listed in the C standard.  Some of
18296263Sobrienthem are left out by default, since they trigger frequently on harmless
18396263Sobriencode.
18496263Sobrien
18596263Sobrien@item -pedantic-errors
18696263Sobrien@opindex pedantic-errors
18796263SobrienIssue all the mandatory diagnostics, and make all mandatory diagnostics
18896263Sobrieninto errors.  This includes mandatory diagnostics that GCC issues
18996263Sobrienwithout @samp{-pedantic} but treats as warnings.
19096263Sobrien
19196263Sobrien@item -M
19296263Sobrien@opindex M
19396263Sobrien@cindex make
19496263Sobrien@cindex dependencies, make
19596263SobrienInstead of outputting the result of preprocessing, output a rule
19696263Sobriensuitable for @command{make} describing the dependencies of the main
19796263Sobriensource file.  The preprocessor outputs one @command{make} rule containing
19896263Sobrienthe object file name for that source file, a colon, and the names of all
19996263Sobrienthe included files, including those coming from @option{-include} or
20096263Sobrien@option{-imacros} command line options.
20196263Sobrien
20296263SobrienUnless specified explicitly (with @option{-MT} or @option{-MQ}), the
20396263Sobrienobject file name consists of the basename of the source file with any
20496263Sobriensuffix replaced with object file suffix.  If there are many included
20596263Sobrienfiles then the rule is split into several lines using @samp{\}-newline.
20696263SobrienThe rule has no commands.
20796263Sobrien
20896263SobrienThis option does not suppress the preprocessor's debug output, such as
20996263Sobrien@option{-dM}.  To avoid mixing such debug output with the dependency
21096263Sobrienrules you should explicitly specify the dependency output file with
21196263Sobrien@option{-MF}, or use an environment variable like
212117395Skan@env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}).  Debug output
21396263Sobrienwill still be sent to the regular output stream as normal.
21496263Sobrien
215117395SkanPassing @option{-M} to the driver implies @option{-E}, and suppresses
216117395Skanwarnings with an implicit @option{-w}.
21796263Sobrien
21896263Sobrien@item -MM
21996263Sobrien@opindex MM
22096263SobrienLike @option{-M} but do not mention header files that are found in
22196263Sobriensystem header directories, nor header files that are included,
22296263Sobriendirectly or indirectly, from such a header.
22396263Sobrien
22496263SobrienThis implies that the choice of angle brackets or double quotes in an
22596263Sobrien@samp{#include} directive does not in itself determine whether that
22696263Sobrienheader will appear in @option{-MM} dependency output.  This is a
22796263Sobrienslight change in semantics from GCC versions 3.0 and earlier.
22896263Sobrien
229132718Skan@anchor{dashMF}
23096263Sobrien@item -MF @var{file}
23196263Sobrien@opindex MF
23296263SobrienWhen used with @option{-M} or @option{-MM}, specifies a
23396263Sobrienfile to write the dependencies to.  If no @option{-MF} switch is given
23496263Sobrienthe preprocessor sends the rules to the same place it would have sent
23596263Sobrienpreprocessed output.
23696263Sobrien
23796263SobrienWhen used with the driver options @option{-MD} or @option{-MMD},
23896263Sobrien@option{-MF} overrides the default dependency output file.
23996263Sobrien
24096263Sobrien@item -MG
24196263Sobrien@opindex MG
242117395SkanIn conjunction with an option such as @option{-M} requesting
243117395Skandependency generation, @option{-MG} assumes missing header files are
244117395Skangenerated files and adds them to the dependency list without raising
245117395Skanan error.  The dependency filename is taken directly from the
246117395Skan@code{#include} directive without prepending any path.  @option{-MG}
247117395Skanalso suppresses preprocessed output, as a missing header file renders
248117395Skanthis useless.
24996263Sobrien
25096263SobrienThis feature is used in automatic updating of makefiles.
25196263Sobrien
25296263Sobrien@item -MP
25396263Sobrien@opindex MP
25496263SobrienThis option instructs CPP to add a phony target for each dependency
25596263Sobrienother than the main file, causing each to depend on nothing.  These
25696263Sobriendummy rules work around errors @command{make} gives if you remove header
25796263Sobrienfiles without updating the @file{Makefile} to match.
25896263Sobrien
25996263SobrienThis is typical output:
26096263Sobrien
261132718Skan@smallexample
26296263Sobrientest.o: test.c test.h
26396263Sobrien
26496263Sobrientest.h:
265132718Skan@end smallexample
26696263Sobrien
26796263Sobrien@item -MT @var{target}
26896263Sobrien@opindex MT
26996263Sobrien
27096263SobrienChange the target of the rule emitted by dependency generation.  By
27196263Sobriendefault CPP takes the name of the main input file, including any path,
27296263Sobriendeletes any file suffix such as @samp{.c}, and appends the platform's
27396263Sobrienusual object suffix.  The result is the target.
27496263Sobrien
27596263SobrienAn @option{-MT} option will set the target to be exactly the string you
27696263Sobrienspecify.  If you want multiple targets, you can specify them as a single
27796263Sobrienargument to @option{-MT}, or use multiple @option{-MT} options.
27896263Sobrien
27996263SobrienFor example, @option{@w{-MT '$(objpfx)foo.o'}} might give
28096263Sobrien
281132718Skan@smallexample
28296263Sobrien$(objpfx)foo.o: foo.c
283132718Skan@end smallexample
28496263Sobrien
28596263Sobrien@item -MQ @var{target}
28696263Sobrien@opindex MQ
28796263Sobrien
28896263SobrienSame as @option{-MT}, but it quotes any characters which are special to
28996263SobrienMake.  @option{@w{-MQ '$(objpfx)foo.o'}} gives
29096263Sobrien
291132718Skan@smallexample
29296263Sobrien$$(objpfx)foo.o: foo.c
293132718Skan@end smallexample
29496263Sobrien
29596263SobrienThe default target is automatically quoted, as if it were given with
29696263Sobrien@option{-MQ}.
29796263Sobrien
29896263Sobrien@item -MD
29996263Sobrien@opindex MD
30096263Sobrien@option{-MD} is equivalent to @option{-M -MF @var{file}}, except that
30196263Sobrien@option{-E} is not implied.  The driver determines @var{file} based on
30296263Sobrienwhether an @option{-o} option is given.  If it is, the driver uses its
30396263Sobrienargument but with a suffix of @file{.d}, otherwise it take the
30496263Sobrienbasename of the input file and applies a @file{.d} suffix.
30596263Sobrien
30696263SobrienIf @option{-MD} is used in conjunction with @option{-E}, any
30796263Sobrien@option{-o} switch is understood to specify the dependency output file
308169689Skan(@pxref{dashMF,,-MF}), but if used without @option{-E}, each @option{-o}
30996263Sobrienis understood to specify a target object file.
31096263Sobrien
31196263SobrienSince @option{-E} is not implied, @option{-MD} can be used to generate
31296263Sobriena dependency output file as a side-effect of the compilation process.
31396263Sobrien
31496263Sobrien@item -MMD
31596263Sobrien@opindex MMD
31696263SobrienLike @option{-MD} except mention only user header files, not system
317169689Skanheader files.
31896263Sobrien
319132718Skan@ifclear cppmanual
320132718Skan@item -fpch-deps
321132718Skan@opindex fpch-deps
322132718SkanWhen using precompiled headers (@pxref{Precompiled Headers}), this flag
323132718Skanwill cause the dependency-output flags to also list the files from the
324132718Skanprecompiled header's dependencies.  If not specified only the
325132718Skanprecompiled header would be listed and not the files that were used to
326132718Skancreate it because those files are not consulted when a precompiled
327132718Skanheader is used.
328132718Skan
329169689Skan@item -fpch-preprocess
330169689Skan@opindex fpch-preprocess
331169689SkanThis option allows use of a precompiled header (@pxref{Precompiled
332169689SkanHeaders}) together with @option{-E}.  It inserts a special @code{#pragma},
333169689Skan@code{#pragma GCC pch_preprocess "<filename>"} in the output to mark
334169689Skanthe place where the precompiled header was found, and its filename.  When
335169689Skan@option{-fpreprocessed} is in use, GCC recognizes this @code{#pragma} and
336169689Skanloads the PCH@.
337169689Skan
338169689SkanThis option is off by default, because the resulting preprocessed output
339169689Skanis only really suitable as input to GCC@.  It is switched on by
340169689Skan@option{-save-temps}.
341169689Skan
342169689SkanYou should not write this @code{#pragma} in your own code, but it is
343169689Skansafe to edit the filename if the PCH file is available in a different
344169689Skanlocation.  The filename may be absolute or it may be relative to GCC's
345169689Skancurrent directory.
346169689Skan
347132718Skan@end ifclear
34896263Sobrien@item -x c
34996263Sobrien@itemx -x c++
35096263Sobrien@itemx -x assembler-with-cpp
35196263Sobrien@opindex x
352220755SdimSpecify the source language: C, C++, or assembly.  This has nothing to
353220755Sdimdo with standards conformance or extensions; it merely selects which
354220755Sdimbase syntax to expect.  If you give none of these options, cpp will
355220755Sdimdeduce the language from the extension of the source file: @samp{.c},
356220755Sdim@samp{.cc}, or @samp{.S}.  Some other common extensions for C++ and
357220755Sdimassembly are also recognized.  If cpp does not recognize the extension,
358220755Sdimit will treat the file as C; this is the most generic mode.
35996263Sobrien
360169689Skan@emph{Note:} Previous versions of cpp accepted a @option{-lang} option
36196263Sobrienwhich selected both the language and the standards conformance level.
36296263SobrienThis option has been removed, because it conflicts with the @option{-l}
36396263Sobrienoption.
36496263Sobrien
36596263Sobrien@item -std=@var{standard}
36696263Sobrien@itemx -ansi
36796263Sobrien@opindex ansi
36896263Sobrien@opindex std=
369117395SkanSpecify the standard to which the code should conform.  Currently CPP
370117395Skanknows about C and C++ standards; others may be added in the future.
37196263Sobrien
37296263Sobrien@var{standard}
37396263Sobrienmay be one of:
37496263Sobrien@table @code
37596263Sobrien@item iso9899:1990
37696263Sobrien@itemx c89
37796263SobrienThe ISO C standard from 1990.  @samp{c89} is the customary shorthand for
37896263Sobrienthis version of the standard.
37996263Sobrien
38096263SobrienThe @option{-ansi} option is equivalent to @option{-std=c89}.
38196263Sobrien
38296263Sobrien@item iso9899:199409
38396263SobrienThe 1990 C standard, as amended in 1994.
38496263Sobrien
38596263Sobrien@item iso9899:1999
38696263Sobrien@itemx c99
38796263Sobrien@itemx iso9899:199x
38896263Sobrien@itemx c9x
38996263SobrienThe revised ISO C standard, published in December 1999.  Before
39096263Sobrienpublication, this was known as C9X@.
39196263Sobrien
39296263Sobrien@item gnu89
39396263SobrienThe 1990 C standard plus GNU extensions.  This is the default.
39496263Sobrien
39596263Sobrien@item gnu99
39696263Sobrien@itemx gnu9x
39796263SobrienThe 1999 C standard plus GNU extensions.
398117395Skan
399117395Skan@item c++98
400117395SkanThe 1998 ISO C++ standard plus amendments.
401117395Skan
402117395Skan@item gnu++98
403117395SkanThe same as @option{-std=c++98} plus GNU extensions.  This is the
404117395Skandefault for C++ code.
40596263Sobrien@end table
40696263Sobrien
40796263Sobrien@item -I-
40896263Sobrien@opindex I-
40996263SobrienSplit the include path.  Any directories specified with @option{-I}
41096263Sobrienoptions before @option{-I-} are searched only for headers requested with
41196263Sobrien@code{@w{#include "@var{file}"}}; they are not searched for
41296263Sobrien@code{@w{#include <@var{file}>}}.  If additional directories are
41396263Sobrienspecified with @option{-I} options after the @option{-I-}, those
41496263Sobriendirectories are searched for all @samp{#include} directives.
41596263Sobrien
41696263SobrienIn addition, @option{-I-} inhibits the use of the directory of the current
41796263Sobrienfile directory as the first search directory for @code{@w{#include
41896263Sobrien"@var{file}"}}.
41996263Sobrien@ifset cppmanual
42096263Sobrien@xref{Search Path}.
42196263Sobrien@end ifset
422169689SkanThis option has been deprecated.
42396263Sobrien
42496263Sobrien@item -nostdinc
42596263Sobrien@opindex nostdinc
42696263SobrienDo not search the standard system directories for header files.
42796263SobrienOnly the directories you have specified with @option{-I} options
42896263Sobrien(and the directory of the current file, if appropriate) are searched.
42996263Sobrien
43096263Sobrien@item -nostdinc++
43196263Sobrien@opindex nostdinc++
43296263SobrienDo not search for header files in the C++-specific standard directories,
43396263Sobrienbut do still search the other standard directories.  (This option is
43496263Sobrienused when building the C++ library.)
43596263Sobrien
43696263Sobrien@item -include @var{file}
43796263Sobrien@opindex include
43896263SobrienProcess @var{file} as if @code{#include "file"} appeared as the first
43996263Sobrienline of the primary source file.  However, the first directory searched
44096263Sobrienfor @var{file} is the preprocessor's working directory @emph{instead of}
44196263Sobrienthe directory containing the main source file.  If not found there, it
44296263Sobrienis searched for in the remainder of the @code{#include "@dots{}"} search
44396263Sobrienchain as normal.
44496263Sobrien
44596263SobrienIf multiple @option{-include} options are given, the files are included
44696263Sobrienin the order they appear on the command line.
44796263Sobrien
44896263Sobrien@item -imacros @var{file}
44996263Sobrien@opindex imacros
45096263SobrienExactly like @option{-include}, except that any output produced by
45196263Sobrienscanning @var{file} is thrown away.  Macros it defines remain defined.
45296263SobrienThis allows you to acquire all the macros from a header without also
45396263Sobrienprocessing its declarations.
45496263Sobrien
45596263SobrienAll files specified by @option{-imacros} are processed before all files
45696263Sobrienspecified by @option{-include}.
45796263Sobrien
45896263Sobrien@item -idirafter @var{dir}
45996263Sobrien@opindex idirafter
46096263SobrienSearch @var{dir} for header files, but do it @emph{after} all
46196263Sobriendirectories specified with @option{-I} and the standard system directories
46296263Sobrienhave been exhausted.  @var{dir} is treated as a system include directory.
46396263Sobrien
46496263Sobrien@item -iprefix @var{prefix}
46596263Sobrien@opindex iprefix
46696263SobrienSpecify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
46796263Sobrienoptions.  If the prefix represents a directory, you should include the
46896263Sobrienfinal @samp{/}.
46996263Sobrien
47096263Sobrien@item -iwithprefix @var{dir}
47196263Sobrien@itemx -iwithprefixbefore @var{dir}
47296263Sobrien@opindex iwithprefix
47396263Sobrien@opindex iwithprefixbefore
47496263SobrienAppend @var{dir} to the prefix specified previously with
47596263Sobrien@option{-iprefix}, and add the resulting directory to the include search
47696263Sobrienpath.  @option{-iwithprefixbefore} puts it in the same place @option{-I}
47796263Sobrienwould; @option{-iwithprefix} puts it where @option{-idirafter} would.
47896263Sobrien
479169689Skan@item -isysroot @var{dir}
480169689Skan@opindex isysroot
481169689SkanThis option is like the @option{--sysroot} option, but applies only to
482169689Skanheader files.  See the @option{--sysroot} option for more information.
483169689Skan
484169689Skan@item -imultilib @var{dir}
485169689Skan@opindex imultilib
486169689SkanUse @var{dir} as a subdirectory of the directory containing
487169689Skantarget-specific C++ headers.
488169689Skan
48996263Sobrien@item -isystem @var{dir}
49096263Sobrien@opindex isystem
49196263SobrienSearch @var{dir} for header files, after all directories specified by
49296263Sobrien@option{-I} but before the standard system directories.  Mark it
49396263Sobrienas a system directory, so that it gets the same special treatment as
49496263Sobrienis applied to the standard system directories.
49596263Sobrien@ifset cppmanual
49696263Sobrien@xref{System Headers}.
49796263Sobrien@end ifset
49896263Sobrien
499169689Skan@item -iquote @var{dir}
500169689Skan@opindex iquote
501169689SkanSearch @var{dir} only for header files requested with
502169689Skan@code{@w{#include "@var{file}"}}; they are not searched for
503169689Skan@code{@w{#include <@var{file}>}}, before all directories specified by
504169689Skan@option{-I} and before the standard system directories.
505169689Skan@ifset cppmanual
506169689Skan@xref{Search Path}.
507169689Skan@end ifset
508169689Skan
509132718Skan@item -fdollars-in-identifiers
510132718Skan@opindex fdollars-in-identifiers
511132718Skan@anchor{fdollars-in-identifiers}
512132718SkanAccept @samp{$} in identifiers.
513132718Skan@ifset cppmanual
514132718Skan  @xref{Identifier characters}.
515132718Skan@end ifset
516132718Skan
517169689Skan@item -fextended-identifiers
518169689Skan@opindex fextended-identifiers
519169689SkanAccept universal character names in identifiers.  This option is
520169689Skanexperimental; in a future version of GCC, it will be enabled by
521169689Skandefault for C99 and C++.
522169689Skan
52396263Sobrien@item -fpreprocessed
52496263Sobrien@opindex fpreprocessed
52596263SobrienIndicate to the preprocessor that the input file has already been
52696263Sobrienpreprocessed.  This suppresses things like macro expansion, trigraph
52796263Sobrienconversion, escaped newline splicing, and processing of most directives.
52896263SobrienThe preprocessor still recognizes and removes comments, so that you can
52996263Sobrienpass a file preprocessed with @option{-C} to the compiler without
53096263Sobrienproblems.  In this mode the integrated preprocessor is little more than
53196263Sobriena tokenizer for the front ends.
53296263Sobrien
53396263Sobrien@option{-fpreprocessed} is implicit if the input file has one of the
53496263Sobrienextensions @samp{.i}, @samp{.ii} or @samp{.mi}.  These are the
53596263Sobrienextensions that GCC uses for preprocessed files created by
53696263Sobrien@option{-save-temps}.
53796263Sobrien
53896263Sobrien@item -ftabstop=@var{width}
53996263Sobrien@opindex ftabstop
54096263SobrienSet the distance between tab stops.  This helps the preprocessor report
54196263Sobriencorrect column numbers in warnings or errors, even if tabs appear on the
54296263Sobrienline.  If the value is less than 1 or greater than 100, the option is
54396263Sobrienignored.  The default is 8.
54496263Sobrien
545132718Skan@item -fexec-charset=@var{charset}
546132718Skan@opindex fexec-charset
547169689Skan@cindex character set, execution
548132718SkanSet the execution character set, used for string and character
549132718Skanconstants.  The default is UTF-8.  @var{charset} can be any encoding
550132718Skansupported by the system's @code{iconv} library routine.
551132718Skan
552132718Skan@item -fwide-exec-charset=@var{charset}
553132718Skan@opindex fwide-exec-charset
554169689Skan@cindex character set, wide execution
555132718SkanSet the wide execution character set, used for wide string and
556132718Skancharacter constants.  The default is UTF-32 or UTF-16, whichever
557132718Skancorresponds to the width of @code{wchar_t}.  As with
558169689Skan@option{-fexec-charset}, @var{charset} can be any encoding supported
559132718Skanby the system's @code{iconv} library routine; however, you will have
560132718Skanproblems with encodings that do not fit exactly in @code{wchar_t}.
561132718Skan
562132718Skan@item -finput-charset=@var{charset}
563132718Skan@opindex finput-charset
564169689Skan@cindex character set, input
565132718SkanSet the input character set, used for translation from the character
566169689Skanset of the input file to the source character set used by GCC@.  If the
567132718Skanlocale does not specify, or GCC cannot get this information from the
568169689Skanlocale, the default is UTF-8.  This can be overridden by either the locale
569169689Skanor this command line option.  Currently the command line option takes
570169689Skanprecedence if there's a conflict.  @var{charset} can be any encoding
571132718Skansupported by the system's @code{iconv} library routine.
572132718Skan
573132718Skan@item -fworking-directory
574132718Skan@opindex fworking-directory
575132718Skan@opindex fno-working-directory
576132718SkanEnable generation of linemarkers in the preprocessor output that will
577132718Skanlet the compiler know the current working directory at the time of
578132718Skanpreprocessing.  When this option is enabled, the preprocessor will
579132718Skanemit, after the initial linemarker, a second linemarker with the
580132718Skancurrent working directory followed by two slashes.  GCC will use this
581132718Skandirectory, when it's present in the preprocessed input, as the
582132718Skandirectory emitted as the current working directory in some debugging
583132718Skaninformation formats.  This option is implicitly enabled if debugging
584132718Skaninformation is enabled, but this can be inhibited with the negated
585132718Skanform @option{-fno-working-directory}.  If the @option{-P} flag is
586132718Skanpresent in the command line, this option has no effect, since no
587132718Skan@code{#line} directives are emitted whatsoever.
588132718Skan
58996263Sobrien@item -fno-show-column
59096263Sobrien@opindex fno-show-column
59196263SobrienDo not print column numbers in diagnostics.  This may be necessary if
59296263Sobriendiagnostics are being scanned by a program that does not understand the
59396263Sobriencolumn numbers, such as @command{dejagnu}.
59496263Sobrien
59596263Sobrien@item -A @var{predicate}=@var{answer}
59696263Sobrien@opindex A
59796263SobrienMake an assertion with the predicate @var{predicate} and answer
59896263Sobrien@var{answer}.  This form is preferred to the older form @option{-A
59996263Sobrien@var{predicate}(@var{answer})}, which is still supported, because
60096263Sobrienit does not use shell special characters.
60196263Sobrien@ifset cppmanual
60296263Sobrien@xref{Assertions}.
60396263Sobrien@end ifset
60496263Sobrien
60596263Sobrien@item -A -@var{predicate}=@var{answer}
60696263SobrienCancel an assertion with the predicate @var{predicate} and answer
60796263Sobrien@var{answer}.
60896263Sobrien
60996263Sobrien@item -dCHARS
61096263Sobrien@var{CHARS} is a sequence of one or more of the following characters,
61196263Sobrienand must not be preceded by a space.  Other characters are interpreted
61296263Sobrienby the compiler proper, or reserved for future versions of GCC, and so
61396263Sobrienare silently ignored.  If you specify characters whose behavior
61496263Sobrienconflicts, the result is undefined.
61596263Sobrien
61696263Sobrien@table @samp
61796263Sobrien@item M
61896263Sobrien@opindex dM
61996263SobrienInstead of the normal output, generate a list of @samp{#define}
62096263Sobriendirectives for all the macros defined during the execution of the
62196263Sobrienpreprocessor, including predefined macros.  This gives you a way of
62296263Sobrienfinding out what is predefined in your version of the preprocessor.
62396263SobrienAssuming you have no file @file{foo.h}, the command
62496263Sobrien
625132718Skan@smallexample
62696263Sobrientouch foo.h; cpp -dM foo.h
627132718Skan@end smallexample
62896263Sobrien
62996263Sobrien@noindent
63096263Sobrienwill show all the predefined macros.
63196263Sobrien
63296263Sobrien@item D
63396263Sobrien@opindex dD
63496263SobrienLike @samp{M} except in two respects: it does @emph{not} include the
63596263Sobrienpredefined macros, and it outputs @emph{both} the @samp{#define}
63696263Sobriendirectives and the result of preprocessing.  Both kinds of output go to
63796263Sobrienthe standard output file.
63896263Sobrien
63996263Sobrien@item N
64096263Sobrien@opindex dN
64196263SobrienLike @samp{D}, but emit only the macro names, not their expansions.
64296263Sobrien
64396263Sobrien@item I
64496263Sobrien@opindex dI
64596263SobrienOutput @samp{#include} directives in addition to the result of
64696263Sobrienpreprocessing.
64796263Sobrien@end table
64896263Sobrien
64996263Sobrien@item -P
65096263Sobrien@opindex P
65196263SobrienInhibit generation of linemarkers in the output from the preprocessor.
65296263SobrienThis might be useful when running the preprocessor on something that is
65396263Sobriennot C code, and will be sent to a program which might be confused by the
65496263Sobrienlinemarkers.
65596263Sobrien@ifset cppmanual
65696263Sobrien@xref{Preprocessor Output}.
65796263Sobrien@end ifset
65896263Sobrien
65996263Sobrien@item -C
66096263Sobrien@opindex C
66196263SobrienDo not discard comments.  All comments are passed through to the output
66296263Sobrienfile, except for comments in processed directives, which are deleted
66396263Sobrienalong with the directive.
66496263Sobrien
66596263SobrienYou should be prepared for side effects when using @option{-C}; it
66696263Sobriencauses the preprocessor to treat comments as tokens in their own right.
66796263SobrienFor example, comments appearing at the start of what would be a
66896263Sobriendirective line have the effect of turning that line into an ordinary
66996263Sobriensource line, since the first token on the line is no longer a @samp{#}.
67096263Sobrien
671117395Skan@item -CC
672117395SkanDo not discard comments, including during macro expansion.  This is
673117395Skanlike @option{-C}, except that comments contained within macros are
674117395Skanalso passed through to the output file where the macro is expanded.
675117395Skan
676117395SkanIn addition to the side-effects of the @option{-C} option, the
677117395Skan@option{-CC} option causes all C++-style comments inside a macro
678117395Skanto be converted to C-style comments.  This is to prevent later use
679117395Skanof that macro from inadvertently commenting out the remainder of
680117395Skanthe source line.
681117395Skan
682117395SkanThe @option{-CC} option is generally used to support lint comments.
683117395Skan
684117395Skan@item -traditional-cpp
685117395Skan@opindex traditional-cpp
686117395SkanTry to imitate the behavior of old-fashioned C preprocessors, as
687117395Skanopposed to ISO C preprocessors.
68896263Sobrien@ifset cppmanual
68996263Sobrien@xref{Traditional Mode}.
69096263Sobrien@end ifset
69196263Sobrien
69296263Sobrien@item -trigraphs
69396263Sobrien@opindex trigraphs
69496263SobrienProcess trigraph sequences.
69596263Sobrien@ifset cppmanual
69696263Sobrien@xref{Initial processing}.
69796263Sobrien@end ifset
69896263Sobrien@ifclear cppmanual
69996263SobrienThese are three-character sequences, all starting with @samp{??}, that
70096263Sobrienare defined by ISO C to stand for single characters.  For example,
70196263Sobrien@samp{??/} stands for @samp{\}, so @samp{'??/n'} is a character
70296263Sobrienconstant for a newline.  By default, GCC ignores trigraphs, but in
70396263Sobrienstandard-conforming modes it converts them.  See the @option{-std} and
70496263Sobrien@option{-ansi} options.
70596263Sobrien
70696263SobrienThe nine trigraphs and their replacements are
70796263Sobrien
708103445Skan@smallexample
70996263SobrienTrigraph:       ??(  ??)  ??<  ??>  ??=  ??/  ??'  ??!  ??-
71096263SobrienReplacement:      [    ]    @{    @}    #    \    ^    |    ~
711103445Skan@end smallexample
71296263Sobrien@end ifclear
71396263Sobrien
71496263Sobrien@item -remap
71596263Sobrien@opindex remap
71696263SobrienEnable special code to work around file systems which only permit very
71796263Sobrienshort file names, such as MS-DOS@.
71896263Sobrien
71996263Sobrien@itemx --help
72096263Sobrien@itemx --target-help
72196263Sobrien@opindex help
72296263Sobrien@opindex target-help
72396263SobrienPrint text describing all the command line options instead of
72496263Sobrienpreprocessing anything.
72596263Sobrien
72696263Sobrien@item -v
72796263Sobrien@opindex v
72896263SobrienVerbose mode.  Print out GNU CPP's version number at the beginning of
72996263Sobrienexecution, and report the final form of the include path.
73096263Sobrien
73196263Sobrien@item -H
73296263Sobrien@opindex H
73396263SobrienPrint the name of each header file used, in addition to other normal
73496263Sobrienactivities.  Each name is indented to show how deep in the
735132718Skan@samp{#include} stack it is.  Precompiled header files are also
736132718Skanprinted, even if they are found to be invalid; an invalid precompiled
737132718Skanheader file is printed with @samp{...x} and a valid one with @samp{...!} .
73896263Sobrien
73996263Sobrien@item -version
74096263Sobrien@itemx --version
74196263Sobrien@opindex version
74296263SobrienPrint out GNU CPP's version number.  With one dash, proceed to
74396263Sobrienpreprocess as normal.  With two dashes, exit immediately.
74496263Sobrien@end table
745