OSDN Git Service

This commit was generated by cvs2svn to compensate for changes in r16274,
[pf3gnuchains/gcc-fork.git] / gcc / cpp.info-3
1 This is Info file cpp.info, produced by Makeinfo version 1.67 from the
2 input file cpp.texi.
3
4    This file documents the GNU C Preprocessor.
5
6    Copyright 1987, 1989, 1991, 1992, 1993, 1994, 1995 Free Software
7 Foundation, Inc.
8
9    Permission is granted to make and distribute verbatim copies of this
10 manual provided the copyright notice and this permission notice are
11 preserved on all copies.
12
13    Permission is granted to copy and distribute modified versions of
14 this manual under the conditions for verbatim copying, provided also
15 that the entire resulting derived work is distributed under the terms
16 of a permission notice identical to this one.
17
18    Permission is granted to copy and distribute translations of this
19 manual into another language, under the above conditions for modified
20 versions.
21
22 \1f
23 File: cpp.info,  Node: Invocation,  Next: Concept Index,  Prev: Output,  Up: Top
24
25 Invoking the C Preprocessor
26 ===========================
27
28    Most often when you use the C preprocessor you will not have to
29 invoke it explicitly: the C compiler will do so automatically.
30 However, the preprocessor is sometimes useful on its own.
31
32    The C preprocessor expects two file names as arguments, INFILE and
33 OUTFILE.  The preprocessor reads INFILE together with any other files
34 it specifies with `#include'.  All the output generated by the combined
35 input files is written in OUTFILE.
36
37    Either INFILE or OUTFILE may be `-', which as INFILE means to read
38 from standard input and as OUTFILE means to write to standard output.
39 Also, if OUTFILE or both file names are omitted, the standard output
40 and standard input are used for the omitted file names.
41
42    Here is a table of command options accepted by the C preprocessor.
43 These options can also be given when compiling a C program; they are
44 passed along automatically to the preprocessor when it is invoked by the
45 compiler.
46
47 `-P'
48      Inhibit generation of `#'-lines with line-number information in
49      the output from the preprocessor (*note Output::.).  This might be
50      useful when running the preprocessor on something that is not C
51      code and will be sent to a program which might be confused by the
52      `#'-lines.
53
54 `-C'
55      Do not discard comments: pass them through to the output file.
56      Comments appearing in arguments of a macro call will be copied to
57      the output before the expansion of the macro call.
58
59 `-traditional'
60      Try to imitate the behavior of old-fashioned C, as opposed to ANSI
61      C.
62
63         * Traditional macro expansion pays no attention to singlequote
64           or doublequote characters; macro argument symbols are
65           replaced by the argument values even when they appear within
66           apparent string or character constants.
67
68         * Traditionally, it is permissible for a macro expansion to end
69           in the middle of a string or character constant.  The
70           constant continues into the text surrounding the macro call.
71
72         * However, traditionally the end of the line terminates a
73           string or character constant, with no error.
74
75         * In traditional C, a comment is equivalent to no text at all.
76           (In ANSI C, a comment counts as whitespace.)
77
78         * Traditional C does not have the concept of a "preprocessing
79           number".  It considers `1.0e+4' to be three tokens: `1.0e',
80           `+', and `4'.
81
82         * A macro is not suppressed within its own definition, in
83           traditional C.  Thus, any macro that is used recursively
84           inevitably causes an error.
85
86         * The character `#' has no special meaning within a macro
87           definition in traditional C.
88
89         * In traditional C, the text at the end of a macro expansion
90           can run together with the text after the macro call, to
91           produce a single token.  (This is impossible in ANSI C.)
92
93         * Traditionally, `\' inside a macro argument suppresses the
94           syntactic significance of the following character.
95
96 `-trigraphs'
97      Process ANSI standard trigraph sequences.  These are
98      three-character sequences, all starting with `??', that are
99      defined by ANSI C to stand for single characters.  For example,
100      `??/' stands for `\', so `'??/n'' is a character constant for a
101      newline.  Strictly speaking, the GNU C preprocessor does not
102      support all programs in ANSI Standard C unless `-trigraphs' is
103      used, but if you ever notice the difference it will be with relief.
104
105      You don't want to know any more about trigraphs.
106
107 `-pedantic'
108      Issue warnings required by the ANSI C standard in certain cases
109      such as when text other than a comment follows `#else' or `#endif'.
110
111 `-pedantic-errors'
112      Like `-pedantic', except that errors are produced rather than
113      warnings.
114
115 `-Wtrigraphs'
116      Warn if any trigraphs are encountered (assuming they are enabled).
117
118 `-Wcomment'
119      Warn whenever a comment-start sequence `/*' appears in a `/*'
120      comment, or whenever a Backslash-Newline appears in a `//' comment.
121
122 `-Wall'
123      Requests both `-Wtrigraphs' and `-Wcomment' (but not
124      `-Wtraditional' or `-Wundef').
125
126 `-Wtraditional'
127      Warn about certain constructs that behave differently in
128      traditional and ANSI C.
129
130 `-Wundef'
131      Warn if an undefined identifier is evaluated in an `#if' directive.
132
133 `-I DIRECTORY'
134      Add the directory DIRECTORY to the head of the list of directories
135      to be searched for header files (*note Include Syntax::.).  This
136      can be used to override a system header file, substituting your
137      own version, since these directories are searched before the system
138      header file directories.  If you use more than one `-I' option,
139      the directories are scanned in left-to-right order; the standard
140      system directories come after.
141
142 `-I-'
143      Any directories specified with `-I' options before the `-I-'
144      option are searched only for the case of `#include "FILE"'; they
145      are not searched for `#include <FILE>'.
146
147      If additional directories are specified with `-I' options after
148      the `-I-', these directories are searched for all `#include'
149      directives.
150
151      In addition, the `-I-' option inhibits the use of the current
152      directory as the first search directory for `#include "FILE"'.
153      Therefore, the current directory is searched only if it is
154      requested explicitly with `-I.'.  Specifying both `-I-' and `-I.'
155      allows you to control precisely which directories are searched
156      before the current one and which are searched after.
157
158 `-nostdinc'
159      Do not search the standard system directories for header files.
160      Only the directories you have specified with `-I' options (and the
161      current directory, if appropriate) are searched.
162
163 `-nostdinc++'
164      Do not search for header files in the C++-specific standard
165      directories, but do still search the other standard directories.
166      (This option is used when building libg++.)
167
168 `-D NAME'
169      Predefine NAME as a macro, with definition `1'.
170
171 `-D NAME=DEFINITION'
172      Predefine NAME as a macro, with definition DEFINITION.  There are
173      no restrictions on the contents of DEFINITION, but if you are
174      invoking the preprocessor from a shell or shell-like program you
175      may need to use the shell's quoting syntax to protect characters
176      such as spaces that have a meaning in the shell syntax.  If you
177      use more than one `-D' for the same NAME, the rightmost definition
178      takes effect.
179
180 `-U NAME'
181      Do not predefine NAME.  If both `-U' and `-D' are specified for
182      one name, the `-U' beats the `-D' and the name is not predefined.
183
184 `-undef'
185      Do not predefine any nonstandard macros.
186
187 `-A PREDICATE(ANSWER)'
188      Make an assertion with the predicate PREDICATE and answer ANSWER.
189      *Note Assertions::.
190
191      You can use `-A-' to disable all predefined assertions; it also
192      undefines all predefined macros that identify the type of target
193      system.
194
195 `-dM'
196      Instead of outputting the result of preprocessing, output a list of
197      `#define' directives for all the macros defined during the
198      execution of the preprocessor, including predefined macros.  This
199      gives you a way of finding out what is predefined in your version
200      of the preprocessor; assuming you have no file `foo.h', the command
201
202           touch foo.h; cpp -dM foo.h
203
204      will show the values of any predefined macros.
205
206 `-dD'
207      Like `-dM' except in two respects: it does *not* include the
208      predefined macros, and it outputs *both* the `#define' directives
209      and the result of preprocessing.  Both kinds of output go to the
210      standard output file.
211
212 `-dI'
213      Output `#include' directives in addition to the result of
214      preprocessing.
215
216 `-M [-MG]'
217      Instead of outputting the result of preprocessing, output a rule
218      suitable for `make' describing the dependencies of the main source
219      file.  The preprocessor outputs one `make' rule containing the
220      object file name for that source file, a colon, and the names of
221      all the included files.  If there are many included files then the
222      rule is split into several lines using `\'-newline.
223
224      `-MG' says to treat missing header files as generated files and
225      assume they live in the same directory as the source file.  It
226      must be specified in addition to `-M'.
227
228      This feature is used in automatic updating of makefiles.
229
230 `-MM [-MG]'
231      Like `-M' but mention only the files included with `#include
232      "FILE"'.  System header files included with `#include <FILE>' are
233      omitted.
234
235 `-MD FILE'
236      Like `-M' but the dependency information is written to FILE.  This
237      is in addition to compiling the file as specified--`-MD' does not
238      inhibit ordinary compilation the way `-M' does.
239
240      When invoking gcc, do not specify the FILE argument.  Gcc will
241      create file names made by replacing ".c" with ".d" at the end of
242      the input file names.
243
244      In Mach, you can use the utility `md' to merge multiple dependency
245      files into a single dependency file suitable for using with the
246      `make' command.
247
248 `-MMD FILE'
249      Like `-MD' except mention only user header files, not system
250      header files.
251
252 `-H'
253      Print the name of each header file used, in addition to other
254      normal activities.
255
256 `-imacros FILE'
257      Process FILE as input, discarding the resulting output, before
258      processing the regular input file.  Because the output generated
259      from FILE is discarded, the only effect of `-imacros FILE' is to
260      make the macros defined in FILE available for use in the main
261      input.
262
263 `-include FILE'
264      Process FILE as input, and include all the resulting output,
265      before processing the regular input file.
266
267 `-idirafter DIR'
268      Add the directory DIR to the second include path.  The directories
269      on the second include path are searched when a header file is not
270      found in any of the directories in the main include path (the one
271      that `-I' adds to).
272
273 `-iprefix PREFIX'
274      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
275
276 `-iwithprefix DIR'
277      Add a directory to the second include path.  The directory's name
278      is made by concatenating PREFIX and DIR, where PREFIX was
279      specified previously with `-iprefix'.
280
281 `-isystem DIR'
282      Add a directory to the beginning of the second include path,
283      marking it as a system directory, so that it gets the same special
284      treatment as is applied to the standard system directories.
285
286 `-lang-c'
287 `-lang-c89'
288 `-lang-c++'
289 `-lang-objc'
290 `-lang-objc++'
291      Specify the source language.  `-lang-c' is the default; it allows
292      recognition of C++ comments (comments that begin with `//' and end
293      at end of line) and hexadecimal floating-point constants, since
294      these features will most likely appear in the next C standard.
295      `-lang-c89' disables recognition of C++ comments and hexadecimal
296      floating-point constants.  `-lang-c++' handles C++ comment syntax
297      and includes extra default include directories for C++.
298      `-lang-objc' enables the Objective C `#import' directive.
299      `-lang-objc++' enables both C++ and Objective C extensions.
300
301      These options are generated by the compiler driver `gcc', but not
302      passed from the `gcc' command line unless you use the driver's
303      `-Wp' option.
304
305 `-lint'
306      Look for commands to the program checker `lint' embedded in
307      comments, and emit them preceded by `#pragma lint'.  For example,
308      the comment `/* NOTREACHED */' becomes `#pragma lint NOTREACHED'.
309
310      This option is available only when you call `cpp' directly; `gcc'
311      will not pass it from its command line.
312
313 `-$'
314      Forbid the use of `$' in identifiers.  This was formerly required
315      for strict conformance to the C Standard before the standard was
316      corrected.
317
318      This option is available only when you call `cpp' directly; `gcc'
319      will not pass it from its command line.
320
321 \1f
322 File: cpp.info,  Node: Concept Index,  Next: Index,  Prev: Invocation,  Up: Top
323
324 Concept Index
325 *************
326
327 * Menu:
328
329 * ##:                                    Concatenation.
330 * arguments in macro definitions:        Argument Macros.
331 * assertions:                            Assertions.
332 * assertions, undoing:                   Assertions.
333 * blank macro arguments:                 Argument Macros.
334 * cascaded macros:                       Cascaded Macros.
335 * commenting out code:                   Deleted Code.
336 * computed #include:                     Include Syntax.
337 * concatenation:                         Concatenation.
338 * conditionals:                          Conditionals.
339 * directives:                            Directives.
340 * expansion of arguments:                Argument Prescan.
341 * function-like macro:                   Argument Macros.
342 * header file:                           Header Files.
343 * including just once:                   Once-Only.
344 * inheritance:                           Inheritance.
345 * invocation of the preprocessor:        Invocation.
346 * line control:                          Combining Sources.
347 * macro argument expansion:              Argument Prescan.
348 * macro body uses macro:                 Cascaded Macros.
349 * macros with argument:                  Argument Macros.
350 * manifest constant:                     Simple Macros.
351 * newlines in macro arguments:           Newlines in Args.
352 * null directive:                        Other Directives.
353 * options:                               Invocation.
354 * output format:                         Output.
355 * overriding a header file:              Inheritance.
356 * parentheses in macro bodies:           Macro Parentheses.
357 * pitfalls of macros:                    Macro Pitfalls.
358 * predefined macros:                     Predefined.
359 * predicates:                            Assertions.
360 * preprocessing directives:              Directives.
361 * prescan of macro arguments:            Argument Prescan.
362 * problems with macros:                  Macro Pitfalls.
363 * redefining macros:                     Redefining.
364 * repeated inclusion:                    Once-Only.
365 * retracting assertions:                 Assertions.
366 * second include path:                   Invocation.
367 * self-reference:                        Self-Reference.
368 * semicolons (after macro calls):        Swallow Semicolon.
369 * side effects (in macro arguments):     Side Effects.
370 * simple macro:                          Simple Macros.
371 * space as macro argument:               Argument Macros.
372 * standard predefined macros:            Standard Predefined.
373 * stringification:                       Stringification.
374 * testing predicates:                    Assertions.
375 * unassert:                              Assertions.
376 * undefining macros:                     Undefining.
377 * unsafe macros:                         Side Effects.
378
379 \1f
380 File: cpp.info,  Node: Index,  Prev: Concept Index,  Up: Top
381
382 Index of Directives, Macros and Options
383 ***************************************
384
385 * Menu:
386
387 * #assert:                               Assertions.
388 * #cpu:                                  Assertions.
389 * #define:                               Argument Macros.
390 * #elif:                                 #elif Directive.
391 * #else:                                 #else Directive.
392 * #error:                                #error Directive.
393 * #ident:                                Other Directives.
394 * #if:                                   Conditional Syntax.
395 * #ifdef:                                Conditionals-Macros.
396 * #ifndef:                               Conditionals-Macros.
397 * #import:                               Once-Only.
398 * #include:                              Include Syntax.
399 * #include_next:                         Inheritance.
400 * #line:                                 Combining Sources.
401 * #machine:                              Assertions.
402 * #pragma:                               Other Directives.
403 * #pragma once:                          Once-Only.
404 * #system:                               Assertions.
405 * #unassert:                             Assertions.
406 * #warning:                              #error Directive.
407 * -$:                                    Invocation.
408 * -A:                                    Invocation.
409 * -C:                                    Invocation.
410 * -D:                                    Invocation.
411 * -dD:                                   Invocation.
412 * -dI:                                   Invocation.
413 * -dM:                                   Invocation.
414 * -H:                                    Invocation.
415 * -I:                                    Invocation.
416 * -idirafter:                            Invocation.
417 * -imacros:                              Invocation.
418 * -include:                              Invocation.
419 * -iprefix:                              Invocation.
420 * -isystem:                              Invocation.
421 * -iwithprefix:                          Invocation.
422 * -lang-c:                               Invocation.
423 * -lang-c++:                             Invocation.
424 * -lang-c89:                             Invocation.
425 * -lang-objc:                            Invocation.
426 * -lang-objc++:                          Invocation.
427 * -M:                                    Invocation.
428 * -MD:                                   Invocation.
429 * -MM:                                   Invocation.
430 * -MMD:                                  Invocation.
431 * -nostdinc:                             Invocation.
432 * -nostdinc++:                           Invocation.
433 * -P:                                    Invocation.
434 * -pedantic:                             Invocation.
435 * -pedantic-errors:                      Invocation.
436 * -traditional:                          Invocation.
437 * -trigraphs:                            Invocation.
438 * -U:                                    Invocation.
439 * -undef:                                Invocation.
440 * -Wall:                                 Invocation.
441 * -Wcomment:                             Invocation.
442 * -Wtraditional:                         Invocation.
443 * -Wtrigraphs:                           Invocation.
444 * -Wundef:                               Invocation.
445 * __BASE_FILE__:                         Standard Predefined.
446 * __CHAR_UNSIGNED__:                     Standard Predefined.
447 * __cplusplus:                           Standard Predefined.
448 * __DATE__:                              Standard Predefined.
449 * __FILE__:                              Standard Predefined.
450 * __GNUC__:                              Standard Predefined.
451 * __GNUC_MINOR__:                        Standard Predefined.
452 * __GNUG__:                              Standard Predefined.
453 * __INCLUDE_LEVEL_:                      Standard Predefined.
454 * __LINE__:                              Standard Predefined.
455 * __OPTIMIZE__:                          Standard Predefined.
456 * __REGISTER_PREFIX__:                   Standard Predefined.
457 * __STDC__:                              Standard Predefined.
458 * __STDC_VERSION__:                      Standard Predefined.
459 * __STRICT_ANSI__:                       Standard Predefined.
460 * __TIME__:                              Standard Predefined.
461 * __USER_LABEL_PREFIX__:                 Standard Predefined.
462 * __VERSION__:                           Standard Predefined.
463 * _AM29000:                              Nonstandard Predefined.
464 * _AM29K:                                Nonstandard Predefined.
465 * BSD:                                   Nonstandard Predefined.
466 * defined:                               Conditionals-Macros.
467 * M68020:                                Nonstandard Predefined.
468 * m68k:                                  Nonstandard Predefined.
469 * mc68000:                               Nonstandard Predefined.
470 * ns32000:                               Nonstandard Predefined.
471 * pyr:                                   Nonstandard Predefined.
472 * sequent:                               Nonstandard Predefined.
473 * sun:                                   Nonstandard Predefined.
474 * system header files:                   Header Uses.
475 * unix:                                  Nonstandard Predefined.
476 * vax:                                   Nonstandard Predefined.
477
478