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