1 .\" Copyright (c) 1991, 1992, 1993 Free Software Foundation \-*-Text-*-
2 .\" See section COPYING for conditions for redistribution
3 .TH cpp 1 "30apr1993" "GNU Tools" "GNU Tools"
5 cccp, cpp \- The GNU C-Compatible Compiler Preprocessor.
30 .RB "[\|" "\-imacros\ "\c
33 .RB "[\|" "\-include\ "\c
36 .RB "[\|" "\-idirafter\ "\c
39 .RB "[\|" "\-iprefix\ "\c
42 .RB "[\|" "\-iwithprefix\ "\c
45 .RB "[\|" \-lang\-c "\|]"
46 .RB "[\|" \-lang\-c++ "\|]"
47 .RB "[\|" \-lang\-objc "\|]"
48 .RB "[\|" \-lang\-objc++ "\|]"
49 .RB "[\|" \-lint "\|]"
50 .RB "[\|" \-M\ [ \-MG "\|]]"
51 .RB "[\|" \-MM\ [ \-MG "\|]]"
58 .RB "[\|" \-nostdinc "\|]"
59 .RB "[\|" \-nostdinc++ "\|]"
61 .RB "[\|" \-pedantic "\|]"
62 .RB "[\|" \-pedantic\-errors "\|]"
63 .RB "[\|" \-traditional "\|]"
64 .RB "[\|" \-trigraphs "\|]"
68 .RB "[\|" \-undef "\|]"
69 .RB "[\|" \-Wtrigraphs "\|]"
70 .RB "[\|" \-Wcomment "\|]"
71 .RB "[\|" \-Wall "\|]"
72 .RB "[\|" \-Wtraditional "\|]"
83 The C preprocessor is a \c
85 \& that is used automatically by
86 the C compiler to transform your program before actual compilation. It is
87 called a macro processor because it allows you to define \c
90 which are brief abbreviations for longer constructs.
92 The C preprocessor provides four separate facilities that you can use as
96 Inclusion of header files. These are files of declarations that can be
97 substituted into your program.
100 Macro expansion. You can define \c
102 \&, which are abbreviations
103 for arbitrary fragments of C code, and then the C preprocessor will
104 replace the macros with their definitions throughout the program.
107 Conditional compilation. Using special preprocessing directives, you
108 can include or exclude parts of the program according to various
112 Line control. If you use a program to combine or rearrange source files into
113 an intermediate file which is then compiled, you can use line control
114 to inform the compiler of where each source line originally came from.
116 C preprocessors vary in some details. For a full explanation of the
117 GNU C preprocessor, see the
122 .I The C Preprocessor\c
123 \&. Both of these are built from the same documentation source file, `\|\c
126 preprocessor provides a superset of the features of ANSI Standard C.
128 ANSI Standard C requires the rejection of many harmless constructs commonly
129 used by today's C programs. Such incompatibility would be inconvenient for
130 users, so the GNU C preprocessor is configured to accept these constructs
131 by default. Strictly speaking, to get ANSI Standard C, you must use the
139 practice the consequences of having strict ANSI Standard C make it
140 undesirable to do this.
142 Most often when you use the C preprocessor you will not have to invoke it
143 explicitly: the C compiler will do so automatically. However, the
144 preprocessor is sometimes useful individually.
146 When you call the preprocessor individually, either name
151 \&) will do\(em\&they are completely synonymous.
153 The C preprocessor expects two file names as arguments, \c
158 \&. The preprocessor reads \c
160 \& together with any other
161 files it specifies with `\|\c
163 \&\|'. All the output generated by the
164 combined input files is written in \c
177 means to read from standard input and as \c
180 standard output. Also, if \c
182 \& or both file names are omitted,
183 the standard output and standard input are used for the omitted file names.
185 Here is a table of command options accepted by the C preprocessor.
186 These options can also be given when compiling a C program; they are
187 passed along automatically to the preprocessor when it is invoked by
191 Inhibit generation of `\|\c
193 \&\|'-lines with line-number information in
194 the output from the preprocessor. This might be
195 useful when running the preprocessor on something that is not C code
196 and will be sent to a program which might be confused by the
202 Do not discard comments: pass them through to the output file.
203 Comments appearing in arguments of a macro call will be copied to the
204 output before the expansion of the macro call.
207 Try to imitate the behavior of old-fashioned C, as opposed to ANSI C.
210 Process ANSI standard trigraph sequences. These are three-character
211 sequences, all starting with `\|\c
213 \&\|', that are defined by ANSI C to
214 stand for single characters. For example, `\|\c
221 \&\|' is a character constant for a newline.
222 Strictly speaking, the GNU C preprocessor does not support all
223 programs in ANSI Standard C unless `\|\c
225 \&\|' is used, but if
226 you ever notice the difference it will be with relief.
228 You don't want to know any more about trigraphs.
231 Issue warnings required by the ANSI C standard in certain cases such
232 as when text other than a comment follows `\|\c
238 .B \-pedantic\-errors
241 \&\|', except that errors are produced rather than
245 Warn if any trigraphs are encountered (assuming they are enabled).
250 Warn whenever a comment-start sequence `\|\c
252 \&\|' appears in a comment.
253 (Both forms have the same effect).
266 Warn about certain constructs that behave differently in traditional and
269 .BI "\-I " directory\c
273 \& to the end of the list of
274 directories to be searched for header files.
275 This can be used to override a system header file, substituting your
276 own version, since these directories are searched before the system
277 header file directories. If you use more than one `\|\c
280 the directories are scanned in left-to-right order; the standard
281 system directories come after.
284 Any directories specified with `\|\c
286 \&\|' options before the `\|\c
289 option are searched only for the case of `\|\c
294 they are not searched for `\|\c
300 If additional directories are specified with `\|\c
305 \&\|', these directories are searched for all `\|\c
310 In addition, the `\|\c
312 \&\|' option inhibits the use of the current
313 directory as the first search directory for `\|\c
318 Therefore, the current directory is searched only if it is requested
319 explicitly with `\|\c
321 \&\|'. Specifying both `\|\c
326 allows you to control precisely which directories are searched before
327 the current one and which are searched after.
330 Do not search the standard system directories for header files.
331 Only the directories you have specified with `\|\c
334 (and the current directory, if appropriate) are searched.
337 Do not search for header files in the C++ specific standard
338 directories, but do still search the other standard directories.
339 (This option is used when building libg++.)
345 \& as a macro, with definition `\|\c
349 .BI "\-D " "name" = definition
353 \& as a macro, with definition \c
356 There are no restrictions on the contents of \c
359 you are invoking the preprocessor from a shell or shell-like program
360 you may need to use the shell's quoting syntax to protect characters
361 such as spaces that have a meaning in the shell syntax. If you use more than
366 \&, the rightmost definition takes effect.
377 specified for one name, the `\|\c
379 \&\|' beats the `\|\c
385 Do not predefine any nonstandard macros.
387 .BI "\-A " "name(" value )
388 Assert (in the same way as the \c
395 \&. Remember to escape or quote the parentheses on
400 \&\|' to disable all predefined assertions; it also
401 undefines all predefined macros.
404 Instead of outputting the result of preprocessing, output a list of
407 \&\|' directives for all the macros defined during the
408 execution of the preprocessor, including predefined macros. This gives
409 you a way of finding out what is predefined in your version of the
410 preprocessor; assuming you have no file `\|\c
415 touch\ foo.h;\ cpp\ \-dM\ foo.h
418 will show the values of any predefined macros.
423 \&\|' except in two respects: it does \c
426 predefined macros, and it outputs \c
431 directives and the result of preprocessing. Both kinds of output go to
432 the standard output file.
436 Instead of outputting the result of preprocessing, output a rule
439 \& describing the dependencies of the main
440 source file. The preprocessor outputs one \c
443 the object file name for that source file, a colon, and the names of
444 all the included files. If there are many included files then the
445 rule is split into several lines using `\|\c
451 \&\|' says to treat missing header files as generated files and assume \c
452 they live in the same directory as the source file. It must be specified \c
457 This feature is used in automatic updating of makefiles.
462 \&\|' but mention only the files included with `\|\c
467 \&\|'. System header files included with `\|\c
477 \&\|' but the dependency information is written to `\|\c
479 \&\|'. This is in addition to compiling the file as
482 \&\|' does not inhibit ordinary compilation the way
487 When invoking gcc, do not specify the `\|\c
489 \&\|' argument. Gcc will create file names made by replacing `\|\c
493 \&\|' at the end of the input file names.
495 In Mach, you can use the utility \c
497 \& to merge multiple files
498 into a single dependency file suitable for using with the `\|\c
506 \&\|' except mention only user header files, not system
510 Print the name of each header file used, in addition to other normal
513 .BI "\-imacros " "file"\c
517 \& as input, discarding the resulting output, before
518 processing the regular input file. Because the output generated from
521 \& is discarded, the only effect of `\|\c
526 make the macros defined in \c
528 \& available for use in the main
529 input. The preprocessor evaluates any `\|\c
534 on the command line before processing `\|\c
540 .BI "\-include " "file"
543 as input, and include all the resulting output,
544 before processing the regular input file.
546 .BI "-idirafter " "dir"\c
550 \& to the second include path. The directories
551 on the second include path are searched when a header file is not found
552 in any of the directories in the main include path (the one that
557 .BI "-iprefix " "prefix"\c
561 \& as the prefix for subsequent `\|\c
566 .BI "-iwithprefix " "dir"\c
568 Add a directory to the second include path. The directory's name is
569 made by concatenating \c
576 was specified previously with `\|\c
587 Specify the source language. `\|\c
589 \&\|' makes the preprocessor
590 handle C++ comment syntax, and includes extra default include
591 directories for C++, and `\|\c
593 \&\|' enables the Objective C
596 \&\|' directive. `\|\c
598 \&\|' explicitly turns off both of
599 these extensions, and `\|\c
603 These options are generated by the compiler driver \c
606 passed from the `\|\c
611 Look for commands to the program checker \c
614 comments, and emit them preceded by `\|\c
618 .B /* NOTREACHED */\c
624 This option is available only when you call \c
629 \& will not pass it from its command line.
632 Forbid the use of `\|\c
634 \&\|' in identifiers. This was formerly required for strict conformance
635 to the C Standard before the standard was corrected. \c
637 This option is available only when you call \c
641 \& will not pass it from its command line.
647 .I The C Preprocessor\c
648 , Richard M. Stallman.
656 Using and Porting GNU CC (for version 2.0)\c
657 , Richard M. Stallman.
659 Copyright (c) 1991, 1992, 1993 Free Software Foundation, Inc.
661 Permission is granted to make and distribute verbatim copies of
662 this manual provided the copyright notice and this permission notice
663 are preserved on all copies.
665 Permission is granted to copy and distribute modified versions of this
666 manual under the conditions for verbatim copying, provided that the
667 entire resulting derived work is distributed under the terms of a
668 permission notice identical to this one.
670 Permission is granted to copy and distribute translations of this
671 manual into another language, under the above conditions for modified
672 versions, except that this permission notice may be included in
673 translations approved by the Free Software Foundation instead of in
674 the original English.