16 .ie \\n(.$>=3 .ne \\$3
32 ''' Set up \*(-- to give an unbreakable dash;
33 ''' string Tr holds user defined translation string.
34 ''' Bell System Logo is used as a dummy character.
40 .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
41 .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
44 ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
45 ''' \*(L" and \*(R", except that they are used on ".xx" lines,
46 ''' such as .IP and .SH, which do another additional levels of
47 ''' double-quote interpretation
76 .TH CPP 1 "gcc-2.95" "14/Jun/99" "GNU"
80 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
81 .de CQ \" put $1 in typewriter font
87 \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
90 .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
91 . \" AM - accent mark definitions
93 . \" fudge factors for nroff and troff
102 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
108 . \" simple accents for nroff and troff
121 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
122 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
123 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
124 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
125 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
126 . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
127 . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
128 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
129 . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
131 . \" troff and (daisy-wheel) nroff accents
132 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
133 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
134 .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
135 .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
136 .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
137 .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
138 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
139 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
140 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
141 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
142 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
143 .ds ae a\h'-(\w'a'u*4/10)'e
144 .ds Ae A\h'-(\w'A'u*4/10)'E
145 .ds oe o\h'-(\w'o'u*4/10)'e
146 .ds Oe O\h'-(\w'O'u*4/10)'E
147 . \" corrections for vroff
148 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
149 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
150 . \" for low resolution devices (crt and lpr)
151 .if \n(.H>23 .if \n(.V>19 \
155 . ds v \h'-1'\o'\(aa\(ga'
171 cpp \- The C Preprocessor
173 cpp [\fB\-P\fR] [\fB\-C\fR] [\fB\-gcc\fR] [\fB\-traditional\fR]
174 [\fB\-undef\fR] [\fB\-trigraphs\fR] [\fB\-pedantic\fR]
175 [\fB\-W\fR\fIwarn\fR...] [\fB\-I\fR\fIdir\fR...]
176 [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR]
177 [\fB\-A\fR\fIpredicate\fR(\fIanswer\fR)]
178 [\fB\-M\fR|\fB\-MM\fR|\fB\-MD\fR|\fB\-MMD\fR [\fB\-MG\fR]]
179 [\fB\-x\fR \fIlanguage\fR] [\fB\-std=\fR\fIstandard\fR]
180 \fIinfile\fR \fIoutfile\fR
182 Only the most useful options are listed here; see below for the remainder.
184 The C preprocessor is a \fImacro processor\fR that is used automatically by
185 the C compiler to transform your program before actual compilation. It is
186 called a macro processor because it allows you to define \fImacros\fR,
187 which are brief abbreviations for longer constructs.
189 The C preprocessor provides four separate facilities that you can use as
192 Inclusion of header files. These are files of declarations that can be
193 substituted into your program.
195 Macro expansion. You can define \fImacros\fR, which are abbreviations
196 for arbitrary fragments of C code, and then the C preprocessor will
197 replace the macros with their definitions throughout the program.
199 Conditional compilation. Using special preprocessing directives, you
200 can include or exclude parts of the program according to various
203 Line control. If you use a program to combine or rearrange source files into
204 an intermediate file which is then compiled, you can use line control
205 to inform the compiler of where each source line originally came from.
207 C preprocessors vary in some details. This manual discusses the \s-1GNU\s0 C
208 preprocessor, the C Compatible Compiler Preprocessor. The \s-1GNU\s0 C
209 preprocessor provides a superset of the features of \s-1ANSI\s0 Standard C.
211 \s-1ANSI\s0 Standard C requires the rejection of many harmless constructs commonly
212 used by today's C programs. Such incompatibility would be inconvenient for
213 users, so the \s-1GNU\s0 C preprocessor is configured to accept these constructs
214 by default. Strictly speaking, to get \s-1ANSI\s0 Standard C, you must use the
215 options \fB\-trigraphs\fR, \fB\-undef\fR and \fB\-pedantic\fR, but in
216 practice the consequences of having strict \s-1ANSI\s0 Standard C make it
217 undesirable to do this.
219 The C preprocessor is designed for C\-like languages; you may run into
220 problems if you apply it to other kinds of languages, because it assumes
221 that it is dealing with C. For example, the C preprocessor sometimes
222 outputs extra white space to avoid inadvertent C token concatenation,
223 and this may cause problems with other languages.
225 The C preprocessor expects two file names as arguments, \fIinfile\fR and
226 \fIoutfile\fR. The preprocessor reads \fIinfile\fR together with any other
227 files it specifies with \fB#include\fR. All the output generated by the
228 combined input files is written in \fIoutfile\fR.
230 Either \fIinfile\fR or \fIoutfile\fR may be \fB\-\fR, which as
231 \fIinfile\fR means to read from standard input and as \fIoutfile\fR
232 means to write to standard output. Also, if either file is omitted, it
233 means the same as if \fB\-\fR had been specified for that file.
235 Here is a table of command options accepted by the C preprocessor.
236 These options can also be given when compiling a C program; they are
237 passed along automatically to the preprocessor when it is invoked by the
240 Inhibit generation of \fB#\fR\-lines with line-number information in
241 the output from the preprocessor This might be
242 useful when running the preprocessor on something that is not C code
243 and will be sent to a program which might be confused by the
246 Do not discard comments: pass them through to the output file.
247 Comments appearing in arguments of a macro call will be copied to the
248 output before the expansion of the macro call.
249 .Ip "\fB\-traditional\fR" 4
250 Try to imitate the behavior of old-fashioned C, as opposed to \s-1ANSI\s0 C.
252 Traditional macro expansion pays no attention to singlequote or
253 doublequote characters; macro argument symbols are replaced by the
254 argument values even when they appear within apparent string or
257 Traditionally, it is permissible for a macro expansion to end in the
258 middle of a string or character constant. The constant continues into
259 the text surrounding the macro call.
261 However, traditionally the end of the line terminates a string or
262 character constant, with no error.
264 In traditional C, a comment is equivalent to no text at all. (In \s-1ANSI\s0
265 C, a comment counts as whitespace.)
267 Traditional C does not have the concept of a ``preprocessing number'\*(R'.
268 It considers \fB1.0e+4\fR to be three tokens: \fB1.0e\fR, \fB+\fR,
271 A macro is not suppressed within its own definition, in traditional C.
272 Thus, any macro that is used recursively inevitably causes an error.
274 The character \fB#\fR has no special meaning within a macro definition
277 In traditional C, the text at the end of a macro expansion can run
278 together with the text after the macro call, to produce a single token.
279 (This is impossible in \s-1ANSI\s0 C.)
281 Traditionally, \fB\e\fR inside a macro argument suppresses the syntactic
282 significance of the following character.
284 Use the \fB\-traditional\fR option when preprocessing Fortran code,
285 so that singlequotes and doublequotes
286 within Fortran comment lines
287 (which are generally not recognized as such by the preprocessor)
288 do not cause diagnostics
289 about unterminated character or string constants.
291 However, this option does not prevent diagnostics
292 about unterminated comments
293 when a C\-style comment appears to start, but not end,
294 within Fortran-style commentary.
296 So, the following Fortran comment lines are accepted with
300 \& C This isn't an unterminated character constant
301 \& C Neither is "20000000000, an octal constant
302 \& C in some dialects of Fortran
304 However, this type of comment line will likely produce a diagnostic,
305 or at least unexpected output from the preprocessor,
306 due to the unterminated comment:
309 \& C Some Fortran compilers accept /* as starting
310 \& C an inline comment.
312 Note that \f(CWg77\fR automatically supplies
313 the \fB\-traditional\fR option
314 when it invokes the preprocessor.
315 However, a future version of \f(CWg77\fR
316 might use a different, more-Fortran-aware preprocessor
317 in place of \f(CWcpp\fR.
318 .Ip "\fB\-trigraphs\fR" 4
319 Process \s-1ANSI\s0 standard trigraph sequences. These are three-character
320 sequences, all starting with \fB??\fR, that are defined by \s-1ANSI\s0 C to
321 stand for single characters. For example, \fB??/\fR stands for
322 \fB\e\fR, so \fB\*(R'??/n\*(R'\fR is a character constant for a newline.
323 Strictly speaking, the \s-1GNU\s0 C preprocessor does not support all
324 programs in \s-1ANSI\s0 Standard C unless \fB\-trigraphs\fR is used, but if
325 you ever notice the difference it will be with relief.
327 You don't want to know any more about trigraphs.
328 .Ip "\fB\-pedantic\fR" 4
329 Issue warnings required by the \s-1ANSI\s0 C standard in certain cases such
330 as when text other than a comment follows \fB#else\fR or \fB#endif\fR.
331 .Ip "\fB\-pedantic-errors\fR" 4
332 Like \fB\-pedantic\fR, except that errors are produced rather than
334 .Ip "\fB\-Wtrigraphs\fR" 4
335 Warn if any trigraphs are encountered. Currently this only works if you
336 have turned trigraphs on with \fB\-trigraphs\fR or \fB\-ansi\fR; in the
337 future this restriction will be removed.
338 .Ip "\fB\-Wcomment\fR" 4
339 Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR
340 comment, or whenever a Backslash-Newline appears in a \fB//\fR comment.
342 Requests both \fB\-Wtrigraphs\fR and \fB\-Wcomment\fR (but not
343 \fB\-Wtraditional\fR or \fB\-Wundef\fR).
344 .Ip "\fB\-Wtraditional\fR" 4
345 Warn about certain constructs that behave differently in traditional and
347 .Ip "\fB\-Wundef\fR" 4
348 Warn if an undefined identifier is evaluated in an \fB#if\fR directive.
349 .Ip "\fB\-I \fIdirectory\fR\fR" 4
350 Add the directory \fIdirectory\fR to the head of the list of
351 directories to be searched for header files
352 This can be used to override a system header file, substituting your
353 own version, since these directories are searched before the system
354 header file directories. If you use more than one \fB\-I\fR option,
355 the directories are scanned in left-to-right order; the standard
356 system directories come after.
358 Any directories specified with \fB\-I\fR options before the \fB\-I-\fR
359 option are searched only for the case of \fB#include \*(L"\fIfile\fB\*(R"\fR;
360 they are not searched for \fB#include <\fIfile\fB>\fR.
362 If additional directories are specified with \fB\-I\fR options after
363 the \fB\-I-\fR, these directories are searched for all \fB#include\fR
366 In addition, the \fB\-I-\fR option inhibits the use of the current
367 directory as the first search directory for \fB#include \*(L"\fIfile\fB\*(R"\fR.
368 Therefore, the current directory is searched only if it is requested
369 explicitly with \fB\-I.\fR. Specifying both \fB\-I-\fR and \fB\-I.\fR
370 allows you to control precisely which directories are searched before
371 the current one and which are searched after.
372 .Ip "\fB\-nostdinc\fR" 4
373 Do not search the standard system directories for header files.
374 Only the directories you have specified with \fB\-I\fR options
375 (and the current directory, if appropriate) are searched.
376 .Ip "\fB\-nostdinc++\fR" 4
377 Do not search for header files in the \*(C+\-specific standard directories,
378 but do still search the other standard directories.
379 (This option is used when building the \*(C+ library.)
380 .Ip "\fB\-remap\fR" 4
381 When searching for a header file in a directory, remap file names if a
382 file named \fIheader.gcc\fR exists in that directory. This can be used
383 to work around limitations of file systems with file name restrictions.
384 The \fIheader.gcc\fR file should contain a series of lines with two
385 tokens on each line: the first token is the name to map, and the second
386 token is the actual name to use.
387 .Ip "\fB\-D \fIname\fR\fR" 4
388 Predefine \fIname\fR as a macro, with definition \fB1\fR.
389 .Ip "\fB\-D \fIname\fR=\fIdefinition\fR\fR" 4
390 Predefine \fIname\fR as a macro, with definition \fIdefinition\fR.
391 There are no restrictions on the contents of \fIdefinition\fR, but if
392 you are invoking the preprocessor from a shell or shell-like program you
393 may need to use the shell's quoting syntax to protect characters such as
394 spaces that have a meaning in the shell syntax. If you use more than
395 one \fB\-D\fR for the same \fIname\fR, the rightmost definition takes
397 .Ip "\fB\-U \fIname\fR\fR" 4
398 Do not predefine \fIname\fR. If both \fB\-U\fR and \fB\-D\fR are
399 specified for one name, whichever one appears later on the command line
401 .Ip "\fB\-undef\fR" 4
402 Do not predefine any nonstandard macros.
404 Define the macros \fI_\|_GNUC_\|_\fR and \fI_\|_GNUC_MINOR_\|_\fR. These are
405 defined automatically when you use \fBgcc \-E\fR; you can turn them off
406 in that case with \fB\-no-gcc\fR.
407 .Ip "\fB\-A \fIpredicate\fR(\fIanswer\fR)\fR" 4
408 Make an assertion with the predicate \fIpredicate\fR and answer
411 You can use \fB\-A-\fR to disable all predefined assertions; it also
412 undefines all predefined macros and all macros that preceded it on the
415 Instead of outputting the result of preprocessing, output a list of
416 \fB#define\fR directives for all the macros defined during the
417 execution of the preprocessor, including predefined macros. This gives
418 you a way of finding out what is predefined in your version of the
419 preprocessor; assuming you have no file \fBfoo.h\fR, the command
422 \& touch foo.h; cpp -dM foo.h
424 will show the values of any predefined macros.
426 Like \fB\-dM\fR except in two respects: it does \fInot\fR include the
427 predefined macros, and it outputs \fIboth\fR the \fB#define\fR
428 directives and the result of preprocessing. Both kinds of output go to
429 the standard output file.
431 Output \fB#include\fR directives in addition to the result of preprocessing.
432 .Ip "\fB\-M [\-\s-1MG\s0]\fR" 4
433 Instead of outputting the result of preprocessing, output a rule
434 suitable for \f(CWmake\fR describing the dependencies of the main
435 source file. The preprocessor outputs one \f(CWmake\fR rule containing
436 the object file name for that source file, a colon, and the names of
437 all the included files. If there are many included files then the
438 rule is split into several lines using \fB\e\fR\-newline.
440 \fB\-\s-1MG\s0\fR says to treat missing header files as generated files and assume
441 they live in the same directory as the source file. It must be specified
442 in addition to \fB\-M\fR.
444 This feature is used in automatic updating of makefiles.
445 .Ip "\fB\-\s-1MM\s0 [\-\s-1MG\s0]\fR" 4
446 Like \fB\-M\fR but mention only the files included with \fB#include
447 \*(L"\fIfile\fR\*(R"\fR. System header files included with \fB#include
448 <\fIfile\fR>\fR are omitted.
449 .Ip "\fB\-\s-1MD\s0 \fIfile\fR\fR" 4
450 Like \fB\-M\fR but the dependency information is written to \fIfile\fR.
451 This is in addition to compiling the file as specified---\fB\-\s-1MD\s0\fR does
452 not inhibit ordinary compilation the way \fB\-M\fR does.
454 When invoking \f(CWgcc\fR, do not specify the \fIfile\fR argument.
455 \f(CWgcc\fR will create file names made by replacing \*(L".c\*(R" with \*(L".d\*(R" at
456 the end of the input file names.
458 In Mach, you can use the utility \f(CWmd\fR to merge multiple dependency
459 files into a single dependency file suitable for using with the \fBmake\fR
461 .Ip "\fB\-\s-1MMD\s0 \fIfile\fR\fR" 4
462 Like \fB\-\s-1MD\s0\fR except mention only user header files, not system
465 Print the name of each header file used, in addition to other normal
467 .Ip "\fB\-imacros \fIfile\fR\fR" 4
468 Process \fIfile\fR as input, discarding the resulting output, before
469 processing the regular input file. Because the output generated from
470 \fIfile\fR is discarded, the only effect of \fB\-imacros \fIfile\fR\fR
471 is to make the macros defined in \fIfile\fR available for use in the
473 .Ip "\fB\-include \fIfile\fR\fR" 4
474 Process \fIfile\fR as input, and include all the resulting output,
475 before processing the regular input file.
476 .Ip "\fB\-idirafter \fIdir\fR\fR" 4
477 Add the directory \fIdir\fR to the second include path. The directories
478 on the second include path are searched when a header file is not found
479 in any of the directories in the main include path (the one that
481 .Ip "\fB\-iprefix \fIprefix\fR\fR" 4
482 Specify \fIprefix\fR as the prefix for subsequent \fB\-iwithprefix\fR
484 .Ip "\fB\-iwithprefix \fIdir\fR\fR" 4
485 Add a directory to the second include path. The directory's name is
486 made by concatenating \fIprefix\fR and \fIdir\fR, where \fIprefix\fR
487 was specified previously with \fB\-iprefix\fR.
488 .Ip "\fB\-isystem \fIdir\fR\fR" 4
489 Add a directory to the beginning of the second include path, marking it
490 as a system directory, so that it gets the same special treatment as
491 is applied to the standard system directories.
493 .Ip "\fB\-x c++\fR" 4
494 .Ip "\fB\-x objective-c\fR" 4
495 .Ip "\fB\-x assembler-with-cpp\fR" 4
496 Specify the source language: C, \*(C+, Objective-C, or assembly. This has
497 nothing to do with standards conformance or extensions; it merely
498 selects which base syntax to expect. If you give none of these options,
499 cpp will deduce the language from the extension of the source file:
500 \&\fB.c\fR, \fB.cc\fR, \fB.m\fR, or \fB.S\fR. Some other common
501 extensions for \*(C+ and assembly are also recognized. If cpp does not
502 recognize the extension, it will treat the file as C; this is the most
505 \fBNote:\fR Previous versions of cpp accepted a \fB\-lang\fR option
506 which selected both the language and the standards conformance level.
507 This option has been removed, because it conflicts with the \fB\-l\fR
509 .Ip "\fB\-std=\fIstandard\fR\fR" 4
511 Specify the standard to which the code should conform. Currently cpp
512 only knows about the standards for C; other language standards will be
517 .Ip "\f(CWiso9899:1990\fR" 8
518 The \s-1ISO\s0 C standard from 1990.
519 .Ip "\f(CWiso9899:199409\fR" 8
521 The 1990 C standard, as amended in 1994. \fBc89\fR is the customary
522 shorthand for this version of the standard.
524 The \fB\-ansi\fR option is equivalent to \fB\-std=c89\fR.
525 .Ip "\f(CWiso9899:199x\fR" 8
527 The revised \s-1ISO\s0 C standard, which is expected to be promulgated some
528 time in 1999. It has not been approved yet, hence the \fBx\fR.
529 .Ip "\f(CWgnu89\fR" 8
530 The 1990 C standard plus \s-1GNU\s0 extensions. This is the default.
531 .Ip "\f(CWgnu9x\fR" 8
532 The 199x C standard plus \s-1GNU\s0 extensions.
533 .Ip "\fB\-Wp,\-lint\fR" 4
534 Look for commands to the program checker \f(CWlint\fR embedded in
535 comments, and emit them preceded by \fB#pragma lint\fR. For example,
536 the comment \fB/* \s-1NOTREACHED\s0 */\fR becomes \fB#pragma lint
537 \s-1NOTREACHED\s0\fR.
539 Because of the clash with \fB\-l\fR, you must use the awkward syntax
540 above. In a future release, this option will be replaced by
541 \fB\-flint\fR or \fB\-Wlint\fR; we are not sure which yet.
543 Forbid the use of \fB$\fR in identifiers. The C standard does not
544 permit this, but it is a common extension.
546 \fIgcc\fR\|(1), \fIas\fR\|(1), \fIld\fR\|(1), and the Info entries for \fIcpp\fR, \fIgcc\fR, and
549 Copyright 1987, 1989, 1991-1999
550 Free Software Foundation, Inc.
552 Permission is granted to make and distribute verbatim copies of
553 this manual provided the copyright notice and this permission notice
554 are preserved on all copies.
556 Permission is granted to copy and distribute modified versions of this
557 manual under the conditions for verbatim copying, provided also that
558 the entire resulting derived work is distributed under the terms of a
559 permission notice identical to this one.
561 Permission is granted to copy and distribute translations of this manual
562 into another language, under the above conditions for modified versions.