Merge branch 'vendor/GCC44'
[dragonfly.git] / contrib / gcc-4.4 / gcc / doc / cpp.1
CommitLineData
4b1e227d 1.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
c251ad9e
SS
2.\"
3.\" Standard preamble:
4.\" ========================================================================
c251ad9e
SS
5.de Sp \" Vertical space (when we can't use .PP)
6.if t .sp .5v
7.if n .sp
8..
9.de Vb \" Begin verbatim text
10.ft CW
11.nf
12.ne \\$1
13..
14.de Ve \" End verbatim text
15.ft R
16.fi
17..
18.\" Set up some character translations and predefined strings. \*(-- will
19.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20.\" double quote, and \*(R" will give a right double quote. \*(C+ will
21.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
22.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
23.\" nothing in troff, for use with C<>.
24.tr \(*W-
25.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26.ie n \{\
27. ds -- \(*W-
28. ds PI pi
29. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
31. ds L" ""
32. ds R" ""
33. ds C` ""
34. ds C' ""
35'br\}
36.el\{\
37. ds -- \|\(em\|
38. ds PI \(*p
39. ds L" ``
40. ds R" ''
41'br\}
42.\"
43.\" Escape single quotes in literal strings from groff's Unicode transform.
44.ie \n(.g .ds Aq \(aq
45.el .ds Aq '
46.\"
47.\" If the F register is turned on, we'll generate index entries on stderr for
4b1e227d 48.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
c251ad9e
SS
49.\" entries marked with X<> in POD. Of course, you'll have to process the
50.\" output yourself in some meaningful fashion.
51.ie \nF \{\
52. de IX
53. tm Index:\\$1\t\\n%\t"\\$2"
54..
55. nr % 0
56. rr F
57.\}
58.el \{\
59. de IX
60..
61.\}
62.\"
63.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64.\" Fear. Run. Save yourself. No user-serviceable parts.
65. \" fudge factors for nroff and troff
66.if n \{\
67. ds #H 0
68. ds #V .8m
69. ds #F .3m
70. ds #[ \f1
71. ds #] \fP
72.\}
73.if t \{\
74. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75. ds #V .6m
76. ds #F 0
77. ds #[ \&
78. ds #] \&
79.\}
80. \" simple accents for nroff and troff
81.if n \{\
82. ds ' \&
83. ds ` \&
84. ds ^ \&
85. ds , \&
86. ds ~ ~
87. ds /
88.\}
89.if t \{\
90. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96.\}
97. \" troff and (daisy-wheel) nroff accents
98.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105.ds ae a\h'-(\w'a'u*4/10)'e
106.ds Ae A\h'-(\w'A'u*4/10)'E
107. \" corrections for vroff
108.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110. \" for low resolution devices (crt and lpr)
111.if \n(.H>23 .if \n(.V>19 \
112\{\
113. ds : e
114. ds 8 ss
115. ds o a
116. ds d- d\h'-1'\(ga
117. ds D- D\h'-1'\(hy
118. ds th \o'bp'
119. ds Th \o'LP'
120. ds ae ae
121. ds Ae AE
122.\}
123.rm #[ #] #H #V #F C
124.\" ========================================================================
125.\"
126.IX Title "CPP 1"
4b1e227d 127.TH CPP 1 "2010-10-01" "gcc-4.4.5" "GNU"
c251ad9e
SS
128.\" For nroff, turn off justification. Always turn off hyphenation; it makes
129.\" way too many mistakes in technical documents.
130.if n .ad l
131.nh
132.SH "NAME"
133cpp \- The C Preprocessor
134.SH "SYNOPSIS"
135.IX Header "SYNOPSIS"
136cpp [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR]
137 [\fB\-I\fR\fIdir\fR...] [\fB\-iquote\fR\fIdir\fR...]
138 [\fB\-W\fR\fIwarn\fR...]
139 [\fB\-M\fR|\fB\-MM\fR] [\fB\-MG\fR] [\fB\-MF\fR \fIfilename\fR]
140 [\fB\-MP\fR] [\fB\-MQ\fR \fItarget\fR...]
141 [\fB\-MT\fR \fItarget\fR...]
142 [\fB\-P\fR] [\fB\-fno\-working\-directory\fR]
143 [\fB\-x\fR \fIlanguage\fR] [\fB\-std=\fR\fIstandard\fR]
144 \fIinfile\fR \fIoutfile\fR
145.PP
146Only the most useful options are listed here; see below for the remainder.
147.SH "DESCRIPTION"
148.IX Header "DESCRIPTION"
149The C preprocessor, often known as \fIcpp\fR, is a \fImacro processor\fR
150that is used automatically by the C compiler to transform your program
151before compilation. It is called a macro processor because it allows
152you to define \fImacros\fR, which are brief abbreviations for longer
153constructs.
154.PP
155The C preprocessor is intended to be used only with C, \*(C+, and
156Objective-C source code. In the past, it has been abused as a general
157text processor. It will choke on input which does not obey C's lexical
158rules. For example, apostrophes will be interpreted as the beginning of
159character constants, and cause errors. Also, you cannot rely on it
160preserving characteristics of the input which are not significant to
161C\-family languages. If a Makefile is preprocessed, all the hard tabs
162will be removed, and the Makefile will not work.
163.PP
164Having said that, you can often get away with using cpp on things which
165are not C. Other Algol-ish programming languages are often safe
166(Pascal, Ada, etc.) So is assembly, with caution. \fB\-traditional\-cpp\fR
167mode preserves more white space, and is otherwise more permissive. Many
168of the problems can be avoided by writing C or \*(C+ style comments
169instead of native language comments, and keeping macros simple.
170.PP
171Wherever possible, you should use a preprocessor geared to the language
172you are writing in. Modern versions of the \s-1GNU\s0 assembler have macro
173facilities. Most high level programming languages have their own
174conditional compilation and inclusion mechanism. If all else fails,
175try a true general text processor, such as \s-1GNU\s0 M4.
176.PP
177C preprocessors vary in some details. This manual discusses the \s-1GNU\s0 C
178preprocessor, which provides a small superset of the features of \s-1ISO\s0
179Standard C. In its default mode, the \s-1GNU\s0 C preprocessor does not do a
180few things required by the standard. These are features which are
181rarely, if ever, used, and may cause surprising changes to the meaning
182of a program which does not expect them. To get strict \s-1ISO\s0 Standard C,
183you should use the \fB\-std=c89\fR or \fB\-std=c99\fR options, depending
184on which version of the standard you want. To get all the mandatory
185diagnostics, you must also use \fB\-pedantic\fR.
186.PP
187This manual describes the behavior of the \s-1ISO\s0 preprocessor. To
188minimize gratuitous differences, where the \s-1ISO\s0 preprocessor's
189behavior does not conflict with traditional semantics, the
190traditional preprocessor should behave the same way. The various
191differences that do exist are detailed in the section \fBTraditional
192Mode\fR.
193.PP
194For clarity, unless noted otherwise, references to \fB\s-1CPP\s0\fR in this
195manual refer to \s-1GNU\s0 \s-1CPP\s0.
196.SH "OPTIONS"
197.IX Header "OPTIONS"
198The C preprocessor expects two file names as arguments, \fIinfile\fR and
199\&\fIoutfile\fR. The preprocessor reads \fIinfile\fR together with any
200other files it specifies with \fB#include\fR. All the output generated
201by the combined input files is written in \fIoutfile\fR.
202.PP
203Either \fIinfile\fR or \fIoutfile\fR may be \fB\-\fR, which as
204\&\fIinfile\fR means to read from standard input and as \fIoutfile\fR
205means to write to standard output. Also, if either file is omitted, it
206means the same as if \fB\-\fR had been specified for that file.
207.PP
208Unless otherwise noted, or the option ends in \fB=\fR, all options
209which take an argument may have that argument appear either immediately
210after the option, or with a space between option and argument:
211\&\fB\-Ifoo\fR and \fB\-I foo\fR have the same effect.
212.PP
213Many options have multi-letter names; therefore multiple single-letter
214options may \fInot\fR be grouped: \fB\-dM\fR is very different from
215\&\fB\-d\ \-M\fR.
216.IP "\fB\-D\fR \fIname\fR" 4
217.IX Item "-D name"
218Predefine \fIname\fR as a macro, with definition \f(CW1\fR.
219.IP "\fB\-D\fR \fIname\fR\fB=\fR\fIdefinition\fR" 4
220.IX Item "-D name=definition"
221The contents of \fIdefinition\fR are tokenized and processed as if
222they appeared during translation phase three in a \fB#define\fR
223directive. In particular, the definition will be truncated by
224embedded newline characters.
225.Sp
226If you are invoking the preprocessor from a shell or shell-like
227program you may need to use the shell's quoting syntax to protect
228characters such as spaces that have a meaning in the shell syntax.
229.Sp
230If you wish to define a function-like macro on the command line, write
231its argument list with surrounding parentheses before the equals sign
232(if any). Parentheses are meaningful to most shells, so you will need
233to quote the option. With \fBsh\fR and \fBcsh\fR,
234\&\fB\-D'\fR\fIname\fR\fB(\fR\fIargs...\fR\fB)=\fR\fIdefinition\fR\fB'\fR works.
235.Sp
236\&\fB\-D\fR and \fB\-U\fR options are processed in the order they
237are given on the command line. All \fB\-imacros\fR \fIfile\fR and
238\&\fB\-include\fR \fIfile\fR options are processed after all
239\&\fB\-D\fR and \fB\-U\fR options.
240.IP "\fB\-U\fR \fIname\fR" 4
241.IX Item "-U name"
242Cancel any previous definition of \fIname\fR, either built in or
243provided with a \fB\-D\fR option.
244.IP "\fB\-undef\fR" 4
245.IX Item "-undef"
246Do not predefine any system-specific or GCC-specific macros. The
247standard predefined macros remain defined.
248.IP "\fB\-I\fR \fIdir\fR" 4
249.IX Item "-I dir"
250Add the directory \fIdir\fR to the list of directories to be searched
251for header files.
252.Sp
253Directories named by \fB\-I\fR are searched before the standard
254system include directories. If the directory \fIdir\fR is a standard
255system include directory, the option is ignored to ensure that the
256default search order for system directories and the special treatment
257of system headers are not defeated
258\&.
259If \fIdir\fR begins with \f(CW\*(C`=\*(C'\fR, then the \f(CW\*(C`=\*(C'\fR will be replaced
260by the sysroot prefix; see \fB\-\-sysroot\fR and \fB\-isysroot\fR.
261.IP "\fB\-o\fR \fIfile\fR" 4
262.IX Item "-o file"
263Write output to \fIfile\fR. This is the same as specifying \fIfile\fR
264as the second non-option argument to \fBcpp\fR. \fBgcc\fR has a
265different interpretation of a second non-option argument, so you must
266use \fB\-o\fR to specify the output file.
267.IP "\fB\-Wall\fR" 4
268.IX Item "-Wall"
269Turns on all optional warnings which are desirable for normal code.
270At present this is \fB\-Wcomment\fR, \fB\-Wtrigraphs\fR,
271\&\fB\-Wmultichar\fR and a warning about integer promotion causing a
272change of sign in \f(CW\*(C`#if\*(C'\fR expressions. Note that many of the
273preprocessor's warnings are on by default and have no options to
274control them.
275.IP "\fB\-Wcomment\fR" 4
276.IX Item "-Wcomment"
277.PD 0
278.IP "\fB\-Wcomments\fR" 4
279.IX Item "-Wcomments"
280.PD
281Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR
282comment, or whenever a backslash-newline appears in a \fB//\fR comment.
283(Both forms have the same effect.)
284.IP "\fB\-Wtrigraphs\fR" 4
285.IX Item "-Wtrigraphs"
286Most trigraphs in comments cannot affect the meaning of the program.
287However, a trigraph that would form an escaped newline (\fB??/\fR at
288the end of a line) can, by changing where the comment begins or ends.
289Therefore, only trigraphs that would form escaped newlines produce
290warnings inside a comment.
291.Sp
292This option is implied by \fB\-Wall\fR. If \fB\-Wall\fR is not
293given, this option is still enabled unless trigraphs are enabled. To
294get trigraph conversion without warnings, but get the other
295\&\fB\-Wall\fR warnings, use \fB\-trigraphs \-Wall \-Wno\-trigraphs\fR.
296.IP "\fB\-Wtraditional\fR" 4
297.IX Item "-Wtraditional"
298Warn about certain constructs that behave differently in traditional and
299\&\s-1ISO\s0 C. Also warn about \s-1ISO\s0 C constructs that have no traditional C
300equivalent, and problematic constructs which should be avoided.
301.IP "\fB\-Wundef\fR" 4
302.IX Item "-Wundef"
303Warn whenever an identifier which is not a macro is encountered in an
304\&\fB#if\fR directive, outside of \fBdefined\fR. Such identifiers are
305replaced with zero.
306.IP "\fB\-Wunused\-macros\fR" 4
307.IX Item "-Wunused-macros"
308Warn about macros defined in the main file that are unused. A macro
309is \fIused\fR if it is expanded or tested for existence at least once.
310The preprocessor will also warn if the macro has not been used at the
311time it is redefined or undefined.
312.Sp
313Built-in macros, macros defined on the command line, and macros
314defined in include files are not warned about.
315.Sp
316\&\fINote:\fR If a macro is actually used, but only used in skipped
317conditional blocks, then \s-1CPP\s0 will report it as unused. To avoid the
318warning in such a case, you might improve the scope of the macro's
319definition by, for example, moving it into the first skipped block.
320Alternatively, you could provide a dummy use with something like:
321.Sp
322.Vb 2
323\& #if defined the_macro_causing_the_warning
324\& #endif
325.Ve
326.IP "\fB\-Wendif\-labels\fR" 4
327.IX Item "-Wendif-labels"
328Warn whenever an \fB#else\fR or an \fB#endif\fR are followed by text.
329This usually happens in code of the form
330.Sp
331.Vb 5
332\& #if FOO
333\& ...
334\& #else FOO
335\& ...
336\& #endif FOO
337.Ve
338.Sp
339The second and third \f(CW\*(C`FOO\*(C'\fR should be in comments, but often are not
340in older programs. This warning is on by default.
341.IP "\fB\-Werror\fR" 4
342.IX Item "-Werror"
343Make all warnings into hard errors. Source code which triggers warnings
344will be rejected.
345.IP "\fB\-Wsystem\-headers\fR" 4
346.IX Item "-Wsystem-headers"
347Issue warnings for code in system headers. These are normally unhelpful
348in finding bugs in your own code, therefore suppressed. If you are
349responsible for the system library, you may want to see them.
350.IP "\fB\-w\fR" 4
351.IX Item "-w"
352Suppress all warnings, including those which \s-1GNU\s0 \s-1CPP\s0 issues by default.
353.IP "\fB\-pedantic\fR" 4
354.IX Item "-pedantic"
355Issue all the mandatory diagnostics listed in the C standard. Some of
356them are left out by default, since they trigger frequently on harmless
357code.
358.IP "\fB\-pedantic\-errors\fR" 4
359.IX Item "-pedantic-errors"
360Issue all the mandatory diagnostics, and make all mandatory diagnostics
361into errors. This includes mandatory diagnostics that \s-1GCC\s0 issues
362without \fB\-pedantic\fR but treats as warnings.
363.IP "\fB\-M\fR" 4
364.IX Item "-M"
365Instead of outputting the result of preprocessing, output a rule
366suitable for \fBmake\fR describing the dependencies of the main
367source file. The preprocessor outputs one \fBmake\fR rule containing
368the object file name for that source file, a colon, and the names of all
369the included files, including those coming from \fB\-include\fR or
370\&\fB\-imacros\fR command line options.
371.Sp
372Unless specified explicitly (with \fB\-MT\fR or \fB\-MQ\fR), the
373object file name consists of the name of the source file with any
374suffix replaced with object file suffix and with any leading directory
375parts removed. If there are many included files then the rule is
376split into several lines using \fB\e\fR\-newline. The rule has no
377commands.
378.Sp
379This option does not suppress the preprocessor's debug output, such as
380\&\fB\-dM\fR. To avoid mixing such debug output with the dependency
381rules you should explicitly specify the dependency output file with
382\&\fB\-MF\fR, or use an environment variable like
383\&\fB\s-1DEPENDENCIES_OUTPUT\s0\fR. Debug output
384will still be sent to the regular output stream as normal.
385.Sp
386Passing \fB\-M\fR to the driver implies \fB\-E\fR, and suppresses
387warnings with an implicit \fB\-w\fR.
388.IP "\fB\-MM\fR" 4
389.IX Item "-MM"
390Like \fB\-M\fR but do not mention header files that are found in
391system header directories, nor header files that are included,
392directly or indirectly, from such a header.
393.Sp
394This implies that the choice of angle brackets or double quotes in an
395\&\fB#include\fR directive does not in itself determine whether that
396header will appear in \fB\-MM\fR dependency output. This is a
397slight change in semantics from \s-1GCC\s0 versions 3.0 and earlier.
398.IP "\fB\-MF\fR \fIfile\fR" 4
399.IX Item "-MF file"
400When used with \fB\-M\fR or \fB\-MM\fR, specifies a
401file to write the dependencies to. If no \fB\-MF\fR switch is given
402the preprocessor sends the rules to the same place it would have sent
403preprocessed output.
404.Sp
405When used with the driver options \fB\-MD\fR or \fB\-MMD\fR,
406\&\fB\-MF\fR overrides the default dependency output file.
407.IP "\fB\-MG\fR" 4
408.IX Item "-MG"
409In conjunction with an option such as \fB\-M\fR requesting
410dependency generation, \fB\-MG\fR assumes missing header files are
411generated files and adds them to the dependency list without raising
412an error. The dependency filename is taken directly from the
413\&\f(CW\*(C`#include\*(C'\fR directive without prepending any path. \fB\-MG\fR
414also suppresses preprocessed output, as a missing header file renders
415this useless.
416.Sp
417This feature is used in automatic updating of makefiles.
418.IP "\fB\-MP\fR" 4
419.IX Item "-MP"
420This option instructs \s-1CPP\s0 to add a phony target for each dependency
421other than the main file, causing each to depend on nothing. These
422dummy rules work around errors \fBmake\fR gives if you remove header
423files without updating the \fIMakefile\fR to match.
424.Sp
425This is typical output:
426.Sp
427.Vb 1
428\& test.o: test.c test.h
429\&
430\& test.h:
431.Ve
432.IP "\fB\-MT\fR \fItarget\fR" 4
433.IX Item "-MT target"
434Change the target of the rule emitted by dependency generation. By
435default \s-1CPP\s0 takes the name of the main input file, deletes any
436directory components and any file suffix such as \fB.c\fR, and
437appends the platform's usual object suffix. The result is the target.
438.Sp
439An \fB\-MT\fR option will set the target to be exactly the string you
440specify. If you want multiple targets, you can specify them as a single
441argument to \fB\-MT\fR, or use multiple \fB\-MT\fR options.
442.Sp
443For example, \fB\-MT\ '$(objpfx)foo.o'\fR might give
444.Sp
445.Vb 1
446\& $(objpfx)foo.o: foo.c
447.Ve
448.IP "\fB\-MQ\fR \fItarget\fR" 4
449.IX Item "-MQ target"
450Same as \fB\-MT\fR, but it quotes any characters which are special to
451Make. \fB\-MQ\ '$(objpfx)foo.o'\fR gives
452.Sp
453.Vb 1
454\& $$(objpfx)foo.o: foo.c
455.Ve
456.Sp
457The default target is automatically quoted, as if it were given with
458\&\fB\-MQ\fR.
459.IP "\fB\-MD\fR" 4
460.IX Item "-MD"
461\&\fB\-MD\fR is equivalent to \fB\-M \-MF\fR \fIfile\fR, except that
462\&\fB\-E\fR is not implied. The driver determines \fIfile\fR based on
463whether an \fB\-o\fR option is given. If it is, the driver uses its
464argument but with a suffix of \fI.d\fR, otherwise it takes the name
465of the input file, removes any directory components and suffix, and
466applies a \fI.d\fR suffix.
467.Sp
468If \fB\-MD\fR is used in conjunction with \fB\-E\fR, any
469\&\fB\-o\fR switch is understood to specify the dependency output file, but if used without \fB\-E\fR, each \fB\-o\fR
470is understood to specify a target object file.
471.Sp
472Since \fB\-E\fR is not implied, \fB\-MD\fR can be used to generate
473a dependency output file as a side-effect of the compilation process.
474.IP "\fB\-MMD\fR" 4
475.IX Item "-MMD"
476Like \fB\-MD\fR except mention only user header files, not system
477header files.
478.IP "\fB\-x c\fR" 4
479.IX Item "-x c"
480.PD 0
481.IP "\fB\-x c++\fR" 4
482.IX Item "-x c++"
483.IP "\fB\-x objective-c\fR" 4
484.IX Item "-x objective-c"
485.IP "\fB\-x assembler-with-cpp\fR" 4
486.IX Item "-x assembler-with-cpp"
487.PD
488Specify the source language: C, \*(C+, Objective-C, or assembly. This has
489nothing to do with standards conformance or extensions; it merely
490selects which base syntax to expect. If you give none of these options,
491cpp will deduce the language from the extension of the source file:
492\&\fB.c\fR, \fB.cc\fR, \fB.m\fR, or \fB.S\fR. Some other common
493extensions for \*(C+ and assembly are also recognized. If cpp does not
494recognize the extension, it will treat the file as C; this is the most
495generic mode.
496.Sp
497\&\fINote:\fR Previous versions of cpp accepted a \fB\-lang\fR option
498which selected both the language and the standards conformance level.
499This option has been removed, because it conflicts with the \fB\-l\fR
500option.
501.IP "\fB\-std=\fR\fIstandard\fR" 4
502.IX Item "-std=standard"
503.PD 0
504.IP "\fB\-ansi\fR" 4
505.IX Item "-ansi"
506.PD
507Specify the standard to which the code should conform. Currently \s-1CPP\s0
508knows about C and \*(C+ standards; others may be added in the future.
509.Sp
510\&\fIstandard\fR
511may be one of:
512.RS 4
513.ie n .IP """iso9899:1990""" 4
514.el .IP "\f(CWiso9899:1990\fR" 4
515.IX Item "iso9899:1990"
516.PD 0
517.ie n .IP """c89""" 4
518.el .IP "\f(CWc89\fR" 4
519.IX Item "c89"
520.PD
521The \s-1ISO\s0 C standard from 1990. \fBc89\fR is the customary shorthand for
522this version of the standard.
523.Sp
524The \fB\-ansi\fR option is equivalent to \fB\-std=c89\fR.
525.ie n .IP """iso9899:199409""" 4
526.el .IP "\f(CWiso9899:199409\fR" 4
527.IX Item "iso9899:199409"
528The 1990 C standard, as amended in 1994.
529.ie n .IP """iso9899:1999""" 4
530.el .IP "\f(CWiso9899:1999\fR" 4
531.IX Item "iso9899:1999"
532.PD 0
533.ie n .IP """c99""" 4
534.el .IP "\f(CWc99\fR" 4
535.IX Item "c99"
536.ie n .IP """iso9899:199x""" 4
537.el .IP "\f(CWiso9899:199x\fR" 4
538.IX Item "iso9899:199x"
539.ie n .IP """c9x""" 4
540.el .IP "\f(CWc9x\fR" 4
541.IX Item "c9x"
542.PD
543The revised \s-1ISO\s0 C standard, published in December 1999. Before
544publication, this was known as C9X.
545.ie n .IP """gnu89""" 4
546.el .IP "\f(CWgnu89\fR" 4
547.IX Item "gnu89"
548The 1990 C standard plus \s-1GNU\s0 extensions. This is the default.
549.ie n .IP """gnu99""" 4
550.el .IP "\f(CWgnu99\fR" 4
551.IX Item "gnu99"
552.PD 0
553.ie n .IP """gnu9x""" 4
554.el .IP "\f(CWgnu9x\fR" 4
555.IX Item "gnu9x"
556.PD
557The 1999 C standard plus \s-1GNU\s0 extensions.
558.ie n .IP """c++98""" 4
559.el .IP "\f(CWc++98\fR" 4
560.IX Item "c++98"
561The 1998 \s-1ISO\s0 \*(C+ standard plus amendments.
562.ie n .IP """gnu++98""" 4
563.el .IP "\f(CWgnu++98\fR" 4
564.IX Item "gnu++98"
565The same as \fB\-std=c++98\fR plus \s-1GNU\s0 extensions. This is the
566default for \*(C+ code.
567.RE
568.RS 4
569.RE
570.IP "\fB\-I\-\fR" 4
571.IX Item "-I-"
572Split the include path. Any directories specified with \fB\-I\fR
573options before \fB\-I\-\fR are searched only for headers requested with
574\&\f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR; they are not searched for
575\&\f(CW\*(C`#include\ <\f(CIfile\f(CW>\*(C'\fR. If additional directories are
576specified with \fB\-I\fR options after the \fB\-I\-\fR, those
577directories are searched for all \fB#include\fR directives.
578.Sp
579In addition, \fB\-I\-\fR inhibits the use of the directory of the current
580file directory as the first search directory for \f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR.
581.Sp
582This option has been deprecated.
583.IP "\fB\-nostdinc\fR" 4
584.IX Item "-nostdinc"
585Do not search the standard system directories for header files.
586Only the directories you have specified with \fB\-I\fR options
587(and the directory of the current file, if appropriate) are searched.
588.IP "\fB\-nostdinc++\fR" 4
589.IX Item "-nostdinc++"
590Do not search for header files in the \*(C+\-specific standard directories,
591but do still search the other standard directories. (This option is
592used when building the \*(C+ library.)
593.IP "\fB\-include\fR \fIfile\fR" 4
594.IX Item "-include file"
595Process \fIfile\fR as if \f(CW\*(C`#include "file"\*(C'\fR appeared as the first
596line of the primary source file. However, the first directory searched
597for \fIfile\fR is the preprocessor's working directory \fIinstead of\fR
598the directory containing the main source file. If not found there, it
599is searched for in the remainder of the \f(CW\*(C`#include "..."\*(C'\fR search
600chain as normal.
601.Sp
602If multiple \fB\-include\fR options are given, the files are included
603in the order they appear on the command line.
604.IP "\fB\-imacros\fR \fIfile\fR" 4
605.IX Item "-imacros file"
606Exactly like \fB\-include\fR, except that any output produced by
607scanning \fIfile\fR is thrown away. Macros it defines remain defined.
608This allows you to acquire all the macros from a header without also
609processing its declarations.
610.Sp
611All files specified by \fB\-imacros\fR are processed before all files
612specified by \fB\-include\fR.
613.IP "\fB\-idirafter\fR \fIdir\fR" 4
614.IX Item "-idirafter dir"
615Search \fIdir\fR for header files, but do it \fIafter\fR all
616directories specified with \fB\-I\fR and the standard system directories
617have been exhausted. \fIdir\fR is treated as a system include directory.
618If \fIdir\fR begins with \f(CW\*(C`=\*(C'\fR, then the \f(CW\*(C`=\*(C'\fR will be replaced
619by the sysroot prefix; see \fB\-\-sysroot\fR and \fB\-isysroot\fR.
620.IP "\fB\-iprefix\fR \fIprefix\fR" 4
621.IX Item "-iprefix prefix"
622Specify \fIprefix\fR as the prefix for subsequent \fB\-iwithprefix\fR
623options. If the prefix represents a directory, you should include the
624final \fB/\fR.
625.IP "\fB\-iwithprefix\fR \fIdir\fR" 4
626.IX Item "-iwithprefix dir"
627.PD 0
628.IP "\fB\-iwithprefixbefore\fR \fIdir\fR" 4
629.IX Item "-iwithprefixbefore dir"
630.PD
631Append \fIdir\fR to the prefix specified previously with
632\&\fB\-iprefix\fR, and add the resulting directory to the include search
633path. \fB\-iwithprefixbefore\fR puts it in the same place \fB\-I\fR
634would; \fB\-iwithprefix\fR puts it where \fB\-idirafter\fR would.
635.IP "\fB\-isysroot\fR \fIdir\fR" 4
636.IX Item "-isysroot dir"
637This option is like the \fB\-\-sysroot\fR option, but applies only to
638header files. See the \fB\-\-sysroot\fR option for more information.
639.IP "\fB\-imultilib\fR \fIdir\fR" 4
640.IX Item "-imultilib dir"
641Use \fIdir\fR as a subdirectory of the directory containing
642target-specific \*(C+ headers.
643.IP "\fB\-isystem\fR \fIdir\fR" 4
644.IX Item "-isystem dir"
645Search \fIdir\fR for header files, after all directories specified by
646\&\fB\-I\fR but before the standard system directories. Mark it
647as a system directory, so that it gets the same special treatment as
648is applied to the standard system directories.
649.Sp
650If \fIdir\fR begins with \f(CW\*(C`=\*(C'\fR, then the \f(CW\*(C`=\*(C'\fR will be replaced
651by the sysroot prefix; see \fB\-\-sysroot\fR and \fB\-isysroot\fR.
652.IP "\fB\-iquote\fR \fIdir\fR" 4
653.IX Item "-iquote dir"
654Search \fIdir\fR only for header files requested with
655\&\f(CW\*(C`#include\ "\f(CIfile\f(CW"\*(C'\fR; they are not searched for
656\&\f(CW\*(C`#include\ <\f(CIfile\f(CW>\*(C'\fR, before all directories specified by
657\&\fB\-I\fR and before the standard system directories.
658.Sp
659If \fIdir\fR begins with \f(CW\*(C`=\*(C'\fR, then the \f(CW\*(C`=\*(C'\fR will be replaced
660by the sysroot prefix; see \fB\-\-sysroot\fR and \fB\-isysroot\fR.
661.IP "\fB\-fdirectives\-only\fR" 4
662.IX Item "-fdirectives-only"
663When preprocessing, handle directives, but do not expand macros.
664.Sp
665The option's behavior depends on the \fB\-E\fR and \fB\-fpreprocessed\fR
666options.
667.Sp
668With \fB\-E\fR, preprocessing is limited to the handling of directives
669such as \f(CW\*(C`#define\*(C'\fR, \f(CW\*(C`#ifdef\*(C'\fR, and \f(CW\*(C`#error\*(C'\fR. Other
670preprocessor operations, such as macro expansion and trigraph
671conversion are not performed. In addition, the \fB\-dD\fR option is
672implicitly enabled.
673.Sp
674With \fB\-fpreprocessed\fR, predefinition of command line and most
675builtin macros is disabled. Macros such as \f(CW\*(C`_\|_LINE_\|_\*(C'\fR, which are
676contextually dependent, are handled normally. This enables compilation of
677files previously preprocessed with \f(CW\*(C`\-E \-fdirectives\-only\*(C'\fR.
678.Sp
679With both \fB\-E\fR and \fB\-fpreprocessed\fR, the rules for
680\&\fB\-fpreprocessed\fR take precedence. This enables full preprocessing of
681files previously preprocessed with \f(CW\*(C`\-E \-fdirectives\-only\*(C'\fR.
682.IP "\fB\-fdollars\-in\-identifiers\fR" 4
683.IX Item "-fdollars-in-identifiers"
684Accept \fB$\fR in identifiers.
685.IP "\fB\-fextended\-identifiers\fR" 4
686.IX Item "-fextended-identifiers"
687Accept universal character names in identifiers. This option is
688experimental; in a future version of \s-1GCC\s0, it will be enabled by
689default for C99 and \*(C+.
690.IP "\fB\-fpreprocessed\fR" 4
691.IX Item "-fpreprocessed"
692Indicate to the preprocessor that the input file has already been
693preprocessed. This suppresses things like macro expansion, trigraph
694conversion, escaped newline splicing, and processing of most directives.
695The preprocessor still recognizes and removes comments, so that you can
696pass a file preprocessed with \fB\-C\fR to the compiler without
697problems. In this mode the integrated preprocessor is little more than
698a tokenizer for the front ends.
699.Sp
700\&\fB\-fpreprocessed\fR is implicit if the input file has one of the
701extensions \fB.i\fR, \fB.ii\fR or \fB.mi\fR. These are the
702extensions that \s-1GCC\s0 uses for preprocessed files created by
703\&\fB\-save\-temps\fR.
704.IP "\fB\-ftabstop=\fR\fIwidth\fR" 4
705.IX Item "-ftabstop=width"
706Set the distance between tab stops. This helps the preprocessor report
707correct column numbers in warnings or errors, even if tabs appear on the
708line. If the value is less than 1 or greater than 100, the option is
709ignored. The default is 8.
710.IP "\fB\-fexec\-charset=\fR\fIcharset\fR" 4
711.IX Item "-fexec-charset=charset"
712Set the execution character set, used for string and character
713constants. The default is \s-1UTF\-8\s0. \fIcharset\fR can be any encoding
714supported by the system's \f(CW\*(C`iconv\*(C'\fR library routine.
715.IP "\fB\-fwide\-exec\-charset=\fR\fIcharset\fR" 4
716.IX Item "-fwide-exec-charset=charset"
717Set the wide execution character set, used for wide string and
718character constants. The default is \s-1UTF\-32\s0 or \s-1UTF\-16\s0, whichever
719corresponds to the width of \f(CW\*(C`wchar_t\*(C'\fR. As with
720\&\fB\-fexec\-charset\fR, \fIcharset\fR can be any encoding supported
721by the system's \f(CW\*(C`iconv\*(C'\fR library routine; however, you will have
722problems with encodings that do not fit exactly in \f(CW\*(C`wchar_t\*(C'\fR.
723.IP "\fB\-finput\-charset=\fR\fIcharset\fR" 4
724.IX Item "-finput-charset=charset"
725Set the input character set, used for translation from the character
726set of the input file to the source character set used by \s-1GCC\s0. If the
727locale does not specify, or \s-1GCC\s0 cannot get this information from the
728locale, the default is \s-1UTF\-8\s0. This can be overridden by either the locale
729or this command line option. Currently the command line option takes
730precedence if there's a conflict. \fIcharset\fR can be any encoding
731supported by the system's \f(CW\*(C`iconv\*(C'\fR library routine.
732.IP "\fB\-fworking\-directory\fR" 4
733.IX Item "-fworking-directory"
734Enable generation of linemarkers in the preprocessor output that will
735let the compiler know the current working directory at the time of
736preprocessing. When this option is enabled, the preprocessor will
737emit, after the initial linemarker, a second linemarker with the
738current working directory followed by two slashes. \s-1GCC\s0 will use this
739directory, when it's present in the preprocessed input, as the
740directory emitted as the current working directory in some debugging
741information formats. This option is implicitly enabled if debugging
742information is enabled, but this can be inhibited with the negated
743form \fB\-fno\-working\-directory\fR. If the \fB\-P\fR flag is
744present in the command line, this option has no effect, since no
745\&\f(CW\*(C`#line\*(C'\fR directives are emitted whatsoever.
746.IP "\fB\-fno\-show\-column\fR" 4
747.IX Item "-fno-show-column"
748Do not print column numbers in diagnostics. This may be necessary if
749diagnostics are being scanned by a program that does not understand the
750column numbers, such as \fBdejagnu\fR.
751.IP "\fB\-A\fR \fIpredicate\fR\fB=\fR\fIanswer\fR" 4
752.IX Item "-A predicate=answer"
753Make an assertion with the predicate \fIpredicate\fR and answer
754\&\fIanswer\fR. This form is preferred to the older form \fB\-A\fR
755\&\fIpredicate\fR\fB(\fR\fIanswer\fR\fB)\fR, which is still supported, because
756it does not use shell special characters.
757.IP "\fB\-A \-\fR\fIpredicate\fR\fB=\fR\fIanswer\fR" 4
758.IX Item "-A -predicate=answer"
759Cancel an assertion with the predicate \fIpredicate\fR and answer
760\&\fIanswer\fR.
761.IP "\fB\-dCHARS\fR" 4
762.IX Item "-dCHARS"
763\&\fI\s-1CHARS\s0\fR is a sequence of one or more of the following characters,
764and must not be preceded by a space. Other characters are interpreted
765by the compiler proper, or reserved for future versions of \s-1GCC\s0, and so
766are silently ignored. If you specify characters whose behavior
767conflicts, the result is undefined.
768.RS 4
769.IP "\fBM\fR" 4
770.IX Item "M"
771Instead of the normal output, generate a list of \fB#define\fR
772directives for all the macros defined during the execution of the
773preprocessor, including predefined macros. This gives you a way of
774finding out what is predefined in your version of the preprocessor.
775Assuming you have no file \fIfoo.h\fR, the command
776.Sp
777.Vb 1
778\& touch foo.h; cpp \-dM foo.h
779.Ve
780.Sp
781will show all the predefined macros.
782.Sp
783If you use \fB\-dM\fR without the \fB\-E\fR option, \fB\-dM\fR is
784interpreted as a synonym for \fB\-fdump\-rtl\-mach\fR.
785.IP "\fBD\fR" 4
786.IX Item "D"
787Like \fBM\fR except in two respects: it does \fInot\fR include the
788predefined macros, and it outputs \fIboth\fR the \fB#define\fR
789directives and the result of preprocessing. Both kinds of output go to
790the standard output file.
791.IP "\fBN\fR" 4
792.IX Item "N"
793Like \fBD\fR, but emit only the macro names, not their expansions.
794.IP "\fBI\fR" 4
795.IX Item "I"
796Output \fB#include\fR directives in addition to the result of
797preprocessing.
798.IP "\fBU\fR" 4
799.IX Item "U"
800Like \fBD\fR except that only macros that are expanded, or whose
801definedness is tested in preprocessor directives, are output; the
802output is delayed until the use or test of the macro; and
803\&\fB#undef\fR directives are also output for macros tested but
804undefined at the time.
805.RE
806.RS 4
807.RE
808.IP "\fB\-P\fR" 4
809.IX Item "-P"
810Inhibit generation of linemarkers in the output from the preprocessor.
811This might be useful when running the preprocessor on something that is
812not C code, and will be sent to a program which might be confused by the
813linemarkers.
814.IP "\fB\-C\fR" 4
815.IX Item "-C"
816Do not discard comments. All comments are passed through to the output
817file, except for comments in processed directives, which are deleted
818along with the directive.
819.Sp
820You should be prepared for side effects when using \fB\-C\fR; it
821causes the preprocessor to treat comments as tokens in their own right.
822For example, comments appearing at the start of what would be a
823directive line have the effect of turning that line into an ordinary
824source line, since the first token on the line is no longer a \fB#\fR.
825.IP "\fB\-CC\fR" 4
826.IX Item "-CC"
827Do not discard comments, including during macro expansion. This is
828like \fB\-C\fR, except that comments contained within macros are
829also passed through to the output file where the macro is expanded.
830.Sp
831In addition to the side-effects of the \fB\-C\fR option, the
832\&\fB\-CC\fR option causes all \*(C+\-style comments inside a macro
833to be converted to C\-style comments. This is to prevent later use
834of that macro from inadvertently commenting out the remainder of
835the source line.
836.Sp
837The \fB\-CC\fR option is generally used to support lint comments.
838.IP "\fB\-traditional\-cpp\fR" 4
839.IX Item "-traditional-cpp"
840Try to imitate the behavior of old-fashioned C preprocessors, as
841opposed to \s-1ISO\s0 C preprocessors.
842.IP "\fB\-trigraphs\fR" 4
843.IX Item "-trigraphs"
844Process trigraph sequences.
845.IP "\fB\-remap\fR" 4
846.IX Item "-remap"
847Enable special code to work around file systems which only permit very
848short file names, such as MS-DOS.
849.IP "\fB\-\-help\fR" 4
850.IX Item "--help"
851.PD 0
852.IP "\fB\-\-target\-help\fR" 4
853.IX Item "--target-help"
854.PD
855Print text describing all the command line options instead of
856preprocessing anything.
857.IP "\fB\-v\fR" 4
858.IX Item "-v"
859Verbose mode. Print out \s-1GNU\s0 \s-1CPP\s0's version number at the beginning of
860execution, and report the final form of the include path.
861.IP "\fB\-H\fR" 4
862.IX Item "-H"
863Print the name of each header file used, in addition to other normal
864activities. Each name is indented to show how deep in the
865\&\fB#include\fR stack it is. Precompiled header files are also
866printed, even if they are found to be invalid; an invalid precompiled
867header file is printed with \fB...x\fR and a valid one with \fB...!\fR .
868.IP "\fB\-version\fR" 4
869.IX Item "-version"
870.PD 0
871.IP "\fB\-\-version\fR" 4
872.IX Item "--version"
873.PD
874Print out \s-1GNU\s0 \s-1CPP\s0's version number. With one dash, proceed to
875preprocess as normal. With two dashes, exit immediately.
876.SH "ENVIRONMENT"
877.IX Header "ENVIRONMENT"
878This section describes the environment variables that affect how \s-1CPP\s0
879operates. You can use them to specify directories or prefixes to use
880when searching for include files, or to control dependency output.
881.PP
882Note that you can also specify places to search using options such as
883\&\fB\-I\fR, and control dependency output with options like
884\&\fB\-M\fR. These take precedence over
885environment variables, which in turn take precedence over the
886configuration of \s-1GCC\s0.
887.IP "\fB\s-1CPATH\s0\fR" 4
888.IX Item "CPATH"
889.PD 0
890.IP "\fBC_INCLUDE_PATH\fR" 4
891.IX Item "C_INCLUDE_PATH"
892.IP "\fB\s-1CPLUS_INCLUDE_PATH\s0\fR" 4
893.IX Item "CPLUS_INCLUDE_PATH"
894.IP "\fB\s-1OBJC_INCLUDE_PATH\s0\fR" 4
895.IX Item "OBJC_INCLUDE_PATH"
896.PD
897Each variable's value is a list of directories separated by a special
898character, much like \fB\s-1PATH\s0\fR, in which to look for header files.
899The special character, \f(CW\*(C`PATH_SEPARATOR\*(C'\fR, is target-dependent and
900determined at \s-1GCC\s0 build time. For Microsoft Windows-based targets it is a
901semicolon, and for almost all other targets it is a colon.
902.Sp
903\&\fB\s-1CPATH\s0\fR specifies a list of directories to be searched as if
904specified with \fB\-I\fR, but after any paths given with \fB\-I\fR
905options on the command line. This environment variable is used
906regardless of which language is being preprocessed.
907.Sp
908The remaining environment variables apply only when preprocessing the
909particular language indicated. Each specifies a list of directories
910to be searched as if specified with \fB\-isystem\fR, but after any
911paths given with \fB\-isystem\fR options on the command line.
912.Sp
913In all these variables, an empty element instructs the compiler to
914search its current working directory. Empty elements can appear at the
915beginning or end of a path. For instance, if the value of
916\&\fB\s-1CPATH\s0\fR is \f(CW\*(C`:/special/include\*(C'\fR, that has the same
917effect as \fB\-I.\ \-I/special/include\fR.
918.IP "\fB\s-1DEPENDENCIES_OUTPUT\s0\fR" 4
919.IX Item "DEPENDENCIES_OUTPUT"
920If this variable is set, its value specifies how to output
921dependencies for Make based on the non-system header files processed
922by the compiler. System header files are ignored in the dependency
923output.
924.Sp
925The value of \fB\s-1DEPENDENCIES_OUTPUT\s0\fR can be just a file name, in
926which case the Make rules are written to that file, guessing the target
927name from the source file name. Or the value can have the form
928\&\fIfile\fR\fB \fR\fItarget\fR, in which case the rules are written to
929file \fIfile\fR using \fItarget\fR as the target name.
930.Sp
931In other words, this environment variable is equivalent to combining
932the options \fB\-MM\fR and \fB\-MF\fR,
933with an optional \fB\-MT\fR switch too.
934.IP "\fB\s-1SUNPRO_DEPENDENCIES\s0\fR" 4
935.IX Item "SUNPRO_DEPENDENCIES"
936This variable is the same as \fB\s-1DEPENDENCIES_OUTPUT\s0\fR (see above),
937except that system header files are not ignored, so it implies
938\&\fB\-M\fR rather than \fB\-MM\fR. However, the dependence on the
939main input file is omitted.
940.SH "SEE ALSO"
941.IX Header "SEE ALSO"
942\&\fIgpl\fR\|(7), \fIgfdl\fR\|(7), \fIfsf\-funding\fR\|(7),
943\&\fIgcc\fR\|(1), \fIas\fR\|(1), \fIld\fR\|(1), and the Info entries for \fIcpp\fR, \fIgcc\fR, and
944\&\fIbinutils\fR.
945.SH "COPYRIGHT"
946.IX Header "COPYRIGHT"
947Copyright (c) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
9481997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
949Free Software Foundation, Inc.
950.PP
951Permission is granted to copy, distribute and/or modify this document
952under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.2 or
953any later version published by the Free Software Foundation. A copy of
954the license is included in the
955man page \fIgfdl\fR\|(7).
956This manual contains no Invariant Sections. The Front-Cover Texts are
957(a) (see below), and the Back-Cover Texts are (b) (see below).
958.PP
959(a) The \s-1FSF\s0's Front-Cover Text is:
960.PP
961.Vb 1
962\& A GNU Manual
963.Ve
964.PP
965(b) The \s-1FSF\s0's Back-Cover Text is:
966.PP
967.Vb 3
968\& You have freedom to copy and modify this GNU Manual, like GNU
969\& software. Copies published by the Free Software Foundation raise
970\& funds for GNU development.
971.Ve