]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/cppopts.texi
alias.c (record_set, [...]): Constify.
[thirdparty/gcc.git] / gcc / doc / cppopts.texi
CommitLineData
78392049 1@c Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
40adaa27
NB
2@c Free Software Foundation, Inc.
3@c This is part of the CPP and GCC manuals.
4@c For copying conditions, see the file gcc.texi.
5
6@c ---------------------------------------------------------------------
7@c Options affecting the preprocessor
8@c ---------------------------------------------------------------------
9
10@c If this file is included with the flag ``cppmanual'' set, it is
11@c formatted for inclusion in the CPP manual; otherwise the main GCC manual.
12
13@table @gcctabopt
14@item -D @var{name}
15@opindex D
16Predefine @var{name} as a macro, with definition @code{1}.
17
18@item -D @var{name}=@var{definition}
a09d4744
NB
19The contents of @var{definition} are tokenized and processed as if
20they appeared during translation phase three in a @samp{#define}
21directive. In particular, the definition will be truncated by
22embedded newline characters.
23
24If you are invoking the preprocessor from a shell or shell-like
25program you may need to use the shell's quoting syntax to protect
26characters such as spaces that have a meaning in the shell syntax.
40adaa27
NB
27
28If you wish to define a function-like macro on the command line, write
29its argument list with surrounding parentheses before the equals sign
30(if any). Parentheses are meaningful to most shells, so you will need
31to quote the option. With @command{sh} and @command{csh},
32@option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works.
33
34@option{-D} and @option{-U} options are processed in the order they
35are given on the command line. All @option{-imacros @var{file}} and
36@option{-include @var{file}} options are processed after all
37@option{-D} and @option{-U} options.
38
39@item -U @var{name}
40@opindex U
41Cancel any previous definition of @var{name}, either built in or
42provided with a @option{-D} option.
43
44@item -undef
45@opindex undef
6e270179
NB
46Do not predefine any system-specific or GCC-specific macros. The
47standard predefined macros remain defined.
48@ifset cppmanual
79406520 49@xref{Standard Predefined Macros}.
6e270179 50@end ifset
40adaa27
NB
51
52@item -I @var{dir}
53@opindex I
54Add the directory @var{dir} to the list of directories to be searched
55for header files.
56@ifset cppmanual
57@xref{Search Path}.
58@end ifset
59Directories named by @option{-I} are searched before the standard
48209ce5
JDA
60system include directories. If the directory @var{dir} is a standard
61system include directory, the option is ignored to ensure that the
62default search order for system directories and the special treatment
63of system headers are not defeated
40adaa27
NB
64@ifset cppmanual
65(@pxref{System Headers})
66@end ifset
48209ce5 67.
9a200623
JM
68If @var{dir} begins with @code{=}, then the @code{=} will be replaced
69by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
40adaa27
NB
70
71@item -o @var{file}
72@opindex o
73Write output to @var{file}. This is the same as specifying @var{file}
74as the second non-option argument to @command{cpp}. @command{gcc} has a
75different interpretation of a second non-option argument, so you must
76use @option{-o} to specify the output file.
77
78@item -Wall
79@opindex Wall
a8eb6044
NB
80Turns on all optional warnings which are desirable for normal code.
81At present this is @option{-Wcomment}, @option{-Wtrigraphs},
82@option{-Wmultichar} and a warning about integer promotion causing a
83change of sign in @code{#if} expressions. Note that many of the
84preprocessor's warnings are on by default and have no options to
85control them.
40adaa27
NB
86
87@item -Wcomment
88@itemx -Wcomments
89@opindex Wcomment
90@opindex Wcomments
91Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
92comment, or whenever a backslash-newline appears in a @samp{//} comment.
93(Both forms have the same effect.)
94
95@item -Wtrigraphs
96@opindex Wtrigraphs
a8eb6044 97@anchor{Wtrigraphs}
1fecc266
NB
98Most trigraphs in comments cannot affect the meaning of the program.
99However, a trigraph that would form an escaped newline (@samp{??/} at
100the end of a line) can, by changing where the comment begins or ends.
101Therefore, only trigraphs that would form escaped newlines produce
102warnings inside a comment.
103
104This option is implied by @option{-Wall}. If @option{-Wall} is not
105given, this option is still enabled unless trigraphs are enabled. To
106get trigraph conversion without warnings, but get the other
107@option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
40adaa27
NB
108
109@item -Wtraditional
110@opindex Wtraditional
111Warn about certain constructs that behave differently in traditional and
112ISO C@. Also warn about ISO C constructs that have no traditional C
113equivalent, and problematic constructs which should be avoided.
114@ifset cppmanual
115@xref{Traditional Mode}.
116@end ifset
117
118@item -Wimport
119@opindex Wimport
120Warn the first time @samp{#import} is used.
121
122@item -Wundef
123@opindex Wundef
124Warn whenever an identifier which is not a macro is encountered in an
125@samp{#if} directive, outside of @samp{defined}. Such identifiers are
126replaced with zero.
127
a69cbaac
NB
128@item -Wunused-macros
129@opindex Wunused-macros
130Warn about macros defined in the main file that are unused. A macro
131is @dfn{used} if it is expanded or tested for existence at least once.
132The preprocessor will also warn if the macro has not been used at the
133time it is redefined or undefined.
134
135Built-in macros, macros defined on the command line, and macros
136defined in include files are not warned about.
137
f4559287 138@emph{Note:} If a macro is actually used, but only used in skipped
b41f25cf
NB
139conditional blocks, then CPP will report it as unused. To avoid the
140warning in such a case, you might improve the scope of the macro's
141definition by, for example, moving it into the first skipped block.
142Alternatively, you could provide a dummy use with something like:
143
144@smallexample
145#if defined the_macro_causing_the_warning
146#endif
147@end smallexample
148
909de5da
PE
149@item -Wendif-labels
150@opindex Wendif-labels
151Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
152This usually happens in code of the form
153
154@smallexample
155#if FOO
156@dots{}
157#else FOO
158@dots{}
159#endif FOO
160@end smallexample
161
162@noindent
163The second and third @code{FOO} should be in comments, but often are not
164in older programs. This warning is on by default.
165
40adaa27
NB
166@item -Werror
167@opindex Werror
168Make all warnings into hard errors. Source code which triggers warnings
169will be rejected.
170
171@item -Wsystem-headers
172@opindex Wsystem-headers
173Issue warnings for code in system headers. These are normally unhelpful
174in finding bugs in your own code, therefore suppressed. If you are
175responsible for the system library, you may want to see them.
176
177@item -w
178@opindex w
179Suppress all warnings, including those which GNU CPP issues by default.
180
181@item -pedantic
182@opindex pedantic
183Issue all the mandatory diagnostics listed in the C standard. Some of
184them are left out by default, since they trigger frequently on harmless
185code.
186
187@item -pedantic-errors
188@opindex pedantic-errors
189Issue all the mandatory diagnostics, and make all mandatory diagnostics
190into errors. This includes mandatory diagnostics that GCC issues
191without @samp{-pedantic} but treats as warnings.
192
193@item -M
194@opindex M
195@cindex make
196@cindex dependencies, make
197Instead of outputting the result of preprocessing, output a rule
198suitable for @command{make} describing the dependencies of the main
199source file. The preprocessor outputs one @command{make} rule containing
200the object file name for that source file, a colon, and the names of all
201the included files, including those coming from @option{-include} or
202@option{-imacros} command line options.
203
204Unless specified explicitly (with @option{-MT} or @option{-MQ}), the
78392049
TT
205object file name consists of the name of the source file with any
206suffix replaced with object file suffix and with any leading directory
207parts removed. If there are many included files then the rule is
208split into several lines using @samp{\}-newline. The rule has no
209commands.
40adaa27
NB
210
211This option does not suppress the preprocessor's debug output, such as
212@option{-dM}. To avoid mixing such debug output with the dependency
213rules you should explicitly specify the dependency output file with
214@option{-MF}, or use an environment variable like
caba570b 215@env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}). Debug output
40adaa27
NB
216will still be sent to the regular output stream as normal.
217
49e7b251
NB
218Passing @option{-M} to the driver implies @option{-E}, and suppresses
219warnings with an implicit @option{-w}.
40adaa27
NB
220
221@item -MM
222@opindex MM
223Like @option{-M} but do not mention header files that are found in
224system header directories, nor header files that are included,
225directly or indirectly, from such a header.
226
227This implies that the choice of angle brackets or double quotes in an
228@samp{#include} directive does not in itself determine whether that
229header will appear in @option{-MM} dependency output. This is a
230slight change in semantics from GCC versions 3.0 and earlier.
231
5560a945 232@anchor{dashMF}
40adaa27
NB
233@item -MF @var{file}
234@opindex MF
40adaa27
NB
235When used with @option{-M} or @option{-MM}, specifies a
236file to write the dependencies to. If no @option{-MF} switch is given
237the preprocessor sends the rules to the same place it would have sent
238preprocessed output.
239
240When used with the driver options @option{-MD} or @option{-MMD},
241@option{-MF} overrides the default dependency output file.
242
243@item -MG
244@opindex MG
3f8ffc7c
RS
245In conjunction with an option such as @option{-M} requesting
246dependency generation, @option{-MG} assumes missing header files are
247generated files and adds them to the dependency list without raising
248an error. The dependency filename is taken directly from the
249@code{#include} directive without prepending any path. @option{-MG}
250also suppresses preprocessed output, as a missing header file renders
251this useless.
40adaa27
NB
252
253This feature is used in automatic updating of makefiles.
254
255@item -MP
256@opindex MP
257This option instructs CPP to add a phony target for each dependency
258other than the main file, causing each to depend on nothing. These
259dummy rules work around errors @command{make} gives if you remove header
260files without updating the @file{Makefile} to match.
261
262This is typical output:
263
3ab51846 264@smallexample
40adaa27
NB
265test.o: test.c test.h
266
267test.h:
3ab51846 268@end smallexample
40adaa27
NB
269
270@item -MT @var{target}
271@opindex MT
272
273Change the target of the rule emitted by dependency generation. By
78392049
TT
274default CPP takes the name of the main input file, deletes any
275directory components and any file suffix such as @samp{.c}, and
276appends the platform's usual object suffix. The result is the target.
40adaa27
NB
277
278An @option{-MT} option will set the target to be exactly the string you
279specify. If you want multiple targets, you can specify them as a single
280argument to @option{-MT}, or use multiple @option{-MT} options.
281
282For example, @option{@w{-MT '$(objpfx)foo.o'}} might give
283
3ab51846 284@smallexample
40adaa27 285$(objpfx)foo.o: foo.c
3ab51846 286@end smallexample
40adaa27
NB
287
288@item -MQ @var{target}
289@opindex MQ
290
291Same as @option{-MT}, but it quotes any characters which are special to
292Make. @option{@w{-MQ '$(objpfx)foo.o'}} gives
293
3ab51846 294@smallexample
40adaa27 295$$(objpfx)foo.o: foo.c
3ab51846 296@end smallexample
40adaa27
NB
297
298The default target is automatically quoted, as if it were given with
299@option{-MQ}.
300
301@item -MD
302@opindex MD
303@option{-MD} is equivalent to @option{-M -MF @var{file}}, except that
304@option{-E} is not implied. The driver determines @var{file} based on
305whether an @option{-o} option is given. If it is, the driver uses its
78392049
TT
306argument but with a suffix of @file{.d}, otherwise it takes the name
307of the input file, removes any directory components and suffix, and
308applies a @file{.d} suffix.
40adaa27
NB
309
310If @option{-MD} is used in conjunction with @option{-E}, any
311@option{-o} switch is understood to specify the dependency output file
e8c96d09 312(@pxref{dashMF,,-MF}), but if used without @option{-E}, each @option{-o}
40adaa27
NB
313is understood to specify a target object file.
314
315Since @option{-E} is not implied, @option{-MD} can be used to generate
316a dependency output file as a side-effect of the compilation process.
317
318@item -MMD
319@opindex MMD
320Like @option{-MD} except mention only user header files, not system
78466c0e 321header files.
40adaa27 322
17211ab5
GK
323@ifclear cppmanual
324@item -fpch-deps
325@opindex fpch-deps
326When using precompiled headers (@pxref{Precompiled Headers}), this flag
327will cause the dependency-output flags to also list the files from the
328precompiled header's dependencies. If not specified only the
329precompiled header would be listed and not the files that were used to
330create it because those files are not consulted when a precompiled
331header is used.
332
c0d578e6
GK
333@item -fpch-preprocess
334@opindex fpch-preprocess
335This option allows use of a precompiled header (@pxref{Precompiled
336Headers}) together with @option{-E}. It inserts a special @code{#pragma},
337@code{#pragma GCC pch_preprocess "<filename>"} in the output to mark
338the place where the precompiled header was found, and its filename. When
4ec7afd7 339@option{-fpreprocessed} is in use, GCC recognizes this @code{#pragma} and
8a36672b 340loads the PCH@.
c0d578e6
GK
341
342This option is off by default, because the resulting preprocessed output
8a36672b 343is only really suitable as input to GCC@. It is switched on by
c0d578e6
GK
344@option{-save-temps}.
345
346You should not write this @code{#pragma} in your own code, but it is
347safe to edit the filename if the PCH file is available in a different
348location. The filename may be absolute or it may be relative to GCC's
349current directory.
350
17211ab5 351@end ifclear
40adaa27
NB
352@item -x c
353@itemx -x c++
354@itemx -x objective-c
355@itemx -x assembler-with-cpp
356@opindex x
357Specify the source language: C, C++, Objective-C, or assembly. This has
358nothing to do with standards conformance or extensions; it merely
359selects which base syntax to expect. If you give none of these options,
360cpp will deduce the language from the extension of the source file:
361@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}. Some other common
362extensions for C++ and assembly are also recognized. If cpp does not
363recognize the extension, it will treat the file as C; this is the most
364generic mode.
365
f4559287 366@emph{Note:} Previous versions of cpp accepted a @option{-lang} option
40adaa27
NB
367which selected both the language and the standards conformance level.
368This option has been removed, because it conflicts with the @option{-l}
369option.
370
371@item -std=@var{standard}
372@itemx -ansi
373@opindex ansi
374@opindex std=
f749a36b
NB
375Specify the standard to which the code should conform. Currently CPP
376knows about C and C++ standards; others may be added in the future.
40adaa27
NB
377
378@var{standard}
379may be one of:
380@table @code
381@item iso9899:1990
382@itemx c89
383The ISO C standard from 1990. @samp{c89} is the customary shorthand for
384this version of the standard.
385
386The @option{-ansi} option is equivalent to @option{-std=c89}.
387
388@item iso9899:199409
389The 1990 C standard, as amended in 1994.
390
391@item iso9899:1999
392@itemx c99
393@itemx iso9899:199x
394@itemx c9x
395The revised ISO C standard, published in December 1999. Before
396publication, this was known as C9X@.
397
398@item gnu89
399The 1990 C standard plus GNU extensions. This is the default.
400
401@item gnu99
402@itemx gnu9x
403The 1999 C standard plus GNU extensions.
f749a36b
NB
404
405@item c++98
406The 1998 ISO C++ standard plus amendments.
407
408@item gnu++98
409The same as @option{-std=c++98} plus GNU extensions. This is the
410default for C++ code.
40adaa27
NB
411@end table
412
413@item -I-
414@opindex I-
415Split the include path. Any directories specified with @option{-I}
416options before @option{-I-} are searched only for headers requested with
417@code{@w{#include "@var{file}"}}; they are not searched for
418@code{@w{#include <@var{file}>}}. If additional directories are
419specified with @option{-I} options after the @option{-I-}, those
420directories are searched for all @samp{#include} directives.
421
422In addition, @option{-I-} inhibits the use of the directory of the current
423file directory as the first search directory for @code{@w{#include
424"@var{file}"}}.
425@ifset cppmanual
426@xref{Search Path}.
427@end ifset
4bed3787 428This option has been deprecated.
40adaa27
NB
429
430@item -nostdinc
431@opindex nostdinc
432Do not search the standard system directories for header files.
433Only the directories you have specified with @option{-I} options
434(and the directory of the current file, if appropriate) are searched.
435
436@item -nostdinc++
437@opindex nostdinc++
438Do not search for header files in the C++-specific standard directories,
439but do still search the other standard directories. (This option is
440used when building the C++ library.)
441
442@item -include @var{file}
443@opindex include
444Process @var{file} as if @code{#include "file"} appeared as the first
445line of the primary source file. However, the first directory searched
446for @var{file} is the preprocessor's working directory @emph{instead of}
447the directory containing the main source file. If not found there, it
448is searched for in the remainder of the @code{#include "@dots{}"} search
449chain as normal.
450
451If multiple @option{-include} options are given, the files are included
452in the order they appear on the command line.
453
454@item -imacros @var{file}
455@opindex imacros
456Exactly like @option{-include}, except that any output produced by
457scanning @var{file} is thrown away. Macros it defines remain defined.
458This allows you to acquire all the macros from a header without also
459processing its declarations.
460
461All files specified by @option{-imacros} are processed before all files
462specified by @option{-include}.
463
464@item -idirafter @var{dir}
465@opindex idirafter
466Search @var{dir} for header files, but do it @emph{after} all
467directories specified with @option{-I} and the standard system directories
468have been exhausted. @var{dir} is treated as a system include directory.
9a200623
JM
469If @var{dir} begins with @code{=}, then the @code{=} will be replaced
470by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
40adaa27
NB
471
472@item -iprefix @var{prefix}
473@opindex iprefix
474Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
475options. If the prefix represents a directory, you should include the
476final @samp{/}.
477
478@item -iwithprefix @var{dir}
479@itemx -iwithprefixbefore @var{dir}
480@opindex iwithprefix
481@opindex iwithprefixbefore
482Append @var{dir} to the prefix specified previously with
483@option{-iprefix}, and add the resulting directory to the include search
484path. @option{-iwithprefixbefore} puts it in the same place @option{-I}
485would; @option{-iwithprefix} puts it where @option{-idirafter} would.
486
160633c6
MM
487@item -isysroot @var{dir}
488@opindex isysroot
489This option is like the @option{--sysroot} option, but applies only to
490header files. See the @option{--sysroot} option for more information.
491
2b6dd222
JM
492@item -imultilib @var{dir}
493@opindex imultilib
494Use @var{dir} as a subdirectory of the directory containing
495target-specific C++ headers.
496
40adaa27
NB
497@item -isystem @var{dir}
498@opindex isystem
499Search @var{dir} for header files, after all directories specified by
500@option{-I} but before the standard system directories. Mark it
501as a system directory, so that it gets the same special treatment as
502is applied to the standard system directories.
503@ifset cppmanual
504@xref{System Headers}.
505@end ifset
9a200623
JM
506If @var{dir} begins with @code{=}, then the @code{=} will be replaced
507by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
40adaa27 508
4bed3787
MS
509@item -iquote @var{dir}
510@opindex iquote
511Search @var{dir} only for header files requested with
512@code{@w{#include "@var{file}"}}; they are not searched for
513@code{@w{#include <@var{file}>}}, before all directories specified by
514@option{-I} and before the standard system directories.
515@ifset cppmanual
516@xref{Search Path}.
517@end ifset
9a200623
JM
518If @var{dir} begins with @code{=}, then the @code{=} will be replaced
519by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
4bed3787 520
b1822ccc
NB
521@item -fdollars-in-identifiers
522@opindex fdollars-in-identifiers
523@anchor{fdollars-in-identifiers}
524Accept @samp{$} in identifiers.
525@ifset cppmanual
526 @xref{Identifier characters}.
527@end ifset
528
af15a2fe
JM
529@item -fextended-identifiers
530@opindex fextended-identifiers
531Accept universal character names in identifiers. This option is
532experimental; in a future version of GCC, it will be enabled by
533default for C99 and C++.
534
40adaa27
NB
535@item -fpreprocessed
536@opindex fpreprocessed
537Indicate to the preprocessor that the input file has already been
538preprocessed. This suppresses things like macro expansion, trigraph
539conversion, escaped newline splicing, and processing of most directives.
540The preprocessor still recognizes and removes comments, so that you can
541pass a file preprocessed with @option{-C} to the compiler without
542problems. In this mode the integrated preprocessor is little more than
543a tokenizer for the front ends.
544
545@option{-fpreprocessed} is implicit if the input file has one of the
546extensions @samp{.i}, @samp{.ii} or @samp{.mi}. These are the
547extensions that GCC uses for preprocessed files created by
548@option{-save-temps}.
549
550@item -ftabstop=@var{width}
551@opindex ftabstop
552Set the distance between tab stops. This helps the preprocessor report
553correct column numbers in warnings or errors, even if tabs appear on the
554line. If the value is less than 1 or greater than 100, the option is
555ignored. The default is 8.
556
e6cc3a24
ZW
557@item -fexec-charset=@var{charset}
558@opindex fexec-charset
50668cf6 559@cindex character set, execution
e6cc3a24
ZW
560Set the execution character set, used for string and character
561constants. The default is UTF-8. @var{charset} can be any encoding
562supported by the system's @code{iconv} library routine.
563
564@item -fwide-exec-charset=@var{charset}
565@opindex fwide-exec-charset
50668cf6 566@cindex character set, wide execution
e6cc3a24
ZW
567Set the wide execution character set, used for wide string and
568character constants. The default is UTF-32 or UTF-16, whichever
569corresponds to the width of @code{wchar_t}. As with
bc4c01b7 570@option{-fexec-charset}, @var{charset} can be any encoding supported
e6cc3a24
ZW
571by the system's @code{iconv} library routine; however, you will have
572problems with encodings that do not fit exactly in @code{wchar_t}.
573
16dd5cfe
EC
574@item -finput-charset=@var{charset}
575@opindex finput-charset
50668cf6 576@cindex character set, input
16dd5cfe 577Set the input character set, used for translation from the character
8a36672b 578set of the input file to the source character set used by GCC@. If the
16dd5cfe 579locale does not specify, or GCC cannot get this information from the
8a36672b
JM
580locale, the default is UTF-8. This can be overridden by either the locale
581or this command line option. Currently the command line option takes
582precedence if there's a conflict. @var{charset} can be any encoding
16dd5cfe
EC
583supported by the system's @code{iconv} library routine.
584
b20d9f0c
AO
585@item -fworking-directory
586@opindex fworking-directory
587@opindex fno-working-directory
588Enable generation of linemarkers in the preprocessor output that will
589let the compiler know the current working directory at the time of
590preprocessing. When this option is enabled, the preprocessor will
591emit, after the initial linemarker, a second linemarker with the
592current working directory followed by two slashes. GCC will use this
593directory, when it's present in the preprocessed input, as the
594directory emitted as the current working directory in some debugging
595information formats. This option is implicitly enabled if debugging
596information is enabled, but this can be inhibited with the negated
597form @option{-fno-working-directory}. If the @option{-P} flag is
598present in the command line, this option has no effect, since no
599@code{#line} directives are emitted whatsoever.
600
40adaa27
NB
601@item -fno-show-column
602@opindex fno-show-column
603Do not print column numbers in diagnostics. This may be necessary if
604diagnostics are being scanned by a program that does not understand the
605column numbers, such as @command{dejagnu}.
606
607@item -A @var{predicate}=@var{answer}
608@opindex A
609Make an assertion with the predicate @var{predicate} and answer
610@var{answer}. This form is preferred to the older form @option{-A
611@var{predicate}(@var{answer})}, which is still supported, because
612it does not use shell special characters.
613@ifset cppmanual
614@xref{Assertions}.
615@end ifset
616
617@item -A -@var{predicate}=@var{answer}
618Cancel an assertion with the predicate @var{predicate} and answer
619@var{answer}.
620
40adaa27
NB
621@item -dCHARS
622@var{CHARS} is a sequence of one or more of the following characters,
623and must not be preceded by a space. Other characters are interpreted
624by the compiler proper, or reserved for future versions of GCC, and so
625are silently ignored. If you specify characters whose behavior
626conflicts, the result is undefined.
627
628@table @samp
629@item M
630@opindex dM
631Instead of the normal output, generate a list of @samp{#define}
632directives for all the macros defined during the execution of the
633preprocessor, including predefined macros. This gives you a way of
634finding out what is predefined in your version of the preprocessor.
635Assuming you have no file @file{foo.h}, the command
636
3ab51846 637@smallexample
40adaa27 638touch foo.h; cpp -dM foo.h
3ab51846 639@end smallexample
40adaa27
NB
640
641@noindent
642will show all the predefined macros.
643
717c4e47
EC
644If you use @option{-dM} without the @option{-E} option, @option{-dM} is
645interpreted as a synonym for @option{-fdump-rtl-mach}.
646@xref{Debugging Options, , ,gcc}.
647
40adaa27
NB
648@item D
649@opindex dD
650Like @samp{M} except in two respects: it does @emph{not} include the
651predefined macros, and it outputs @emph{both} the @samp{#define}
652directives and the result of preprocessing. Both kinds of output go to
653the standard output file.
654
655@item N
656@opindex dN
657Like @samp{D}, but emit only the macro names, not their expansions.
658
659@item I
660@opindex dI
661Output @samp{#include} directives in addition to the result of
662preprocessing.
663@end table
664
665@item -P
666@opindex P
667Inhibit generation of linemarkers in the output from the preprocessor.
668This might be useful when running the preprocessor on something that is
669not C code, and will be sent to a program which might be confused by the
670linemarkers.
671@ifset cppmanual
672@xref{Preprocessor Output}.
673@end ifset
674
675@item -C
676@opindex C
677Do not discard comments. All comments are passed through to the output
678file, except for comments in processed directives, which are deleted
679along with the directive.
680
681You should be prepared for side effects when using @option{-C}; it
682causes the preprocessor to treat comments as tokens in their own right.
683For example, comments appearing at the start of what would be a
684directive line have the effect of turning that line into an ordinary
685source line, since the first token on the line is no longer a @samp{#}.
686
477cdac7
JT
687@item -CC
688Do not discard comments, including during macro expansion. This is
689like @option{-C}, except that comments contained within macros are
690also passed through to the output file where the macro is expanded.
691
692In addition to the side-effects of the @option{-C} option, the
693@option{-CC} option causes all C++-style comments inside a macro
694to be converted to C-style comments. This is to prevent later use
9a376494 695of that macro from inadvertently commenting out the remainder of
477cdac7
JT
696the source line.
697
698The @option{-CC} option is generally used to support lint comments.
699
b6fb43ab
NB
700@item -traditional-cpp
701@opindex traditional-cpp
702Try to imitate the behavior of old-fashioned C preprocessors, as
703opposed to ISO C preprocessors.
40adaa27
NB
704@ifset cppmanual
705@xref{Traditional Mode}.
706@end ifset
707
708@item -trigraphs
709@opindex trigraphs
710Process trigraph sequences.
711@ifset cppmanual
712@xref{Initial processing}.
713@end ifset
714@ifclear cppmanual
715These are three-character sequences, all starting with @samp{??}, that
716are defined by ISO C to stand for single characters. For example,
717@samp{??/} stands for @samp{\}, so @samp{'??/n'} is a character
718constant for a newline. By default, GCC ignores trigraphs, but in
719standard-conforming modes it converts them. See the @option{-std} and
720@option{-ansi} options.
721
722The nine trigraphs and their replacements are
723
478c9e72 724@smallexample
40adaa27
NB
725Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
726Replacement: [ ] @{ @} # \ ^ | ~
478c9e72 727@end smallexample
40adaa27
NB
728@end ifclear
729
730@item -remap
731@opindex remap
732Enable special code to work around file systems which only permit very
733short file names, such as MS-DOS@.
734
40adaa27
NB
735@itemx --help
736@itemx --target-help
40adaa27
NB
737@opindex help
738@opindex target-help
739Print text describing all the command line options instead of
740preprocessing anything.
741
742@item -v
743@opindex v
744Verbose mode. Print out GNU CPP's version number at the beginning of
745execution, and report the final form of the include path.
746
747@item -H
748@opindex H
749Print the name of each header file used, in addition to other normal
750activities. Each name is indented to show how deep in the
79406520
GK
751@samp{#include} stack it is. Precompiled header files are also
752printed, even if they are found to be invalid; an invalid precompiled
753header file is printed with @samp{...x} and a valid one with @samp{...!} .
40adaa27
NB
754
755@item -version
756@itemx --version
757@opindex version
758Print out GNU CPP's version number. With one dash, proceed to
759preprocess as normal. With two dashes, exit immediately.
760@end table