OSDN Git Service

am 71c7683a: Merge change 4893 into donut
[android-x86/prebuilt.git] / darwin-x86 / toolchain / arm-eabi-4.4.0 / info / cpp.info
1 This is doc/cpp.info, produced by makeinfo version 4.8 from
2 ../../../toolchain/android-toolchain/gcc-4.4.0/gcc/doc/cpp.texi.
3
4    Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
5 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
6 Software Foundation, Inc.
7
8    Permission is granted to copy, distribute and/or modify this document
9 under the terms of the GNU Free Documentation License, Version 1.2 or
10 any later version published by the Free Software Foundation.  A copy of
11 the license is included in the section entitled "GNU Free Documentation
12 License".
13
14    This manual contains no Invariant Sections.  The Front-Cover Texts
15 are (a) (see below), and the Back-Cover Texts are (b) (see below).
16
17    (a) The FSF's Front-Cover Text is:
18
19    A GNU Manual
20
21    (b) The FSF's Back-Cover Text is:
22
23    You have freedom to copy and modify this GNU Manual, like GNU
24 software.  Copies published by the Free Software Foundation raise
25 funds for GNU development.
26
27 INFO-DIR-SECTION Software development
28 START-INFO-DIR-ENTRY
29 * Cpp: (cpp).                  The GNU C preprocessor.
30 END-INFO-DIR-ENTRY
31
32 \1f
33 File: cpp.info,  Node: Top,  Next: Overview,  Up: (dir)
34
35 The C Preprocessor
36 ******************
37
38 The C preprocessor implements the macro language used to transform C,
39 C++, and Objective-C programs before they are compiled.  It can also be
40 useful on its own.
41
42 * Menu:
43
44 * Overview::
45 * Header Files::
46 * Macros::
47 * Conditionals::
48 * Diagnostics::
49 * Line Control::
50 * Pragmas::
51 * Other Directives::
52 * Preprocessor Output::
53 * Traditional Mode::
54 * Implementation Details::
55 * Invocation::
56 * Environment Variables::
57 * GNU Free Documentation License::
58 * Index of Directives::
59 * Option Index::
60 * Concept Index::
61
62  --- The Detailed Node Listing ---
63
64 Overview
65
66 * Character sets::
67 * Initial processing::
68 * Tokenization::
69 * The preprocessing language::
70
71 Header Files
72
73 * Include Syntax::
74 * Include Operation::
75 * Search Path::
76 * Once-Only Headers::
77 * Alternatives to Wrapper #ifndef::
78 * Computed Includes::
79 * Wrapper Headers::
80 * System Headers::
81
82 Macros
83
84 * Object-like Macros::
85 * Function-like Macros::
86 * Macro Arguments::
87 * Stringification::
88 * Concatenation::
89 * Variadic Macros::
90 * Predefined Macros::
91 * Undefining and Redefining Macros::
92 * Directives Within Macro Arguments::
93 * Macro Pitfalls::
94
95 Predefined Macros
96
97 * Standard Predefined Macros::
98 * Common Predefined Macros::
99 * System-specific Predefined Macros::
100 * C++ Named Operators::
101
102 Macro Pitfalls
103
104 * Misnesting::
105 * Operator Precedence Problems::
106 * Swallowing the Semicolon::
107 * Duplication of Side Effects::
108 * Self-Referential Macros::
109 * Argument Prescan::
110 * Newlines in Arguments::
111
112 Conditionals
113
114 * Conditional Uses::
115 * Conditional Syntax::
116 * Deleted Code::
117
118 Conditional Syntax
119
120 * Ifdef::
121 * If::
122 * Defined::
123 * Else::
124 * Elif::
125
126 Implementation Details
127
128 * Implementation-defined behavior::
129 * Implementation limits::
130 * Obsolete Features::
131 * Differences from previous versions::
132
133 Obsolete Features
134
135 * Obsolete Features::
136
137    Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
138 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
139 Software Foundation, Inc.
140
141    Permission is granted to copy, distribute and/or modify this document
142 under the terms of the GNU Free Documentation License, Version 1.2 or
143 any later version published by the Free Software Foundation.  A copy of
144 the license is included in the section entitled "GNU Free Documentation
145 License".
146
147    This manual contains no Invariant Sections.  The Front-Cover Texts
148 are (a) (see below), and the Back-Cover Texts are (b) (see below).
149
150    (a) The FSF's Front-Cover Text is:
151
152    A GNU Manual
153
154    (b) The FSF's Back-Cover Text is:
155
156    You have freedom to copy and modify this GNU Manual, like GNU
157 software.  Copies published by the Free Software Foundation raise
158 funds for GNU development.
159
160 \1f
161 File: cpp.info,  Node: Overview,  Next: Header Files,  Prev: Top,  Up: Top
162
163 1 Overview
164 **********
165
166 The C preprocessor, often known as "cpp", is a "macro processor" that
167 is used automatically by the C compiler to transform your program
168 before compilation.  It is called a macro processor because it allows
169 you to define "macros", which are brief abbreviations for longer
170 constructs.
171
172    The C preprocessor is intended to be used only with C, C++, and
173 Objective-C source code.  In the past, it has been abused as a general
174 text processor.  It will choke on input which does not obey C's lexical
175 rules.  For example, apostrophes will be interpreted as the beginning of
176 character constants, and cause errors.  Also, you cannot rely on it
177 preserving characteristics of the input which are not significant to
178 C-family languages.  If a Makefile is preprocessed, all the hard tabs
179 will be removed, and the Makefile will not work.
180
181    Having said that, you can often get away with using cpp on things
182 which are not C.  Other Algol-ish programming languages are often safe
183 (Pascal, Ada, etc.) So is assembly, with caution.  `-traditional-cpp'
184 mode preserves more white space, and is otherwise more permissive.  Many
185 of the problems can be avoided by writing C or C++ style comments
186 instead of native language comments, and keeping macros simple.
187
188    Wherever possible, you should use a preprocessor geared to the
189 language you are writing in.  Modern versions of the GNU assembler have
190 macro facilities.  Most high level programming languages have their own
191 conditional compilation and inclusion mechanism.  If all else fails,
192 try a true general text processor, such as GNU M4.
193
194    C preprocessors vary in some details.  This manual discusses the GNU
195 C preprocessor, which provides a small superset of the features of ISO
196 Standard C.  In its default mode, the GNU C preprocessor does not do a
197 few things required by the standard.  These are features which are
198 rarely, if ever, used, and may cause surprising changes to the meaning
199 of a program which does not expect them.  To get strict ISO Standard C,
200 you should use the `-std=c89' or `-std=c99' options, depending on which
201 version of the standard you want.  To get all the mandatory
202 diagnostics, you must also use `-pedantic'.  *Note Invocation::.
203
204    This manual describes the behavior of the ISO preprocessor.  To
205 minimize gratuitous differences, where the ISO preprocessor's behavior
206 does not conflict with traditional semantics, the traditional
207 preprocessor should behave the same way.  The various differences that
208 do exist are detailed in the section *Note Traditional Mode::.
209
210    For clarity, unless noted otherwise, references to `CPP' in this
211 manual refer to GNU CPP.
212
213 * Menu:
214
215 * Character sets::
216 * Initial processing::
217 * Tokenization::
218 * The preprocessing language::
219
220 \1f
221 File: cpp.info,  Node: Character sets,  Next: Initial processing,  Up: Overview
222
223 1.1 Character sets
224 ==================
225
226 Source code character set processing in C and related languages is
227 rather complicated.  The C standard discusses two character sets, but
228 there are really at least four.
229
230    The files input to CPP might be in any character set at all.  CPP's
231 very first action, before it even looks for line boundaries, is to
232 convert the file into the character set it uses for internal
233 processing.  That set is what the C standard calls the "source"
234 character set.  It must be isomorphic with ISO 10646, also known as
235 Unicode.  CPP uses the UTF-8 encoding of Unicode.
236
237    The character sets of the input files are specified using the
238 `-finput-charset=' option.
239
240    All preprocessing work (the subject of the rest of this manual) is
241 carried out in the source character set.  If you request textual output
242 from the preprocessor with the `-E' option, it will be in UTF-8.
243
244    After preprocessing is complete, string and character constants are
245 converted again, into the "execution" character set.  This character
246 set is under control of the user; the default is UTF-8, matching the
247 source character set.  Wide string and character constants have their
248 own character set, which is not called out specifically in the
249 standard.  Again, it is under control of the user.  The default is
250 UTF-16 or UTF-32, whichever fits in the target's `wchar_t' type, in the
251 target machine's byte order.(1)  Octal and hexadecimal escape sequences
252 do not undergo conversion; '\x12' has the value 0x12 regardless of the
253 currently selected execution character set.  All other escapes are
254 replaced by the character in the source character set that they
255 represent, then converted to the execution character set, just like
256 unescaped characters.
257
258    Unless the experimental `-fextended-identifiers' option is used, GCC
259 does not permit the use of characters outside the ASCII range, nor `\u'
260 and `\U' escapes, in identifiers.  Even with that option, characters
261 outside the ASCII range can only be specified with the `\u' and `\U'
262 escapes, not used directly in identifiers.
263
264    ---------- Footnotes ----------
265
266    (1) UTF-16 does not meet the requirements of the C standard for a
267 wide character set, but the choice of 16-bit `wchar_t' is enshrined in
268 some system ABIs so we cannot fix this.
269
270 \1f
271 File: cpp.info,  Node: Initial processing,  Next: Tokenization,  Prev: Character sets,  Up: Overview
272
273 1.2 Initial processing
274 ======================
275
276 The preprocessor performs a series of textual transformations on its
277 input.  These happen before all other processing.  Conceptually, they
278 happen in a rigid order, and the entire file is run through each
279 transformation before the next one begins.  CPP actually does them all
280 at once, for performance reasons.  These transformations correspond
281 roughly to the first three "phases of translation" described in the C
282 standard.
283
284   1. The input file is read into memory and broken into lines.
285
286      Different systems use different conventions to indicate the end of
287      a line.  GCC accepts the ASCII control sequences `LF', `CR LF' and
288      `CR' as end-of-line markers.  These are the canonical sequences
289      used by Unix, DOS and VMS, and the classic Mac OS (before OSX)
290      respectively.  You may therefore safely copy source code written
291      on any of those systems to a different one and use it without
292      conversion.  (GCC may lose track of the current line number if a
293      file doesn't consistently use one convention, as sometimes happens
294      when it is edited on computers with different conventions that
295      share a network file system.)
296
297      If the last line of any input file lacks an end-of-line marker,
298      the end of the file is considered to implicitly supply one.  The C
299      standard says that this condition provokes undefined behavior, so
300      GCC will emit a warning message.
301
302   2. If trigraphs are enabled, they are replaced by their corresponding
303      single characters.  By default GCC ignores trigraphs, but if you
304      request a strictly conforming mode with the `-std' option, or you
305      specify the `-trigraphs' option, then it converts them.
306
307      These are nine three-character sequences, all starting with `??',
308      that are defined by ISO C to stand for single characters.  They
309      permit obsolete systems that lack some of C's punctuation to use
310      C.  For example, `??/' stands for `\', so '??/n' is a character
311      constant for a newline.
312
313      Trigraphs are not popular and many compilers implement them
314      incorrectly.  Portable code should not rely on trigraphs being
315      either converted or ignored.  With `-Wtrigraphs' GCC will warn you
316      when a trigraph may change the meaning of your program if it were
317      converted.  *Note Wtrigraphs::.
318
319      In a string constant, you can prevent a sequence of question marks
320      from being confused with a trigraph by inserting a backslash
321      between the question marks, or by separating the string literal at
322      the trigraph and making use of string literal concatenation.
323      "(??\?)"  is the string `(???)', not `(?]'.  Traditional C
324      compilers do not recognize these idioms.
325
326      The nine trigraphs and their replacements are
327
328           Trigraph:       ??(  ??)  ??<  ??>  ??=  ??/  ??'  ??!  ??-
329           Replacement:      [    ]    {    }    #    \    ^    |    ~
330
331   3. Continued lines are merged into one long line.
332
333      A continued line is a line which ends with a backslash, `\'.  The
334      backslash is removed and the following line is joined with the
335      current one.  No space is inserted, so you may split a line
336      anywhere, even in the middle of a word.  (It is generally more
337      readable to split lines only at white space.)
338
339      The trailing backslash on a continued line is commonly referred to
340      as a "backslash-newline".
341
342      If there is white space between a backslash and the end of a line,
343      that is still a continued line.  However, as this is usually the
344      result of an editing mistake, and many compilers will not accept
345      it as a continued line, GCC will warn you about it.
346
347   4. All comments are replaced with single spaces.
348
349      There are two kinds of comments.  "Block comments" begin with `/*'
350      and continue until the next `*/'.  Block comments do not nest:
351
352           /* this is /* one comment */ text outside comment
353
354      "Line comments" begin with `//' and continue to the end of the
355      current line.  Line comments do not nest either, but it does not
356      matter, because they would end in the same place anyway.
357
358           // this is // one comment
359           text outside comment
360
361    It is safe to put line comments inside block comments, or vice versa.
362
363      /* block comment
364         // contains line comment
365         yet more comment
366       */ outside comment
367
368      // line comment /* contains block comment */
369
370    But beware of commenting out one end of a block comment with a line
371 comment.
372
373       // l.c.  /* block comment begins
374          oops! this isn't a comment anymore */
375
376    Comments are not recognized within string literals.  "/* blah */" is
377 the string constant `/* blah */', not an empty string.
378
379    Line comments are not in the 1989 edition of the C standard, but they
380 are recognized by GCC as an extension.  In C++ and in the 1999 edition
381 of the C standard, they are an official part of the language.
382
383    Since these transformations happen before all other processing, you
384 can split a line mechanically with backslash-newline anywhere.  You can
385 comment out the end of a line.  You can continue a line comment onto the
386 next line with backslash-newline.  You can even split `/*', `*/', and
387 `//' onto multiple lines with backslash-newline.  For example:
388
389      /\
390      *
391      */ # /*
392      */ defi\
393      ne FO\
394      O 10\
395      20
396
397 is equivalent to `#define FOO 1020'.  All these tricks are extremely
398 confusing and should not be used in code intended to be readable.
399
400    There is no way to prevent a backslash at the end of a line from
401 being interpreted as a backslash-newline.  This cannot affect any
402 correct program, however.
403
404 \1f
405 File: cpp.info,  Node: Tokenization,  Next: The preprocessing language,  Prev: Initial processing,  Up: Overview
406
407 1.3 Tokenization
408 ================
409
410 After the textual transformations are finished, the input file is
411 converted into a sequence of "preprocessing tokens".  These mostly
412 correspond to the syntactic tokens used by the C compiler, but there are
413 a few differences.  White space separates tokens; it is not itself a
414 token of any kind.  Tokens do not have to be separated by white space,
415 but it is often necessary to avoid ambiguities.
416
417    When faced with a sequence of characters that has more than one
418 possible tokenization, the preprocessor is greedy.  It always makes
419 each token, starting from the left, as big as possible before moving on
420 to the next token.  For instance, `a+++++b' is interpreted as
421 `a ++ ++ + b', not as `a ++ + ++ b', even though the latter
422 tokenization could be part of a valid C program and the former could
423 not.
424
425    Once the input file is broken into tokens, the token boundaries never
426 change, except when the `##' preprocessing operator is used to paste
427 tokens together.  *Note Concatenation::.  For example,
428
429      #define foo() bar
430      foo()baz
431           ==> bar baz
432      _not_
433           ==> barbaz
434
435    The compiler does not re-tokenize the preprocessor's output.  Each
436 preprocessing token becomes one compiler token.
437
438    Preprocessing tokens fall into five broad classes: identifiers,
439 preprocessing numbers, string literals, punctuators, and other.  An
440 "identifier" is the same as an identifier in C: any sequence of
441 letters, digits, or underscores, which begins with a letter or
442 underscore.  Keywords of C have no significance to the preprocessor;
443 they are ordinary identifiers.  You can define a macro whose name is a
444 keyword, for instance.  The only identifier which can be considered a
445 preprocessing keyword is `defined'.  *Note Defined::.
446
447    This is mostly true of other languages which use the C preprocessor.
448 However, a few of the keywords of C++ are significant even in the
449 preprocessor.  *Note C++ Named Operators::.
450
451    In the 1999 C standard, identifiers may contain letters which are not
452 part of the "basic source character set", at the implementation's
453 discretion (such as accented Latin letters, Greek letters, or Chinese
454 ideograms).  This may be done with an extended character set, or the
455 `\u' and `\U' escape sequences.  The implementation of this feature in
456 GCC is experimental; such characters are only accepted in the `\u' and
457 `\U' forms and only if `-fextended-identifiers' is used.
458
459    As an extension, GCC treats `$' as a letter.  This is for
460 compatibility with some systems, such as VMS, where `$' is commonly
461 used in system-defined function and object names.  `$' is not a letter
462 in strictly conforming mode, or if you specify the `-$' option.  *Note
463 Invocation::.
464
465    A "preprocessing number" has a rather bizarre definition.  The
466 category includes all the normal integer and floating point constants
467 one expects of C, but also a number of other things one might not
468 initially recognize as a number.  Formally, preprocessing numbers begin
469 with an optional period, a required decimal digit, and then continue
470 with any sequence of letters, digits, underscores, periods, and
471 exponents.  Exponents are the two-character sequences `e+', `e-', `E+',
472 `E-', `p+', `p-', `P+', and `P-'.  (The exponents that begin with `p'
473 or `P' are new to C99.  They are used for hexadecimal floating-point
474 constants.)
475
476    The purpose of this unusual definition is to isolate the preprocessor
477 from the full complexity of numeric constants.  It does not have to
478 distinguish between lexically valid and invalid floating-point numbers,
479 which is complicated.  The definition also permits you to split an
480 identifier at any position and get exactly two tokens, which can then be
481 pasted back together with the `##' operator.
482
483    It's possible for preprocessing numbers to cause programs to be
484 misinterpreted.  For example, `0xE+12' is a preprocessing number which
485 does not translate to any valid numeric constant, therefore a syntax
486 error.  It does not mean `0xE + 12', which is what you might have
487 intended.
488
489    "String literals" are string constants, character constants, and
490 header file names (the argument of `#include').(1)  String constants
491 and character constants are straightforward: "..." or '...'.  In either
492 case embedded quotes should be escaped with a backslash: '\'' is the
493 character constant for `''.  There is no limit on the length of a
494 character constant, but the value of a character constant that contains
495 more than one character is implementation-defined.  *Note
496 Implementation Details::.
497
498    Header file names either look like string constants, "...", or are
499 written with angle brackets instead, <...>.  In either case, backslash
500 is an ordinary character.  There is no way to escape the closing quote
501 or angle bracket.  The preprocessor looks for the header file in
502 different places depending on which form you use.  *Note Include
503 Operation::.
504
505    No string literal may extend past the end of a line.  Older versions
506 of GCC accepted multi-line string constants.  You may use continued
507 lines instead, or string constant concatenation.  *Note Differences
508 from previous versions::.
509
510    "Punctuators" are all the usual bits of punctuation which are
511 meaningful to C and C++.  All but three of the punctuation characters in
512 ASCII are C punctuators.  The exceptions are `@', `$', and ``'.  In
513 addition, all the two- and three-character operators are punctuators.
514 There are also six "digraphs", which the C++ standard calls
515 "alternative tokens", which are merely alternate ways to spell other
516 punctuators.  This is a second attempt to work around missing
517 punctuation in obsolete systems.  It has no negative side effects,
518 unlike trigraphs, but does not cover as much ground.  The digraphs and
519 their corresponding normal punctuators are:
520
521      Digraph:        <%  %>  <:  :>  %:  %:%:
522      Punctuator:      {   }   [   ]   #    ##
523
524    Any other single character is considered "other".  It is passed on to
525 the preprocessor's output unmolested.  The C compiler will almost
526 certainly reject source code containing "other" tokens.  In ASCII, the
527 only other characters are `@', `$', ``', and control characters other
528 than NUL (all bits zero).  (Note that `$' is normally considered a
529 letter.)  All characters with the high bit set (numeric range
530 0x7F-0xFF) are also "other" in the present implementation.  This will
531 change when proper support for international character sets is added to
532 GCC.
533
534    NUL is a special case because of the high probability that its
535 appearance is accidental, and because it may be invisible to the user
536 (many terminals do not display NUL at all).  Within comments, NULs are
537 silently ignored, just as any other character would be.  In running
538 text, NUL is considered white space.  For example, these two directives
539 have the same meaning.
540
541      #define X^@1
542      #define X 1
543
544 (where `^@' is ASCII NUL).  Within string or character constants, NULs
545 are preserved.  In the latter two cases the preprocessor emits a
546 warning message.
547
548    ---------- Footnotes ----------
549
550    (1) The C standard uses the term "string literal" to refer only to
551 what we are calling "string constants".
552
553 \1f
554 File: cpp.info,  Node: The preprocessing language,  Prev: Tokenization,  Up: Overview
555
556 1.4 The preprocessing language
557 ==============================
558
559 After tokenization, the stream of tokens may simply be passed straight
560 to the compiler's parser.  However, if it contains any operations in the
561 "preprocessing language", it will be transformed first.  This stage
562 corresponds roughly to the standard's "translation phase 4" and is what
563 most people think of as the preprocessor's job.
564
565    The preprocessing language consists of "directives" to be executed
566 and "macros" to be expanded.  Its primary capabilities are:
567
568    * Inclusion of header files.  These are files of declarations that
569      can be substituted into your program.
570
571    * Macro expansion.  You can define "macros", which are abbreviations
572      for arbitrary fragments of C code.  The preprocessor will replace
573      the macros with their definitions throughout the program.  Some
574      macros are automatically defined for you.
575
576    * Conditional compilation.  You can include or exclude parts of the
577      program according to various conditions.
578
579    * Line control.  If you use a program to combine or rearrange source
580      files into an intermediate file which is then compiled, you can
581      use line control to inform the compiler where each source line
582      originally came from.
583
584    * Diagnostics.  You can detect problems at compile time and issue
585      errors or warnings.
586
587    There are a few more, less useful, features.
588
589    Except for expansion of predefined macros, all these operations are
590 triggered with "preprocessing directives".  Preprocessing directives
591 are lines in your program that start with `#'.  Whitespace is allowed
592 before and after the `#'.  The `#' is followed by an identifier, the
593 "directive name".  It specifies the operation to perform.  Directives
594 are commonly referred to as `#NAME' where NAME is the directive name.
595 For example, `#define' is the directive that defines a macro.
596
597    The `#' which begins a directive cannot come from a macro expansion.
598 Also, the directive name is not macro expanded.  Thus, if `foo' is
599 defined as a macro expanding to `define', that does not make `#foo' a
600 valid preprocessing directive.
601
602    The set of valid directive names is fixed.  Programs cannot define
603 new preprocessing directives.
604
605    Some directives require arguments; these make up the rest of the
606 directive line and must be separated from the directive name by
607 whitespace.  For example, `#define' must be followed by a macro name
608 and the intended expansion of the macro.
609
610    A preprocessing directive cannot cover more than one line.  The line
611 may, however, be continued with backslash-newline, or by a block comment
612 which extends past the end of the line.  In either case, when the
613 directive is processed, the continuations have already been merged with
614 the first line to make one long line.
615
616 \1f
617 File: cpp.info,  Node: Header Files,  Next: Macros,  Prev: Overview,  Up: Top
618
619 2 Header Files
620 **************
621
622 A header file is a file containing C declarations and macro definitions
623 (*note Macros::) to be shared between several source files.  You request
624 the use of a header file in your program by "including" it, with the C
625 preprocessing directive `#include'.
626
627    Header files serve two purposes.
628
629    * System header files declare the interfaces to parts of the
630      operating system.  You include them in your program to supply the
631      definitions and declarations you need to invoke system calls and
632      libraries.
633
634    * Your own header files contain declarations for interfaces between
635      the source files of your program.  Each time you have a group of
636      related declarations and macro definitions all or most of which
637      are needed in several different source files, it is a good idea to
638      create a header file for them.
639
640    Including a header file produces the same results as copying the
641 header file into each source file that needs it.  Such copying would be
642 time-consuming and error-prone.  With a header file, the related
643 declarations appear in only one place.  If they need to be changed, they
644 can be changed in one place, and programs that include the header file
645 will automatically use the new version when next recompiled.  The header
646 file eliminates the labor of finding and changing all the copies as well
647 as the risk that a failure to find one copy will result in
648 inconsistencies within a program.
649
650    In C, the usual convention is to give header files names that end
651 with `.h'.  It is most portable to use only letters, digits, dashes, and
652 underscores in header file names, and at most one dot.
653
654 * Menu:
655
656 * Include Syntax::
657 * Include Operation::
658 * Search Path::
659 * Once-Only Headers::
660 * Alternatives to Wrapper #ifndef::
661 * Computed Includes::
662 * Wrapper Headers::
663 * System Headers::
664
665 \1f
666 File: cpp.info,  Node: Include Syntax,  Next: Include Operation,  Up: Header Files
667
668 2.1 Include Syntax
669 ==================
670
671 Both user and system header files are included using the preprocessing
672 directive `#include'.  It has two variants:
673
674 `#include <FILE>'
675      This variant is used for system header files.  It searches for a
676      file named FILE in a standard list of system directories.  You can
677      prepend directories to this list with the `-I' option (*note
678      Invocation::).
679
680 `#include "FILE"'
681      This variant is used for header files of your own program.  It
682      searches for a file named FILE first in the directory containing
683      the current file, then in the quote directories and then the same
684      directories used for `<FILE>'.  You can prepend directories to the
685      list of quote directories with the `-iquote' option.
686
687    The argument of `#include', whether delimited with quote marks or
688 angle brackets, behaves like a string constant in that comments are not
689 recognized, and macro names are not expanded.  Thus, `#include <x/*y>'
690 specifies inclusion of a system header file named `x/*y'.
691
692    However, if backslashes occur within FILE, they are considered
693 ordinary text characters, not escape characters.  None of the character
694 escape sequences appropriate to string constants in C are processed.
695 Thus, `#include "x\n\\y"' specifies a filename containing three
696 backslashes.  (Some systems interpret `\' as a pathname separator.  All
697 of these also interpret `/' the same way.  It is most portable to use
698 only `/'.)
699
700    It is an error if there is anything (other than comments) on the line
701 after the file name.
702
703 \1f
704 File: cpp.info,  Node: Include Operation,  Next: Search Path,  Prev: Include Syntax,  Up: Header Files
705
706 2.2 Include Operation
707 =====================
708
709 The `#include' directive works by directing the C preprocessor to scan
710 the specified file as input before continuing with the rest of the
711 current file.  The output from the preprocessor contains the output
712 already generated, followed by the output resulting from the included
713 file, followed by the output that comes from the text after the
714 `#include' directive.  For example, if you have a header file
715 `header.h' as follows,
716
717      char *test (void);
718
719 and a main program called `program.c' that uses the header file, like
720 this,
721
722      int x;
723      #include "header.h"
724
725      int
726      main (void)
727      {
728        puts (test ());
729      }
730
731 the compiler will see the same token stream as it would if `program.c'
732 read
733
734      int x;
735      char *test (void);
736
737      int
738      main (void)
739      {
740        puts (test ());
741      }
742
743    Included files are not limited to declarations and macro definitions;
744 those are merely the typical uses.  Any fragment of a C program can be
745 included from another file.  The include file could even contain the
746 beginning of a statement that is concluded in the containing file, or
747 the end of a statement that was started in the including file.  However,
748 an included file must consist of complete tokens.  Comments and string
749 literals which have not been closed by the end of an included file are
750 invalid.  For error recovery, they are considered to end at the end of
751 the file.
752
753    To avoid confusion, it is best if header files contain only complete
754 syntactic units--function declarations or definitions, type
755 declarations, etc.
756
757    The line following the `#include' directive is always treated as a
758 separate line by the C preprocessor, even if the included file lacks a
759 final newline.
760
761 \1f
762 File: cpp.info,  Node: Search Path,  Next: Once-Only Headers,  Prev: Include Operation,  Up: Header Files
763
764 2.3 Search Path
765 ===============
766
767 GCC looks in several different places for headers.  On a normal Unix
768 system, if you do not instruct it otherwise, it will look for headers
769 requested with `#include <FILE>' in:
770
771      /usr/local/include
772      LIBDIR/gcc/TARGET/VERSION/include
773      /usr/TARGET/include
774      /usr/include
775
776    For C++ programs, it will also look in `/usr/include/g++-v3', first.
777 In the above, TARGET is the canonical name of the system GCC was
778 configured to compile code for; often but not always the same as the
779 canonical name of the system it runs on.  VERSION is the version of GCC
780 in use.
781
782    You can add to this list with the `-IDIR' command line option.  All
783 the directories named by `-I' are searched, in left-to-right order,
784 _before_ the default directories.  The only exception is when `dir' is
785 already searched by default.  In this case, the option is ignored and
786 the search order for system directories remains unchanged.
787
788    Duplicate directories are removed from the quote and bracket search
789 chains before the two chains are merged to make the final search chain.
790 Thus, it is possible for a directory to occur twice in the final search
791 chain if it was specified in both the quote and bracket chains.
792
793    You can prevent GCC from searching any of the default directories
794 with the `-nostdinc' option.  This is useful when you are compiling an
795 operating system kernel or some other program that does not use the
796 standard C library facilities, or the standard C library itself.  `-I'
797 options are not ignored as described above when `-nostdinc' is in
798 effect.
799
800    GCC looks for headers requested with `#include "FILE"' first in the
801 directory containing the current file, then in the directories as
802 specified by `-iquote' options, then in the same places it would have
803 looked for a header requested with angle brackets.  For example, if
804 `/usr/include/sys/stat.h' contains `#include "types.h"', GCC looks for
805 `types.h' first in `/usr/include/sys', then in its usual search path.
806
807    `#line' (*note Line Control::) does not change GCC's idea of the
808 directory containing the current file.
809
810    You may put `-I-' at any point in your list of `-I' options.  This
811 has two effects.  First, directories appearing before the `-I-' in the
812 list are searched only for headers requested with quote marks.
813 Directories after `-I-' are searched for all headers.  Second, the
814 directory containing the current file is not searched for anything,
815 unless it happens to be one of the directories named by an `-I' switch.
816 `-I-' is deprecated, `-iquote' should be used instead.
817
818    `-I. -I-' is not the same as no `-I' options at all, and does not
819 cause the same behavior for `<>' includes that `""' includes get with
820 no special options.  `-I.' searches the compiler's current working
821 directory for header files.  That may or may not be the same as the
822 directory containing the current file.
823
824    If you need to look for headers in a directory named `-', write
825 `-I./-'.
826
827    There are several more ways to adjust the header search path.  They
828 are generally less useful.  *Note Invocation::.
829
830 \1f
831 File: cpp.info,  Node: Once-Only Headers,  Next: Alternatives to Wrapper #ifndef,  Prev: Search Path,  Up: Header Files
832
833 2.4 Once-Only Headers
834 =====================
835
836 If a header file happens to be included twice, the compiler will process
837 its contents twice.  This is very likely to cause an error, e.g. when
838 the compiler sees the same structure definition twice.  Even if it does
839 not, it will certainly waste time.
840
841    The standard way to prevent this is to enclose the entire real
842 contents of the file in a conditional, like this:
843
844      /* File foo.  */
845      #ifndef FILE_FOO_SEEN
846      #define FILE_FOO_SEEN
847
848      THE ENTIRE FILE
849
850      #endif /* !FILE_FOO_SEEN */
851
852    This construct is commonly known as a "wrapper #ifndef".  When the
853 header is included again, the conditional will be false, because
854 `FILE_FOO_SEEN' is defined.  The preprocessor will skip over the entire
855 contents of the file, and the compiler will not see it twice.
856
857    CPP optimizes even further.  It remembers when a header file has a
858 wrapper `#ifndef'.  If a subsequent `#include' specifies that header,
859 and the macro in the `#ifndef' is still defined, it does not bother to
860 rescan the file at all.
861
862    You can put comments outside the wrapper.  They will not interfere
863 with this optimization.
864
865    The macro `FILE_FOO_SEEN' is called the "controlling macro" or
866 "guard macro".  In a user header file, the macro name should not begin
867 with `_'.  In a system header file, it should begin with `__' to avoid
868 conflicts with user programs.  In any kind of header file, the macro
869 name should contain the name of the file and some additional text, to
870 avoid conflicts with other header files.
871
872 \1f
873 File: cpp.info,  Node: Alternatives to Wrapper #ifndef,  Next: Computed Includes,  Prev: Once-Only Headers,  Up: Header Files
874
875 2.5 Alternatives to Wrapper #ifndef
876 ===================================
877
878 CPP supports two more ways of indicating that a header file should be
879 read only once.  Neither one is as portable as a wrapper `#ifndef' and
880 we recommend you do not use them in new programs, with the caveat that
881 `#import' is standard practice in Objective-C.
882
883    CPP supports a variant of `#include' called `#import' which includes
884 a file, but does so at most once.  If you use `#import' instead of
885 `#include', then you don't need the conditionals inside the header file
886 to prevent multiple inclusion of the contents.  `#import' is standard
887 in Objective-C, but is considered a deprecated extension in C and C++.
888
889    `#import' is not a well designed feature.  It requires the users of
890 a header file to know that it should only be included once.  It is much
891 better for the header file's implementor to write the file so that users
892 don't need to know this.  Using a wrapper `#ifndef' accomplishes this
893 goal.
894
895    In the present implementation, a single use of `#import' will
896 prevent the file from ever being read again, by either `#import' or
897 `#include'.  You should not rely on this; do not use both `#import' and
898 `#include' to refer to the same header file.
899
900    Another way to prevent a header file from being included more than
901 once is with the `#pragma once' directive.  If `#pragma once' is seen
902 when scanning a header file, that file will never be read again, no
903 matter what.
904
905    `#pragma once' does not have the problems that `#import' does, but
906 it is not recognized by all preprocessors, so you cannot rely on it in
907 a portable program.
908
909 \1f
910 File: cpp.info,  Node: Computed Includes,  Next: Wrapper Headers,  Prev: Alternatives to Wrapper #ifndef,  Up: Header Files
911
912 2.6 Computed Includes
913 =====================
914
915 Sometimes it is necessary to select one of several different header
916 files to be included into your program.  They might specify
917 configuration parameters to be used on different sorts of operating
918 systems, for instance.  You could do this with a series of conditionals,
919
920      #if SYSTEM_1
921      # include "system_1.h"
922      #elif SYSTEM_2
923      # include "system_2.h"
924      #elif SYSTEM_3
925      ...
926      #endif
927
928    That rapidly becomes tedious.  Instead, the preprocessor offers the
929 ability to use a macro for the header name.  This is called a "computed
930 include".  Instead of writing a header name as the direct argument of
931 `#include', you simply put a macro name there instead:
932
933      #define SYSTEM_H "system_1.h"
934      ...
935      #include SYSTEM_H
936
937 `SYSTEM_H' will be expanded, and the preprocessor will look for
938 `system_1.h' as if the `#include' had been written that way originally.
939 `SYSTEM_H' could be defined by your Makefile with a `-D' option.
940
941    You must be careful when you define the macro.  `#define' saves
942 tokens, not text.  The preprocessor has no way of knowing that the macro
943 will be used as the argument of `#include', so it generates ordinary
944 tokens, not a header name.  This is unlikely to cause problems if you
945 use double-quote includes, which are close enough to string constants.
946 If you use angle brackets, however, you may have trouble.
947
948    The syntax of a computed include is actually a bit more general than
949 the above.  If the first non-whitespace character after `#include' is
950 not `"' or `<', then the entire line is macro-expanded like running
951 text would be.
952
953    If the line expands to a single string constant, the contents of that
954 string constant are the file to be included.  CPP does not re-examine
955 the string for embedded quotes, but neither does it process backslash
956 escapes in the string.  Therefore
957
958      #define HEADER "a\"b"
959      #include HEADER
960
961 looks for a file named `a\"b'.  CPP searches for the file according to
962 the rules for double-quoted includes.
963
964    If the line expands to a token stream beginning with a `<' token and
965 including a `>' token, then the tokens between the `<' and the first
966 `>' are combined to form the filename to be included.  Any whitespace
967 between tokens is reduced to a single space; then any space after the
968 initial `<' is retained, but a trailing space before the closing `>' is
969 ignored.  CPP searches for the file according to the rules for
970 angle-bracket includes.
971
972    In either case, if there are any tokens on the line after the file
973 name, an error occurs and the directive is not processed.  It is also
974 an error if the result of expansion does not match either of the two
975 expected forms.
976
977    These rules are implementation-defined behavior according to the C
978 standard.  To minimize the risk of different compilers interpreting your
979 computed includes differently, we recommend you use only a single
980 object-like macro which expands to a string constant.  This will also
981 minimize confusion for people reading your program.
982
983 \1f
984 File: cpp.info,  Node: Wrapper Headers,  Next: System Headers,  Prev: Computed Includes,  Up: Header Files
985
986 2.7 Wrapper Headers
987 ===================
988
989 Sometimes it is necessary to adjust the contents of a system-provided
990 header file without editing it directly.  GCC's `fixincludes' operation
991 does this, for example.  One way to do that would be to create a new
992 header file with the same name and insert it in the search path before
993 the original header.  That works fine as long as you're willing to
994 replace the old header entirely.  But what if you want to refer to the
995 old header from the new one?
996
997    You cannot simply include the old header with `#include'.  That will
998 start from the beginning, and find your new header again.  If your
999 header is not protected from multiple inclusion (*note Once-Only
1000 Headers::), it will recurse infinitely and cause a fatal error.
1001
1002    You could include the old header with an absolute pathname:
1003      #include "/usr/include/old-header.h"
1004    This works, but is not clean; should the system headers ever move,
1005 you would have to edit the new headers to match.
1006
1007    There is no way to solve this problem within the C standard, but you
1008 can use the GNU extension `#include_next'.  It means, "Include the
1009 _next_ file with this name".  This directive works like `#include'
1010 except in searching for the specified file: it starts searching the
1011 list of header file directories _after_ the directory in which the
1012 current file was found.
1013
1014    Suppose you specify `-I /usr/local/include', and the list of
1015 directories to search also includes `/usr/include'; and suppose both
1016 directories contain `signal.h'.  Ordinary `#include <signal.h>' finds
1017 the file under `/usr/local/include'.  If that file contains
1018 `#include_next <signal.h>', it starts searching after that directory,
1019 and finds the file in `/usr/include'.
1020
1021    `#include_next' does not distinguish between `<FILE>' and `"FILE"'
1022 inclusion, nor does it check that the file you specify has the same
1023 name as the current file.  It simply looks for the file named, starting
1024 with the directory in the search path after the one where the current
1025 file was found.
1026
1027    The use of `#include_next' can lead to great confusion.  We
1028 recommend it be used only when there is no other alternative.  In
1029 particular, it should not be used in the headers belonging to a specific
1030 program; it should be used only to make global corrections along the
1031 lines of `fixincludes'.
1032
1033 \1f
1034 File: cpp.info,  Node: System Headers,  Prev: Wrapper Headers,  Up: Header Files
1035
1036 2.8 System Headers
1037 ==================
1038
1039 The header files declaring interfaces to the operating system and
1040 runtime libraries often cannot be written in strictly conforming C.
1041 Therefore, GCC gives code found in "system headers" special treatment.
1042 All warnings, other than those generated by `#warning' (*note
1043 Diagnostics::), are suppressed while GCC is processing a system header.
1044 Macros defined in a system header are immune to a few warnings
1045 wherever they are expanded.  This immunity is granted on an ad-hoc
1046 basis, when we find that a warning generates lots of false positives
1047 because of code in macros defined in system headers.
1048
1049    Normally, only the headers found in specific directories are
1050 considered system headers.  These directories are determined when GCC
1051 is compiled.  There are, however, two ways to make normal headers into
1052 system headers.
1053
1054    The `-isystem' command line option adds its argument to the list of
1055 directories to search for headers, just like `-I'.  Any headers found
1056 in that directory will be considered system headers.
1057
1058    All directories named by `-isystem' are searched _after_ all
1059 directories named by `-I', no matter what their order was on the
1060 command line.  If the same directory is named by both `-I' and
1061 `-isystem', the `-I' option is ignored.  GCC provides an informative
1062 message when this occurs if `-v' is used.
1063
1064    There is also a directive, `#pragma GCC system_header', which tells
1065 GCC to consider the rest of the current include file a system header,
1066 no matter where it was found.  Code that comes before the `#pragma' in
1067 the file will not be affected.  `#pragma GCC system_header' has no
1068 effect in the primary source file.
1069
1070    On very old systems, some of the pre-defined system header
1071 directories get even more special treatment.  GNU C++ considers code in
1072 headers found in those directories to be surrounded by an `extern "C"'
1073 block.  There is no way to request this behavior with a `#pragma', or
1074 from the command line.
1075
1076 \1f
1077 File: cpp.info,  Node: Macros,  Next: Conditionals,  Prev: Header Files,  Up: Top
1078
1079 3 Macros
1080 ********
1081
1082 A "macro" is a fragment of code which has been given a name.  Whenever
1083 the name is used, it is replaced by the contents of the macro.  There
1084 are two kinds of macros.  They differ mostly in what they look like
1085 when they are used.  "Object-like" macros resemble data objects when
1086 used, "function-like" macros resemble function calls.
1087
1088    You may define any valid identifier as a macro, even if it is a C
1089 keyword.  The preprocessor does not know anything about keywords.  This
1090 can be useful if you wish to hide a keyword such as `const' from an
1091 older compiler that does not understand it.  However, the preprocessor
1092 operator `defined' (*note Defined::) can never be defined as a macro,
1093 and C++'s named operators (*note C++ Named Operators::) cannot be
1094 macros when you are compiling C++.
1095
1096 * Menu:
1097
1098 * Object-like Macros::
1099 * Function-like Macros::
1100 * Macro Arguments::
1101 * Stringification::
1102 * Concatenation::
1103 * Variadic Macros::
1104 * Predefined Macros::
1105 * Undefining and Redefining Macros::
1106 * Directives Within Macro Arguments::
1107 * Macro Pitfalls::
1108
1109 \1f
1110 File: cpp.info,  Node: Object-like Macros,  Next: Function-like Macros,  Up: Macros
1111
1112 3.1 Object-like Macros
1113 ======================
1114
1115 An "object-like macro" is a simple identifier which will be replaced by
1116 a code fragment.  It is called object-like because it looks like a data
1117 object in code that uses it.  They are most commonly used to give
1118 symbolic names to numeric constants.
1119
1120    You create macros with the `#define' directive.  `#define' is
1121 followed by the name of the macro and then the token sequence it should
1122 be an abbreviation for, which is variously referred to as the macro's
1123 "body", "expansion" or "replacement list".  For example,
1124
1125      #define BUFFER_SIZE 1024
1126
1127 defines a macro named `BUFFER_SIZE' as an abbreviation for the token
1128 `1024'.  If somewhere after this `#define' directive there comes a C
1129 statement of the form
1130
1131      foo = (char *) malloc (BUFFER_SIZE);
1132
1133 then the C preprocessor will recognize and "expand" the macro
1134 `BUFFER_SIZE'.  The C compiler will see the same tokens as it would if
1135 you had written
1136
1137      foo = (char *) malloc (1024);
1138
1139    By convention, macro names are written in uppercase.  Programs are
1140 easier to read when it is possible to tell at a glance which names are
1141 macros.
1142
1143    The macro's body ends at the end of the `#define' line.  You may
1144 continue the definition onto multiple lines, if necessary, using
1145 backslash-newline.  When the macro is expanded, however, it will all
1146 come out on one line.  For example,
1147
1148      #define NUMBERS 1, \
1149                      2, \
1150                      3
1151      int x[] = { NUMBERS };
1152           ==> int x[] = { 1, 2, 3 };
1153
1154 The most common visible consequence of this is surprising line numbers
1155 in error messages.
1156
1157    There is no restriction on what can go in a macro body provided it
1158 decomposes into valid preprocessing tokens.  Parentheses need not
1159 balance, and the body need not resemble valid C code.  (If it does not,
1160 you may get error messages from the C compiler when you use the macro.)
1161
1162    The C preprocessor scans your program sequentially.  Macro
1163 definitions take effect at the place you write them.  Therefore, the
1164 following input to the C preprocessor
1165
1166      foo = X;
1167      #define X 4
1168      bar = X;
1169
1170 produces
1171
1172      foo = X;
1173      bar = 4;
1174
1175    When the preprocessor expands a macro name, the macro's expansion
1176 replaces the macro invocation, then the expansion is examined for more
1177 macros to expand.  For example,
1178
1179      #define TABLESIZE BUFSIZE
1180      #define BUFSIZE 1024
1181      TABLESIZE
1182           ==> BUFSIZE
1183           ==> 1024
1184
1185 `TABLESIZE' is expanded first to produce `BUFSIZE', then that macro is
1186 expanded to produce the final result, `1024'.
1187
1188    Notice that `BUFSIZE' was not defined when `TABLESIZE' was defined.
1189 The `#define' for `TABLESIZE' uses exactly the expansion you
1190 specify--in this case, `BUFSIZE'--and does not check to see whether it
1191 too contains macro names.  Only when you _use_ `TABLESIZE' is the
1192 result of its expansion scanned for more macro names.
1193
1194    This makes a difference if you change the definition of `BUFSIZE' at
1195 some point in the source file.  `TABLESIZE', defined as shown, will
1196 always expand using the definition of `BUFSIZE' that is currently in
1197 effect:
1198
1199      #define BUFSIZE 1020
1200      #define TABLESIZE BUFSIZE
1201      #undef BUFSIZE
1202      #define BUFSIZE 37
1203
1204 Now `TABLESIZE' expands (in two stages) to `37'.
1205
1206    If the expansion of a macro contains its own name, either directly or
1207 via intermediate macros, it is not expanded again when the expansion is
1208 examined for more macros.  This prevents infinite recursion.  *Note
1209 Self-Referential Macros::, for the precise details.
1210
1211 \1f
1212 File: cpp.info,  Node: Function-like Macros,  Next: Macro Arguments,  Prev: Object-like Macros,  Up: Macros
1213
1214 3.2 Function-like Macros
1215 ========================
1216
1217 You can also define macros whose use looks like a function call.  These
1218 are called "function-like macros".  To define a function-like macro,
1219 you use the same `#define' directive, but you put a pair of parentheses
1220 immediately after the macro name.  For example,
1221
1222      #define lang_init()  c_init()
1223      lang_init()
1224           ==> c_init()
1225
1226    A function-like macro is only expanded if its name appears with a
1227 pair of parentheses after it.  If you write just the name, it is left
1228 alone.  This can be useful when you have a function and a macro of the
1229 same name, and you wish to use the function sometimes.
1230
1231      extern void foo(void);
1232      #define foo() /* optimized inline version */
1233      ...
1234        foo();
1235        funcptr = foo;
1236
1237    Here the call to `foo()' will use the macro, but the function
1238 pointer will get the address of the real function.  If the macro were to
1239 be expanded, it would cause a syntax error.
1240
1241    If you put spaces between the macro name and the parentheses in the
1242 macro definition, that does not define a function-like macro, it defines
1243 an object-like macro whose expansion happens to begin with a pair of
1244 parentheses.
1245
1246      #define lang_init ()    c_init()
1247      lang_init()
1248           ==> () c_init()()
1249
1250    The first two pairs of parentheses in this expansion come from the
1251 macro.  The third is the pair that was originally after the macro
1252 invocation.  Since `lang_init' is an object-like macro, it does not
1253 consume those parentheses.
1254
1255 \1f
1256 File: cpp.info,  Node: Macro Arguments,  Next: Stringification,  Prev: Function-like Macros,  Up: Macros
1257
1258 3.3 Macro Arguments
1259 ===================
1260
1261 Function-like macros can take "arguments", just like true functions.
1262 To define a macro that uses arguments, you insert "parameters" between
1263 the pair of parentheses in the macro definition that make the macro
1264 function-like.  The parameters must be valid C identifiers, separated
1265 by commas and optionally whitespace.
1266
1267    To invoke a macro that takes arguments, you write the name of the
1268 macro followed by a list of "actual arguments" in parentheses, separated
1269 by commas.  The invocation of the macro need not be restricted to a
1270 single logical line--it can cross as many lines in the source file as
1271 you wish.  The number of arguments you give must match the number of
1272 parameters in the macro definition.  When the macro is expanded, each
1273 use of a parameter in its body is replaced by the tokens of the
1274 corresponding argument.  (You need not use all of the parameters in the
1275 macro body.)
1276
1277    As an example, here is a macro that computes the minimum of two
1278 numeric values, as it is defined in many C programs, and some uses.
1279
1280      #define min(X, Y)  ((X) < (Y) ? (X) : (Y))
1281        x = min(a, b);          ==>  x = ((a) < (b) ? (a) : (b));
1282        y = min(1, 2);          ==>  y = ((1) < (2) ? (1) : (2));
1283        z = min(a + 28, *p);    ==>  z = ((a + 28) < (*p) ? (a + 28) : (*p));
1284
1285 (In this small example you can already see several of the dangers of
1286 macro arguments.  *Note Macro Pitfalls::, for detailed explanations.)
1287
1288    Leading and trailing whitespace in each argument is dropped, and all
1289 whitespace between the tokens of an argument is reduced to a single
1290 space.  Parentheses within each argument must balance; a comma within
1291 such parentheses does not end the argument.  However, there is no
1292 requirement for square brackets or braces to balance, and they do not
1293 prevent a comma from separating arguments.  Thus,
1294
1295      macro (array[x = y, x + 1])
1296
1297 passes two arguments to `macro': `array[x = y' and `x + 1]'.  If you
1298 want to supply `array[x = y, x + 1]' as an argument, you can write it
1299 as `array[(x = y, x + 1)]', which is equivalent C code.
1300
1301    All arguments to a macro are completely macro-expanded before they
1302 are substituted into the macro body.  After substitution, the complete
1303 text is scanned again for macros to expand, including the arguments.
1304 This rule may seem strange, but it is carefully designed so you need
1305 not worry about whether any function call is actually a macro
1306 invocation.  You can run into trouble if you try to be too clever,
1307 though.  *Note Argument Prescan::, for detailed discussion.
1308
1309    For example, `min (min (a, b), c)' is first expanded to
1310
1311        min (((a) < (b) ? (a) : (b)), (c))
1312
1313 and then to
1314
1315      ((((a) < (b) ? (a) : (b))) < (c)
1316       ? (((a) < (b) ? (a) : (b)))
1317       : (c))
1318
1319 (Line breaks shown here for clarity would not actually be generated.)
1320
1321    You can leave macro arguments empty; this is not an error to the
1322 preprocessor (but many macros will then expand to invalid code).  You
1323 cannot leave out arguments entirely; if a macro takes two arguments,
1324 there must be exactly one comma at the top level of its argument list.
1325 Here are some silly examples using `min':
1326
1327      min(, b)        ==> ((   ) < (b) ? (   ) : (b))
1328      min(a, )        ==> ((a  ) < ( ) ? (a  ) : ( ))
1329      min(,)          ==> ((   ) < ( ) ? (   ) : ( ))
1330      min((,),)       ==> (((,)) < ( ) ? ((,)) : ( ))
1331
1332      min()      error--> macro "min" requires 2 arguments, but only 1 given
1333      min(,,)    error--> macro "min" passed 3 arguments, but takes just 2
1334
1335    Whitespace is not a preprocessing token, so if a macro `foo' takes
1336 one argument, `foo ()' and `foo ( )' both supply it an empty argument.
1337 Previous GNU preprocessor implementations and documentation were
1338 incorrect on this point, insisting that a function-like macro that
1339 takes a single argument be passed a space if an empty argument was
1340 required.
1341
1342    Macro parameters appearing inside string literals are not replaced by
1343 their corresponding actual arguments.
1344
1345      #define foo(x) x, "x"
1346      foo(bar)        ==> bar, "x"
1347
1348 \1f
1349 File: cpp.info,  Node: Stringification,  Next: Concatenation,  Prev: Macro Arguments,  Up: Macros
1350
1351 3.4 Stringification
1352 ===================
1353
1354 Sometimes you may want to convert a macro argument into a string
1355 constant.  Parameters are not replaced inside string constants, but you
1356 can use the `#' preprocessing operator instead.  When a macro parameter
1357 is used with a leading `#', the preprocessor replaces it with the
1358 literal text of the actual argument, converted to a string constant.
1359 Unlike normal parameter replacement, the argument is not macro-expanded
1360 first.  This is called "stringification".
1361
1362    There is no way to combine an argument with surrounding text and
1363 stringify it all together.  Instead, you can write a series of adjacent
1364 string constants and stringified arguments.  The preprocessor will
1365 replace the stringified arguments with string constants.  The C
1366 compiler will then combine all the adjacent string constants into one
1367 long string.
1368
1369    Here is an example of a macro definition that uses stringification:
1370
1371      #define WARN_IF(EXP) \
1372      do { if (EXP) \
1373              fprintf (stderr, "Warning: " #EXP "\n"); } \
1374      while (0)
1375      WARN_IF (x == 0);
1376           ==> do { if (x == 0)
1377                 fprintf (stderr, "Warning: " "x == 0" "\n"); } while (0);
1378
1379 The argument for `EXP' is substituted once, as-is, into the `if'
1380 statement, and once, stringified, into the argument to `fprintf'.  If
1381 `x' were a macro, it would be expanded in the `if' statement, but not
1382 in the string.
1383
1384    The `do' and `while (0)' are a kludge to make it possible to write
1385 `WARN_IF (ARG);', which the resemblance of `WARN_IF' to a function
1386 would make C programmers want to do; see *Note Swallowing the
1387 Semicolon::.
1388
1389    Stringification in C involves more than putting double-quote
1390 characters around the fragment.  The preprocessor backslash-escapes the
1391 quotes surrounding embedded string constants, and all backslashes
1392 within string and character constants, in order to get a valid C string
1393 constant with the proper contents.  Thus, stringifying `p = "foo\n";'
1394 results in "p = \"foo\\n\";".  However, backslashes that are not inside
1395 string or character constants are not duplicated: `\n' by itself
1396 stringifies to "\n".
1397
1398    All leading and trailing whitespace in text being stringified is
1399 ignored.  Any sequence of whitespace in the middle of the text is
1400 converted to a single space in the stringified result.  Comments are
1401 replaced by whitespace long before stringification happens, so they
1402 never appear in stringified text.
1403
1404    There is no way to convert a macro argument into a character
1405 constant.
1406
1407    If you want to stringify the result of expansion of a macro argument,
1408 you have to use two levels of macros.
1409
1410      #define xstr(s) str(s)
1411      #define str(s) #s
1412      #define foo 4
1413      str (foo)
1414           ==> "foo"
1415      xstr (foo)
1416           ==> xstr (4)
1417           ==> str (4)
1418           ==> "4"
1419
1420    `s' is stringified when it is used in `str', so it is not
1421 macro-expanded first.  But `s' is an ordinary argument to `xstr', so it
1422 is completely macro-expanded before `xstr' itself is expanded (*note
1423 Argument Prescan::).  Therefore, by the time `str' gets to its
1424 argument, it has already been macro-expanded.
1425
1426 \1f
1427 File: cpp.info,  Node: Concatenation,  Next: Variadic Macros,  Prev: Stringification,  Up: Macros
1428
1429 3.5 Concatenation
1430 =================
1431
1432 It is often useful to merge two tokens into one while expanding macros.
1433 This is called "token pasting" or "token concatenation".  The `##'
1434 preprocessing operator performs token pasting.  When a macro is
1435 expanded, the two tokens on either side of each `##' operator are
1436 combined into a single token, which then replaces the `##' and the two
1437 original tokens in the macro expansion.  Usually both will be
1438 identifiers, or one will be an identifier and the other a preprocessing
1439 number.  When pasted, they make a longer identifier.  This isn't the
1440 only valid case.  It is also possible to concatenate two numbers (or a
1441 number and a name, such as `1.5' and `e3') into a number.  Also,
1442 multi-character operators such as `+=' can be formed by token pasting.
1443
1444    However, two tokens that don't together form a valid token cannot be
1445 pasted together.  For example, you cannot concatenate `x' with `+' in
1446 either order.  If you try, the preprocessor issues a warning and emits
1447 the two tokens.  Whether it puts white space between the tokens is
1448 undefined.  It is common to find unnecessary uses of `##' in complex
1449 macros.  If you get this warning, it is likely that you can simply
1450 remove the `##'.
1451
1452    Both the tokens combined by `##' could come from the macro body, but
1453 you could just as well write them as one token in the first place.
1454 Token pasting is most useful when one or both of the tokens comes from a
1455 macro argument.  If either of the tokens next to an `##' is a parameter
1456 name, it is replaced by its actual argument before `##' executes.  As
1457 with stringification, the actual argument is not macro-expanded first.
1458 If the argument is empty, that `##' has no effect.
1459
1460    Keep in mind that the C preprocessor converts comments to whitespace
1461 before macros are even considered.  Therefore, you cannot create a
1462 comment by concatenating `/' and `*'.  You can put as much whitespace
1463 between `##' and its operands as you like, including comments, and you
1464 can put comments in arguments that will be concatenated.  However, it
1465 is an error if `##' appears at either end of a macro body.
1466
1467    Consider a C program that interprets named commands.  There probably
1468 needs to be a table of commands, perhaps an array of structures declared
1469 as follows:
1470
1471      struct command
1472      {
1473        char *name;
1474        void (*function) (void);
1475      };
1476
1477      struct command commands[] =
1478      {
1479        { "quit", quit_command },
1480        { "help", help_command },
1481        ...
1482      };
1483
1484    It would be cleaner not to have to give each command name twice,
1485 once in the string constant and once in the function name.  A macro
1486 which takes the name of a command as an argument can make this
1487 unnecessary.  The string constant can be created with stringification,
1488 and the function name by concatenating the argument with `_command'.
1489 Here is how it is done:
1490
1491      #define COMMAND(NAME)  { #NAME, NAME ## _command }
1492
1493      struct command commands[] =
1494      {
1495        COMMAND (quit),
1496        COMMAND (help),
1497        ...
1498      };
1499
1500 \1f
1501 File: cpp.info,  Node: Variadic Macros,  Next: Predefined Macros,  Prev: Concatenation,  Up: Macros
1502
1503 3.6 Variadic Macros
1504 ===================
1505
1506 A macro can be declared to accept a variable number of arguments much as
1507 a function can.  The syntax for defining the macro is similar to that of
1508 a function.  Here is an example:
1509
1510      #define eprintf(...) fprintf (stderr, __VA_ARGS__)
1511
1512    This kind of macro is called "variadic".  When the macro is invoked,
1513 all the tokens in its argument list after the last named argument (this
1514 macro has none), including any commas, become the "variable argument".
1515 This sequence of tokens replaces the identifier `__VA_ARGS__' in the
1516 macro body wherever it appears.  Thus, we have this expansion:
1517
1518      eprintf ("%s:%d: ", input_file, lineno)
1519           ==>  fprintf (stderr, "%s:%d: ", input_file, lineno)
1520
1521    The variable argument is completely macro-expanded before it is
1522 inserted into the macro expansion, just like an ordinary argument.  You
1523 may use the `#' and `##' operators to stringify the variable argument
1524 or to paste its leading or trailing token with another token.  (But see
1525 below for an important special case for `##'.)
1526
1527    If your macro is complicated, you may want a more descriptive name
1528 for the variable argument than `__VA_ARGS__'.  CPP permits this, as an
1529 extension.  You may write an argument name immediately before the
1530 `...'; that name is used for the variable argument.  The `eprintf'
1531 macro above could be written
1532
1533      #define eprintf(args...) fprintf (stderr, args)
1534
1535 using this extension.  You cannot use `__VA_ARGS__' and this extension
1536 in the same macro.
1537
1538    You can have named arguments as well as variable arguments in a
1539 variadic macro.  We could define `eprintf' like this, instead:
1540
1541      #define eprintf(format, ...) fprintf (stderr, format, __VA_ARGS__)
1542
1543 This formulation looks more descriptive, but unfortunately it is less
1544 flexible: you must now supply at least one argument after the format
1545 string.  In standard C, you cannot omit the comma separating the named
1546 argument from the variable arguments.  Furthermore, if you leave the
1547 variable argument empty, you will get a syntax error, because there
1548 will be an extra comma after the format string.
1549
1550      eprintf("success!\n", );
1551           ==> fprintf(stderr, "success!\n", );
1552
1553    GNU CPP has a pair of extensions which deal with this problem.
1554 First, you are allowed to leave the variable argument out entirely:
1555
1556      eprintf ("success!\n")
1557           ==> fprintf(stderr, "success!\n", );
1558
1559 Second, the `##' token paste operator has a special meaning when placed
1560 between a comma and a variable argument.  If you write
1561
1562      #define eprintf(format, ...) fprintf (stderr, format, ##__VA_ARGS__)
1563
1564 and the variable argument is left out when the `eprintf' macro is used,
1565 then the comma before the `##' will be deleted.  This does _not_ happen
1566 if you pass an empty argument, nor does it happen if the token
1567 preceding `##' is anything other than a comma.
1568
1569      eprintf ("success!\n")
1570           ==> fprintf(stderr, "success!\n");
1571
1572 The above explanation is ambiguous about the case where the only macro
1573 parameter is a variable arguments parameter, as it is meaningless to
1574 try to distinguish whether no argument at all is an empty argument or a
1575 missing argument.  In this case the C99 standard is clear that the
1576 comma must remain, however the existing GCC extension used to swallow
1577 the comma.  So CPP retains the comma when conforming to a specific C
1578 standard, and drops it otherwise.
1579
1580    C99 mandates that the only place the identifier `__VA_ARGS__' can
1581 appear is in the replacement list of a variadic macro.  It may not be
1582 used as a macro name, macro argument name, or within a different type
1583 of macro.  It may also be forbidden in open text; the standard is
1584 ambiguous.  We recommend you avoid using it except for its defined
1585 purpose.
1586
1587    Variadic macros are a new feature in C99.  GNU CPP has supported them
1588 for a long time, but only with a named variable argument (`args...',
1589 not `...' and `__VA_ARGS__').  If you are concerned with portability to
1590 previous versions of GCC, you should use only named variable arguments.
1591 On the other hand, if you are concerned with portability to other
1592 conforming implementations of C99, you should use only `__VA_ARGS__'.
1593
1594    Previous versions of CPP implemented the comma-deletion extension
1595 much more generally.  We have restricted it in this release to minimize
1596 the differences from C99.  To get the same effect with both this and
1597 previous versions of GCC, the token preceding the special `##' must be
1598 a comma, and there must be white space between that comma and whatever
1599 comes immediately before it:
1600
1601      #define eprintf(format, args...) fprintf (stderr, format , ##args)
1602
1603 *Note Differences from previous versions::, for the gory details.
1604
1605 \1f
1606 File: cpp.info,  Node: Predefined Macros,  Next: Undefining and Redefining Macros,  Prev: Variadic Macros,  Up: Macros
1607
1608 3.7 Predefined Macros
1609 =====================
1610
1611 Several object-like macros are predefined; you use them without
1612 supplying their definitions.  They fall into three classes: standard,
1613 common, and system-specific.
1614
1615    In C++, there is a fourth category, the named operators.  They act
1616 like predefined macros, but you cannot undefine them.
1617
1618 * Menu:
1619
1620 * Standard Predefined Macros::
1621 * Common Predefined Macros::
1622 * System-specific Predefined Macros::
1623 * C++ Named Operators::
1624
1625 \1f
1626 File: cpp.info,  Node: Standard Predefined Macros,  Next: Common Predefined Macros,  Up: Predefined Macros
1627
1628 3.7.1 Standard Predefined Macros
1629 --------------------------------
1630
1631 The standard predefined macros are specified by the relevant language
1632 standards, so they are available with all compilers that implement
1633 those standards.  Older compilers may not provide all of them.  Their
1634 names all start with double underscores.
1635
1636 `__FILE__'
1637      This macro expands to the name of the current input file, in the
1638      form of a C string constant.  This is the path by which the
1639      preprocessor opened the file, not the short name specified in
1640      `#include' or as the input file name argument.  For example,
1641      `"/usr/local/include/myheader.h"' is a possible expansion of this
1642      macro.
1643
1644 `__LINE__'
1645      This macro expands to the current input line number, in the form
1646      of a decimal integer constant.  While we call it a predefined
1647      macro, it's a pretty strange macro, since its "definition" changes
1648      with each new line of source code.
1649
1650    `__FILE__' and `__LINE__' are useful in generating an error message
1651 to report an inconsistency detected by the program; the message can
1652 state the source line at which the inconsistency was detected.  For
1653 example,
1654
1655      fprintf (stderr, "Internal error: "
1656                       "negative string length "
1657                       "%d at %s, line %d.",
1658               length, __FILE__, __LINE__);
1659
1660    An `#include' directive changes the expansions of `__FILE__' and
1661 `__LINE__' to correspond to the included file.  At the end of that
1662 file, when processing resumes on the input file that contained the
1663 `#include' directive, the expansions of `__FILE__' and `__LINE__'
1664 revert to the values they had before the `#include' (but `__LINE__' is
1665 then incremented by one as processing moves to the line after the
1666 `#include').
1667
1668    A `#line' directive changes `__LINE__', and may change `__FILE__' as
1669 well.  *Note Line Control::.
1670
1671    C99 introduces `__func__', and GCC has provided `__FUNCTION__' for a
1672 long time.  Both of these are strings containing the name of the
1673 current function (there are slight semantic differences; see the GCC
1674 manual).  Neither of them is a macro; the preprocessor does not know the
1675 name of the current function.  They tend to be useful in conjunction
1676 with `__FILE__' and `__LINE__', though.
1677
1678 `__DATE__'
1679      This macro expands to a string constant that describes the date on
1680      which the preprocessor is being run.  The string constant contains
1681      eleven characters and looks like `"Feb 12 1996"'.  If the day of
1682      the month is less than 10, it is padded with a space on the left.
1683
1684      If GCC cannot determine the current date, it will emit a warning
1685      message (once per compilation) and `__DATE__' will expand to
1686      `"??? ?? ????"'.
1687
1688 `__TIME__'
1689      This macro expands to a string constant that describes the time at
1690      which the preprocessor is being run.  The string constant contains
1691      eight characters and looks like `"23:59:01"'.
1692
1693      If GCC cannot determine the current time, it will emit a warning
1694      message (once per compilation) and `__TIME__' will expand to
1695      `"??:??:??"'.
1696
1697 `__STDC__'
1698      In normal operation, this macro expands to the constant 1, to
1699      signify that this compiler conforms to ISO Standard C.  If GNU CPP
1700      is used with a compiler other than GCC, this is not necessarily
1701      true; however, the preprocessor always conforms to the standard
1702      unless the `-traditional-cpp' option is used.
1703
1704      This macro is not defined if the `-traditional-cpp' option is used.
1705
1706      On some hosts, the system compiler uses a different convention,
1707      where `__STDC__' is normally 0, but is 1 if the user specifies
1708      strict conformance to the C Standard.  CPP follows the host
1709      convention when processing system header files, but when
1710      processing user files `__STDC__' is always 1.  This has been
1711      reported to cause problems; for instance, some versions of Solaris
1712      provide X Windows headers that expect `__STDC__' to be either
1713      undefined or 1.  *Note Invocation::.
1714
1715 `__STDC_VERSION__'
1716      This macro expands to the C Standard's version number, a long
1717      integer constant of the form `YYYYMML' where YYYY and MM are the
1718      year and month of the Standard version.  This signifies which
1719      version of the C Standard the compiler conforms to.  Like
1720      `__STDC__', this is not necessarily accurate for the entire
1721      implementation, unless GNU CPP is being used with GCC.
1722
1723      The value `199409L' signifies the 1989 C standard as amended in
1724      1994, which is the current default; the value `199901L' signifies
1725      the 1999 revision of the C standard.  Support for the 1999
1726      revision is not yet complete.
1727
1728      This macro is not defined if the `-traditional-cpp' option is
1729      used, nor when compiling C++ or Objective-C.
1730
1731 `__STDC_HOSTED__'
1732      This macro is defined, with value 1, if the compiler's target is a
1733      "hosted environment".  A hosted environment has the complete
1734      facilities of the standard C library available.
1735
1736 `__cplusplus'
1737      This macro is defined when the C++ compiler is in use.  You can use
1738      `__cplusplus' to test whether a header is compiled by a C compiler
1739      or a C++ compiler.  This macro is similar to `__STDC_VERSION__', in
1740      that it expands to a version number.  A fully conforming
1741      implementation of the 1998 C++ standard will define this macro to
1742      `199711L'.  The GNU C++ compiler is not yet fully conforming, so
1743      it uses `1' instead.  It is hoped to complete the implementation
1744      of standard C++ in the near future.
1745
1746 `__OBJC__'
1747      This macro is defined, with value 1, when the Objective-C compiler
1748      is in use.  You can use `__OBJC__' to test whether a header is
1749      compiled by a C compiler or a Objective-C compiler.
1750
1751 `__ASSEMBLER__'
1752      This macro is defined with value 1 when preprocessing assembly
1753      language.
1754
1755
1756 \1f
1757 File: cpp.info,  Node: Common Predefined Macros,  Next: System-specific Predefined Macros,  Prev: Standard Predefined Macros,  Up: Predefined Macros
1758
1759 3.7.2 Common Predefined Macros
1760 ------------------------------
1761
1762 The common predefined macros are GNU C extensions.  They are available
1763 with the same meanings regardless of the machine or operating system on
1764 which you are using GNU C or GNU Fortran.  Their names all start with
1765 double underscores.
1766
1767 `__COUNTER__'
1768      This macro expands to sequential integral values starting from 0.
1769      In conjunction with the `##' operator, this provides a convenient
1770      means to generate unique identifiers.  Care must be taken to
1771      ensure that `__COUNTER__' is not expanded prior to inclusion of
1772      precompiled headers which use it.  Otherwise, the precompiled
1773      headers will not be used.
1774
1775 `__GFORTRAN__'
1776      The GNU Fortran compiler defines this.
1777
1778 `__GNUC__'
1779 `__GNUC_MINOR__'
1780 `__GNUC_PATCHLEVEL__'
1781      These macros are defined by all GNU compilers that use the C
1782      preprocessor: C, C++, Objective-C and Fortran.  Their values are
1783      the major version, minor version, and patch level of the compiler,
1784      as integer constants.  For example, GCC 3.2.1 will define
1785      `__GNUC__' to 3, `__GNUC_MINOR__' to 2, and `__GNUC_PATCHLEVEL__'
1786      to 1.  These macros are also defined if you invoke the
1787      preprocessor directly.
1788
1789      `__GNUC_PATCHLEVEL__' is new to GCC 3.0; it is also present in the
1790      widely-used development snapshots leading up to 3.0 (which identify
1791      themselves as GCC 2.96 or 2.97, depending on which snapshot you
1792      have).
1793
1794      If all you need to know is whether or not your program is being
1795      compiled by GCC, or a non-GCC compiler that claims to accept the
1796      GNU C dialects, you can simply test `__GNUC__'.  If you need to
1797      write code which depends on a specific version, you must be more
1798      careful.  Each time the minor version is increased, the patch
1799      level is reset to zero; each time the major version is increased
1800      (which happens rarely), the minor version and patch level are
1801      reset.  If you wish to use the predefined macros directly in the
1802      conditional, you will need to write it like this:
1803
1804           /* Test for GCC > 3.2.0 */
1805           #if __GNUC__ > 3 || \
1806               (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || \
1807                                  (__GNUC_MINOR__ == 2 && \
1808                                   __GNUC_PATCHLEVEL__ > 0))
1809
1810      Another approach is to use the predefined macros to calculate a
1811      single number, then compare that against a threshold:
1812
1813           #define GCC_VERSION (__GNUC__ * 10000 \
1814                                + __GNUC_MINOR__ * 100 \
1815                                + __GNUC_PATCHLEVEL__)
1816           ...
1817           /* Test for GCC > 3.2.0 */
1818           #if GCC_VERSION > 30200
1819
1820      Many people find this form easier to understand.
1821
1822 `__GNUG__'
1823      The GNU C++ compiler defines this.  Testing it is equivalent to
1824      testing `(__GNUC__ && __cplusplus)'.
1825
1826 `__STRICT_ANSI__'
1827      GCC defines this macro if and only if the `-ansi' switch, or a
1828      `-std' switch specifying strict conformance to some version of ISO
1829      C, was specified when GCC was invoked.  It is defined to `1'.
1830      This macro exists primarily to direct GNU libc's header files to
1831      restrict their definitions to the minimal set found in the 1989 C
1832      standard.
1833
1834 `__BASE_FILE__'
1835      This macro expands to the name of the main input file, in the form
1836      of a C string constant.  This is the source file that was specified
1837      on the command line of the preprocessor or C compiler.
1838
1839 `__INCLUDE_LEVEL__'
1840      This macro expands to a decimal integer constant that represents
1841      the depth of nesting in include files.  The value of this macro is
1842      incremented on every `#include' directive and decremented at the
1843      end of every included file.  It starts out at 0, its value within
1844      the base file specified on the command line.
1845
1846 `__ELF__'
1847      This macro is defined if the target uses the ELF object format.
1848
1849 `__VERSION__'
1850      This macro expands to a string constant which describes the
1851      version of the compiler in use.  You should not rely on its
1852      contents having any particular form, but it can be counted on to
1853      contain at least the release number.
1854
1855 `__OPTIMIZE__'
1856 `__OPTIMIZE_SIZE__'
1857 `__NO_INLINE__'
1858      These macros describe the compilation mode.  `__OPTIMIZE__' is
1859      defined in all optimizing compilations.  `__OPTIMIZE_SIZE__' is
1860      defined if the compiler is optimizing for size, not speed.
1861      `__NO_INLINE__' is defined if no functions will be inlined into
1862      their callers (when not optimizing, or when inlining has been
1863      specifically disabled by `-fno-inline').
1864
1865      These macros cause certain GNU header files to provide optimized
1866      definitions, using macros or inline functions, of system library
1867      functions.  You should not use these macros in any way unless you
1868      make sure that programs will execute with the same effect whether
1869      or not they are defined.  If they are defined, their value is 1.
1870
1871 `__GNUC_GNU_INLINE__'
1872      GCC defines this macro if functions declared `inline' will be
1873      handled in GCC's traditional gnu89 mode.  Object files will contain
1874      externally visible definitions of all functions declared `inline'
1875      without `extern' or `static'.  They will not contain any
1876      definitions of any functions declared `extern inline'.
1877
1878 `__GNUC_STDC_INLINE__'
1879      GCC defines this macro if functions declared `inline' will be
1880      handled according to the ISO C99 standard.  Object files will
1881      contain externally visible definitions of all functions declared
1882      `extern inline'.  They will not contain definitions of any
1883      functions declared `inline' without `extern'.
1884
1885      If this macro is defined, GCC supports the `gnu_inline' function
1886      attribute as a way to always get the gnu89 behavior.  Support for
1887      this and `__GNUC_GNU_INLINE__' was added in GCC 4.1.3.  If neither
1888      macro is defined, an older version of GCC is being used: `inline'
1889      functions will be compiled in gnu89 mode, and the `gnu_inline'
1890      function attribute will not be recognized.
1891
1892 `__CHAR_UNSIGNED__'
1893      GCC defines this macro if and only if the data type `char' is
1894      unsigned on the target machine.  It exists to cause the standard
1895      header file `limits.h' to work correctly.  You should not use this
1896      macro yourself; instead, refer to the standard macros defined in
1897      `limits.h'.
1898
1899 `__WCHAR_UNSIGNED__'
1900      Like `__CHAR_UNSIGNED__', this macro is defined if and only if the
1901      data type `wchar_t' is unsigned and the front-end is in C++ mode.
1902
1903 `__REGISTER_PREFIX__'
1904      This macro expands to a single token (not a string constant) which
1905      is the prefix applied to CPU register names in assembly language
1906      for this target.  You can use it to write assembly that is usable
1907      in multiple environments.  For example, in the `m68k-aout'
1908      environment it expands to nothing, but in the `m68k-coff'
1909      environment it expands to a single `%'.
1910
1911 `__USER_LABEL_PREFIX__'
1912      This macro expands to a single token which is the prefix applied to
1913      user labels (symbols visible to C code) in assembly.  For example,
1914      in the `m68k-aout' environment it expands to an `_', but in the
1915      `m68k-coff' environment it expands to nothing.
1916
1917      This macro will have the correct definition even if
1918      `-f(no-)underscores' is in use, but it will not be correct if
1919      target-specific options that adjust this prefix are used (e.g. the
1920      OSF/rose `-mno-underscores' option).
1921
1922 `__SIZE_TYPE__'
1923 `__PTRDIFF_TYPE__'
1924 `__WCHAR_TYPE__'
1925 `__WINT_TYPE__'
1926 `__INTMAX_TYPE__'
1927 `__UINTMAX_TYPE__'
1928      These macros are defined to the correct underlying types for the
1929      `size_t', `ptrdiff_t', `wchar_t', `wint_t', `intmax_t', and
1930      `uintmax_t' typedefs, respectively.  They exist to make the
1931      standard header files `stddef.h' and `wchar.h' work correctly.
1932      You should not use these macros directly; instead, include the
1933      appropriate headers and use the typedefs.
1934
1935 `__CHAR_BIT__'
1936      Defined to the number of bits used in the representation of the
1937      `char' data type.  It exists to make the standard header given
1938      numerical limits work correctly.  You should not use this macro
1939      directly; instead, include the appropriate headers.
1940
1941 `__SCHAR_MAX__'
1942 `__WCHAR_MAX__'
1943 `__SHRT_MAX__'
1944 `__INT_MAX__'
1945 `__LONG_MAX__'
1946 `__LONG_LONG_MAX__'
1947 `__INTMAX_MAX__'
1948      Defined to the maximum value of the `signed char', `wchar_t',
1949      `signed short', `signed int', `signed long', `signed long long',
1950      and `intmax_t' types respectively.  They exist to make the
1951      standard header given numerical limits work correctly.  You should
1952      not use these macros directly; instead, include the appropriate
1953      headers.
1954
1955 `__SIZEOF_INT__'
1956 `__SIZEOF_LONG__'
1957 `__SIZEOF_LONG_LONG__'
1958 `__SIZEOF_SHORT__'
1959 `__SIZEOF_POINTER__'
1960 `__SIZEOF_FLOAT__'
1961 `__SIZEOF_DOUBLE__'
1962 `__SIZEOF_LONG_DOUBLE__'
1963 `__SIZEOF_SIZE_T__'
1964 `__SIZEOF_WCHAR_T__'
1965 `__SIZEOF_WINT_T__'
1966 `__SIZEOF_PTRDIFF_T__'
1967      Defined to the number of bytes of the C standard data types: `int',
1968      `long', `long long', `short', `void *', `float', `double', `long
1969      double', `size_t', `wchar_t', `wint_t' and `ptrdiff_t'.
1970
1971 `__DEPRECATED'
1972      This macro is defined, with value 1, when compiling a C++ source
1973      file with warnings about deprecated constructs enabled.  These
1974      warnings are enabled by default, but can be disabled with
1975      `-Wno-deprecated'.
1976
1977 `__EXCEPTIONS'
1978      This macro is defined, with value 1, when compiling a C++ source
1979      file with exceptions enabled.  If `-fno-exceptions' is used when
1980      compiling the file, then this macro is not defined.
1981
1982 `__GXX_RTTI'
1983      This macro is defined, with value 1, when compiling a C++ source
1984      file with runtime type identification enabled.  If `-fno-rtti' is
1985      used when compiling the file, then this macro is not defined.
1986
1987 `__USING_SJLJ_EXCEPTIONS__'
1988      This macro is defined, with value 1, if the compiler uses the old
1989      mechanism based on `setjmp' and `longjmp' for exception handling.
1990
1991 `__GXX_EXPERIMENTAL_CXX0X__'
1992      This macro is defined when compiling a C++ source file with the
1993      option `-std=c++0x' or `-std=gnu++0x'. It indicates that some
1994      features likely to be included in C++0x are available. Note that
1995      these features are experimental, and may change or be removed in
1996      future versions of GCC.
1997
1998 `__GXX_WEAK__'
1999      This macro is defined when compiling a C++ source file.  It has the
2000      value 1 if the compiler will use weak symbols, COMDAT sections, or
2001      other similar techniques to collapse symbols with "vague linkage"
2002      that are defined in multiple translation units.  If the compiler
2003      will not collapse such symbols, this macro is defined with value
2004      0.  In general, user code should not need to make use of this
2005      macro; the purpose of this macro is to ease implementation of the
2006      C++ runtime library provided with G++.
2007
2008 `__NEXT_RUNTIME__'
2009      This macro is defined, with value 1, if (and only if) the NeXT
2010      runtime (as in `-fnext-runtime') is in use for Objective-C.  If
2011      the GNU runtime is used, this macro is not defined, so that you
2012      can use this macro to determine which runtime (NeXT or GNU) is
2013      being used.
2014
2015 `__LP64__'
2016 `_LP64'
2017      These macros are defined, with value 1, if (and only if) the
2018      compilation is for a target where `long int' and pointer both use
2019      64-bits and `int' uses 32-bit.
2020
2021 `__SSP__'
2022      This macro is defined, with value 1, when `-fstack-protector' is in
2023      use.
2024
2025 `__SSP_ALL__'
2026      This macro is defined, with value 2, when `-fstack-protector-all'
2027      is in use.
2028
2029 `__TIMESTAMP__'
2030      This macro expands to a string constant that describes the date
2031      and time of the last modification of the current source file. The
2032      string constant contains abbreviated day of the week, month, day
2033      of the month, time in hh:mm:ss form, year and looks like
2034      `"Sun Sep 16 01:03:52 1973"'.  If the day of the month is less
2035      than 10, it is padded with a space on the left.
2036
2037      If GCC cannot determine the current date, it will emit a warning
2038      message (once per compilation) and `__TIMESTAMP__' will expand to
2039      `"??? ??? ?? ??:??:?? ????"'.
2040
2041 `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1'
2042 `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2'
2043 `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4'
2044 `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8'
2045 `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16'
2046      These macros are defined when the target processor supports atomic
2047      compare and swap operations on operands 1, 2, 4, 8 or 16 bytes in
2048      length, respectively.
2049
2050 `__GCC_HAVE_DWARF2_CFI_ASM'
2051      This macro is defined when the compiler is emitting Dwarf2 CFI
2052      directives to the assembler.  When this is defined, it is possible
2053      to emit those same directives in inline assembly.
2054
2055 \1f
2056 File: cpp.info,  Node: System-specific Predefined Macros,  Next: C++ Named Operators,  Prev: Common Predefined Macros,  Up: Predefined Macros
2057
2058 3.7.3 System-specific Predefined Macros
2059 ---------------------------------------
2060
2061 The C preprocessor normally predefines several macros that indicate what
2062 type of system and machine is in use.  They are obviously different on
2063 each target supported by GCC.  This manual, being for all systems and
2064 machines, cannot tell you what their names are, but you can use `cpp
2065 -dM' to see them all.  *Note Invocation::.  All system-specific
2066 predefined macros expand to the constant 1, so you can test them with
2067 either `#ifdef' or `#if'.
2068
2069    The C standard requires that all system-specific macros be part of
2070 the "reserved namespace".  All names which begin with two underscores,
2071 or an underscore and a capital letter, are reserved for the compiler and
2072 library to use as they wish.  However, historically system-specific
2073 macros have had names with no special prefix; for instance, it is common
2074 to find `unix' defined on Unix systems.  For all such macros, GCC
2075 provides a parallel macro with two underscores added at the beginning
2076 and the end.  If `unix' is defined, `__unix__' will be defined too.
2077 There will never be more than two underscores; the parallel of `_mips'
2078 is `__mips__'.
2079
2080    When the `-ansi' option, or any `-std' option that requests strict
2081 conformance, is given to the compiler, all the system-specific
2082 predefined macros outside the reserved namespace are suppressed.  The
2083 parallel macros, inside the reserved namespace, remain defined.
2084
2085    We are slowly phasing out all predefined macros which are outside the
2086 reserved namespace.  You should never use them in new programs, and we
2087 encourage you to correct older code to use the parallel macros whenever
2088 you find it.  We don't recommend you use the system-specific macros that
2089 are in the reserved namespace, either.  It is better in the long run to
2090 check specifically for features you need, using a tool such as
2091 `autoconf'.
2092
2093 \1f
2094 File: cpp.info,  Node: C++ Named Operators,  Prev: System-specific Predefined Macros,  Up: Predefined Macros
2095
2096 3.7.4 C++ Named Operators
2097 -------------------------
2098
2099 In C++, there are eleven keywords which are simply alternate spellings
2100 of operators normally written with punctuation.  These keywords are
2101 treated as such even in the preprocessor.  They function as operators in
2102 `#if', and they cannot be defined as macros or poisoned.  In C, you can
2103 request that those keywords take their C++ meaning by including
2104 `iso646.h'.  That header defines each one as a normal object-like macro
2105 expanding to the appropriate punctuator.
2106
2107    These are the named operators and their corresponding punctuators:
2108
2109 Named Operator   Punctuator
2110 `and'            `&&'
2111 `and_eq'         `&='
2112 `bitand'         `&'
2113 `bitor'          `|'
2114 `compl'          `~'
2115 `not'            `!'
2116 `not_eq'         `!='
2117 `or'             `||'
2118 `or_eq'          `|='
2119 `xor'            `^'
2120 `xor_eq'         `^='
2121
2122 \1f
2123 File: cpp.info,  Node: Undefining and Redefining Macros,  Next: Directives Within Macro Arguments,  Prev: Predefined Macros,  Up: Macros
2124
2125 3.8 Undefining and Redefining Macros
2126 ====================================
2127
2128 If a macro ceases to be useful, it may be "undefined" with the `#undef'
2129 directive.  `#undef' takes a single argument, the name of the macro to
2130 undefine.  You use the bare macro name, even if the macro is
2131 function-like.  It is an error if anything appears on the line after
2132 the macro name.  `#undef' has no effect if the name is not a macro.
2133
2134      #define FOO 4
2135      x = FOO;        ==> x = 4;
2136      #undef FOO
2137      x = FOO;        ==> x = FOO;
2138
2139    Once a macro has been undefined, that identifier may be "redefined"
2140 as a macro by a subsequent `#define' directive.  The new definition
2141 need not have any resemblance to the old definition.
2142
2143    However, if an identifier which is currently a macro is redefined,
2144 then the new definition must be "effectively the same" as the old one.
2145 Two macro definitions are effectively the same if:
2146    * Both are the same type of macro (object- or function-like).
2147
2148    * All the tokens of the replacement list are the same.
2149
2150    * If there are any parameters, they are the same.
2151
2152    * Whitespace appears in the same places in both.  It need not be
2153      exactly the same amount of whitespace, though.  Remember that
2154      comments count as whitespace.
2155
2156 These definitions are effectively the same:
2157      #define FOUR (2 + 2)
2158      #define FOUR         (2    +    2)
2159      #define FOUR (2 /* two */ + 2)
2160    but these are not:
2161      #define FOUR (2 + 2)
2162      #define FOUR ( 2+2 )
2163      #define FOUR (2 * 2)
2164      #define FOUR(score,and,seven,years,ago) (2 + 2)
2165
2166    If a macro is redefined with a definition that is not effectively the
2167 same as the old one, the preprocessor issues a warning and changes the
2168 macro to use the new definition.  If the new definition is effectively
2169 the same, the redefinition is silently ignored.  This allows, for
2170 instance, two different headers to define a common macro.  The
2171 preprocessor will only complain if the definitions do not match.
2172
2173 \1f
2174 File: cpp.info,  Node: Directives Within Macro Arguments,  Next: Macro Pitfalls,  Prev: Undefining and Redefining Macros,  Up: Macros
2175
2176 3.9 Directives Within Macro Arguments
2177 =====================================
2178
2179 Occasionally it is convenient to use preprocessor directives within the
2180 arguments of a macro.  The C and C++ standards declare that behavior in
2181 these cases is undefined.
2182
2183    Versions of CPP prior to 3.2 would reject such constructs with an
2184 error message.  This was the only syntactic difference between normal
2185 functions and function-like macros, so it seemed attractive to remove
2186 this limitation, and people would often be surprised that they could
2187 not use macros in this way.  Moreover, sometimes people would use
2188 conditional compilation in the argument list to a normal library
2189 function like `printf', only to find that after a library upgrade
2190 `printf' had changed to be a function-like macro, and their code would
2191 no longer compile.  So from version 3.2 we changed CPP to successfully
2192 process arbitrary directives within macro arguments in exactly the same
2193 way as it would have processed the directive were the function-like
2194 macro invocation not present.
2195
2196    If, within a macro invocation, that macro is redefined, then the new
2197 definition takes effect in time for argument pre-expansion, but the
2198 original definition is still used for argument replacement.  Here is a
2199 pathological example:
2200
2201      #define f(x) x x
2202      f (1
2203      #undef f
2204      #define f 2
2205      f)
2206
2207 which expands to
2208
2209      1 2 1 2
2210
2211 with the semantics described above.
2212
2213 \1f
2214 File: cpp.info,  Node: Macro Pitfalls,  Prev: Directives Within Macro Arguments,  Up: Macros
2215
2216 3.10 Macro Pitfalls
2217 ===================
2218
2219 In this section we describe some special rules that apply to macros and
2220 macro expansion, and point out certain cases in which the rules have
2221 counter-intuitive consequences that you must watch out for.
2222
2223 * Menu:
2224
2225 * Misnesting::
2226 * Operator Precedence Problems::
2227 * Swallowing the Semicolon::
2228 * Duplication of Side Effects::
2229 * Self-Referential Macros::
2230 * Argument Prescan::
2231 * Newlines in Arguments::
2232
2233 \1f
2234 File: cpp.info,  Node: Misnesting,  Next: Operator Precedence Problems,  Up: Macro Pitfalls
2235
2236 3.10.1 Misnesting
2237 -----------------
2238
2239 When a macro is called with arguments, the arguments are substituted
2240 into the macro body and the result is checked, together with the rest of
2241 the input file, for more macro calls.  It is possible to piece together
2242 a macro call coming partially from the macro body and partially from the
2243 arguments.  For example,
2244
2245      #define twice(x) (2*(x))
2246      #define call_with_1(x) x(1)
2247      call_with_1 (twice)
2248           ==> twice(1)
2249           ==> (2*(1))
2250
2251    Macro definitions do not have to have balanced parentheses.  By
2252 writing an unbalanced open parenthesis in a macro body, it is possible
2253 to create a macro call that begins inside the macro body but ends
2254 outside of it.  For example,
2255
2256      #define strange(file) fprintf (file, "%s %d",
2257      ...
2258      strange(stderr) p, 35)
2259           ==> fprintf (stderr, "%s %d", p, 35)
2260
2261    The ability to piece together a macro call can be useful, but the
2262 use of unbalanced open parentheses in a macro body is just confusing,
2263 and should be avoided.
2264
2265 \1f
2266 File: cpp.info,  Node: Operator Precedence Problems,  Next: Swallowing the Semicolon,  Prev: Misnesting,  Up: Macro Pitfalls
2267
2268 3.10.2 Operator Precedence Problems
2269 -----------------------------------
2270
2271 You may have noticed that in most of the macro definition examples shown
2272 above, each occurrence of a macro argument name had parentheses around
2273 it.  In addition, another pair of parentheses usually surround the
2274 entire macro definition.  Here is why it is best to write macros that
2275 way.
2276
2277    Suppose you define a macro as follows,
2278
2279      #define ceil_div(x, y) (x + y - 1) / y
2280
2281 whose purpose is to divide, rounding up.  (One use for this operation is
2282 to compute how many `int' objects are needed to hold a certain number
2283 of `char' objects.)  Then suppose it is used as follows:
2284
2285      a = ceil_div (b & c, sizeof (int));
2286           ==> a = (b & c + sizeof (int) - 1) / sizeof (int);
2287
2288 This does not do what is intended.  The operator-precedence rules of C
2289 make it equivalent to this:
2290
2291      a = (b & (c + sizeof (int) - 1)) / sizeof (int);
2292
2293 What we want is this:
2294
2295      a = ((b & c) + sizeof (int) - 1)) / sizeof (int);
2296
2297 Defining the macro as
2298
2299      #define ceil_div(x, y) ((x) + (y) - 1) / (y)
2300
2301 provides the desired result.
2302
2303    Unintended grouping can result in another way.  Consider `sizeof
2304 ceil_div(1, 2)'.  That has the appearance of a C expression that would
2305 compute the size of the type of `ceil_div (1, 2)', but in fact it means
2306 something very different.  Here is what it expands to:
2307
2308      sizeof ((1) + (2) - 1) / (2)
2309
2310 This would take the size of an integer and divide it by two.  The
2311 precedence rules have put the division outside the `sizeof' when it was
2312 intended to be inside.
2313
2314    Parentheses around the entire macro definition prevent such problems.
2315 Here, then, is the recommended way to define `ceil_div':
2316
2317      #define ceil_div(x, y) (((x) + (y) - 1) / (y))
2318
2319 \1f
2320 File: cpp.info,  Node: Swallowing the Semicolon,  Next: Duplication of Side Effects,  Prev: Operator Precedence Problems,  Up: Macro Pitfalls
2321
2322 3.10.3 Swallowing the Semicolon
2323 -------------------------------
2324
2325 Often it is desirable to define a macro that expands into a compound
2326 statement.  Consider, for example, the following macro, that advances a
2327 pointer (the argument `p' says where to find it) across whitespace
2328 characters:
2329
2330      #define SKIP_SPACES(p, limit)  \
2331      { char *lim = (limit);         \
2332        while (p < lim) {            \
2333          if (*p++ != ' ') {         \
2334            p--; break; }}}
2335
2336 Here backslash-newline is used to split the macro definition, which must
2337 be a single logical line, so that it resembles the way such code would
2338 be laid out if not part of a macro definition.
2339
2340    A call to this macro might be `SKIP_SPACES (p, lim)'.  Strictly
2341 speaking, the call expands to a compound statement, which is a complete
2342 statement with no need for a semicolon to end it.  However, since it
2343 looks like a function call, it minimizes confusion if you can use it
2344 like a function call, writing a semicolon afterward, as in `SKIP_SPACES
2345 (p, lim);'
2346
2347    This can cause trouble before `else' statements, because the
2348 semicolon is actually a null statement.  Suppose you write
2349
2350      if (*p != 0)
2351        SKIP_SPACES (p, lim);
2352      else ...
2353
2354 The presence of two statements--the compound statement and a null
2355 statement--in between the `if' condition and the `else' makes invalid C
2356 code.
2357
2358    The definition of the macro `SKIP_SPACES' can be altered to solve
2359 this problem, using a `do ... while' statement.  Here is how:
2360
2361      #define SKIP_SPACES(p, limit)     \
2362      do { char *lim = (limit);         \
2363           while (p < lim) {            \
2364             if (*p++ != ' ') {         \
2365               p--; break; }}}          \
2366      while (0)
2367
2368    Now `SKIP_SPACES (p, lim);' expands into
2369
2370      do {...} while (0);
2371
2372 which is one statement.  The loop executes exactly once; most compilers
2373 generate no extra code for it.
2374
2375 \1f
2376 File: cpp.info,  Node: Duplication of Side Effects,  Next: Self-Referential Macros,  Prev: Swallowing the Semicolon,  Up: Macro Pitfalls
2377
2378 3.10.4 Duplication of Side Effects
2379 ----------------------------------
2380
2381 Many C programs define a macro `min', for "minimum", like this:
2382
2383      #define min(X, Y)  ((X) < (Y) ? (X) : (Y))
2384
2385    When you use this macro with an argument containing a side effect,
2386 as shown here,
2387
2388      next = min (x + y, foo (z));
2389
2390 it expands as follows:
2391
2392      next = ((x + y) < (foo (z)) ? (x + y) : (foo (z)));
2393
2394 where `x + y' has been substituted for `X' and `foo (z)' for `Y'.
2395
2396    The function `foo' is used only once in the statement as it appears
2397 in the program, but the expression `foo (z)' has been substituted twice
2398 into the macro expansion.  As a result, `foo' might be called two times
2399 when the statement is executed.  If it has side effects or if it takes
2400 a long time to compute, the results might not be what you intended.  We
2401 say that `min' is an "unsafe" macro.
2402
2403    The best solution to this problem is to define `min' in a way that
2404 computes the value of `foo (z)' only once.  The C language offers no
2405 standard way to do this, but it can be done with GNU extensions as
2406 follows:
2407
2408      #define min(X, Y)                \
2409      ({ typeof (X) x_ = (X);          \
2410         typeof (Y) y_ = (Y);          \
2411         (x_ < y_) ? x_ : y_; })
2412
2413    The `({ ... })' notation produces a compound statement that acts as
2414 an expression.  Its value is the value of its last statement.  This
2415 permits us to define local variables and assign each argument to one.
2416 The local variables have underscores after their names to reduce the
2417 risk of conflict with an identifier of wider scope (it is impossible to
2418 avoid this entirely).  Now each argument is evaluated exactly once.
2419
2420    If you do not wish to use GNU C extensions, the only solution is to
2421 be careful when _using_ the macro `min'.  For example, you can
2422 calculate the value of `foo (z)', save it in a variable, and use that
2423 variable in `min':
2424
2425      #define min(X, Y)  ((X) < (Y) ? (X) : (Y))
2426      ...
2427      {
2428        int tem = foo (z);
2429        next = min (x + y, tem);
2430      }
2431
2432 (where we assume that `foo' returns type `int').
2433
2434 \1f
2435 File: cpp.info,  Node: Self-Referential Macros,  Next: Argument Prescan,  Prev: Duplication of Side Effects,  Up: Macro Pitfalls
2436
2437 3.10.5 Self-Referential Macros
2438 ------------------------------
2439
2440 A "self-referential" macro is one whose name appears in its definition.
2441 Recall that all macro definitions are rescanned for more macros to
2442 replace.  If the self-reference were considered a use of the macro, it
2443 would produce an infinitely large expansion.  To prevent this, the
2444 self-reference is not considered a macro call.  It is passed into the
2445 preprocessor output unchanged.  Consider an example:
2446
2447      #define foo (4 + foo)
2448
2449 where `foo' is also a variable in your program.
2450
2451    Following the ordinary rules, each reference to `foo' will expand
2452 into `(4 + foo)'; then this will be rescanned and will expand into `(4
2453 + (4 + foo))'; and so on until the computer runs out of memory.
2454
2455    The self-reference rule cuts this process short after one step, at
2456 `(4 + foo)'.  Therefore, this macro definition has the possibly useful
2457 effect of causing the program to add 4 to the value of `foo' wherever
2458 `foo' is referred to.
2459
2460    In most cases, it is a bad idea to take advantage of this feature.  A
2461 person reading the program who sees that `foo' is a variable will not
2462 expect that it is a macro as well.  The reader will come across the
2463 identifier `foo' in the program and think its value should be that of
2464 the variable `foo', whereas in fact the value is four greater.
2465
2466    One common, useful use of self-reference is to create a macro which
2467 expands to itself.  If you write
2468
2469      #define EPERM EPERM
2470
2471 then the macro `EPERM' expands to `EPERM'.  Effectively, it is left
2472 alone by the preprocessor whenever it's used in running text.  You can
2473 tell that it's a macro with `#ifdef'.  You might do this if you want to
2474 define numeric constants with an `enum', but have `#ifdef' be true for
2475 each constant.
2476
2477    If a macro `x' expands to use a macro `y', and the expansion of `y'
2478 refers to the macro `x', that is an "indirect self-reference" of `x'.
2479 `x' is not expanded in this case either.  Thus, if we have
2480
2481      #define x (4 + y)
2482      #define y (2 * x)
2483
2484 then `x' and `y' expand as follows:
2485
2486      x    ==> (4 + y)
2487           ==> (4 + (2 * x))
2488
2489      y    ==> (2 * x)
2490           ==> (2 * (4 + y))
2491
2492 Each macro is expanded when it appears in the definition of the other
2493 macro, but not when it indirectly appears in its own definition.
2494
2495 \1f
2496 File: cpp.info,  Node: Argument Prescan,  Next: Newlines in Arguments,  Prev: Self-Referential Macros,  Up: Macro Pitfalls
2497
2498 3.10.6 Argument Prescan
2499 -----------------------
2500
2501 Macro arguments are completely macro-expanded before they are
2502 substituted into a macro body, unless they are stringified or pasted
2503 with other tokens.  After substitution, the entire macro body, including
2504 the substituted arguments, is scanned again for macros to be expanded.
2505 The result is that the arguments are scanned _twice_ to expand macro
2506 calls in them.
2507
2508    Most of the time, this has no effect.  If the argument contained any
2509 macro calls, they are expanded during the first scan.  The result
2510 therefore contains no macro calls, so the second scan does not change
2511 it.  If the argument were substituted as given, with no prescan, the
2512 single remaining scan would find the same macro calls and produce the
2513 same results.
2514
2515    You might expect the double scan to change the results when a
2516 self-referential macro is used in an argument of another macro (*note
2517 Self-Referential Macros::): the self-referential macro would be
2518 expanded once in the first scan, and a second time in the second scan.
2519 However, this is not what happens.  The self-references that do not
2520 expand in the first scan are marked so that they will not expand in the
2521 second scan either.
2522
2523    You might wonder, "Why mention the prescan, if it makes no
2524 difference?  And why not skip it and make the preprocessor faster?"
2525 The answer is that the prescan does make a difference in three special
2526 cases:
2527
2528    * Nested calls to a macro.
2529
2530      We say that "nested" calls to a macro occur when a macro's argument
2531      contains a call to that very macro.  For example, if `f' is a macro
2532      that expects one argument, `f (f (1))' is a nested pair of calls to
2533      `f'.  The desired expansion is made by expanding `f (1)' and
2534      substituting that into the definition of `f'.  The prescan causes
2535      the expected result to happen.  Without the prescan, `f (1)' itself
2536      would be substituted as an argument, and the inner use of `f' would
2537      appear during the main scan as an indirect self-reference and
2538      would not be expanded.
2539
2540    * Macros that call other macros that stringify or concatenate.
2541
2542      If an argument is stringified or concatenated, the prescan does not
2543      occur.  If you _want_ to expand a macro, then stringify or
2544      concatenate its expansion, you can do that by causing one macro to
2545      call another macro that does the stringification or concatenation.
2546      For instance, if you have
2547
2548           #define AFTERX(x) X_ ## x
2549           #define XAFTERX(x) AFTERX(x)
2550           #define TABLESIZE 1024
2551           #define BUFSIZE TABLESIZE
2552
2553      then `AFTERX(BUFSIZE)' expands to `X_BUFSIZE', and
2554      `XAFTERX(BUFSIZE)' expands to `X_1024'.  (Not to `X_TABLESIZE'.
2555      Prescan always does a complete expansion.)
2556
2557    * Macros used in arguments, whose expansions contain unshielded
2558      commas.
2559
2560      This can cause a macro expanded on the second scan to be called
2561      with the wrong number of arguments.  Here is an example:
2562
2563           #define foo  a,b
2564           #define bar(x) lose(x)
2565           #define lose(x) (1 + (x))
2566
2567      We would like `bar(foo)' to turn into `(1 + (foo))', which would
2568      then turn into `(1 + (a,b))'.  Instead, `bar(foo)' expands into
2569      `lose(a,b)', and you get an error because `lose' requires a single
2570      argument.  In this case, the problem is easily solved by the same
2571      parentheses that ought to be used to prevent misnesting of
2572      arithmetic operations:
2573
2574           #define foo (a,b)
2575      or
2576           #define bar(x) lose((x))
2577
2578      The extra pair of parentheses prevents the comma in `foo''s
2579      definition from being interpreted as an argument separator.
2580
2581
2582 \1f
2583 File: cpp.info,  Node: Newlines in Arguments,  Prev: Argument Prescan,  Up: Macro Pitfalls
2584
2585 3.10.7 Newlines in Arguments
2586 ----------------------------
2587
2588 The invocation of a function-like macro can extend over many logical
2589 lines.  However, in the present implementation, the entire expansion
2590 comes out on one line.  Thus line numbers emitted by the compiler or
2591 debugger refer to the line the invocation started on, which might be
2592 different to the line containing the argument causing the problem.
2593
2594    Here is an example illustrating this:
2595
2596      #define ignore_second_arg(a,b,c) a; c
2597
2598      ignore_second_arg (foo (),
2599                         ignored (),
2600                         syntax error);
2601
2602 The syntax error triggered by the tokens `syntax error' results in an
2603 error message citing line three--the line of ignore_second_arg-- even
2604 though the problematic code comes from line five.
2605
2606    We consider this a bug, and intend to fix it in the near future.
2607
2608 \1f
2609 File: cpp.info,  Node: Conditionals,  Next: Diagnostics,  Prev: Macros,  Up: Top
2610
2611 4 Conditionals
2612 **************
2613
2614 A "conditional" is a directive that instructs the preprocessor to
2615 select whether or not to include a chunk of code in the final token
2616 stream passed to the compiler.  Preprocessor conditionals can test
2617 arithmetic expressions, or whether a name is defined as a macro, or both
2618 simultaneously using the special `defined' operator.
2619
2620    A conditional in the C preprocessor resembles in some ways an `if'
2621 statement in C, but it is important to understand the difference between
2622 them.  The condition in an `if' statement is tested during the
2623 execution of your program.  Its purpose is to allow your program to
2624 behave differently from run to run, depending on the data it is
2625 operating on.  The condition in a preprocessing conditional directive is
2626 tested when your program is compiled.  Its purpose is to allow different
2627 code to be included in the program depending on the situation at the
2628 time of compilation.
2629
2630    However, the distinction is becoming less clear.  Modern compilers
2631 often do test `if' statements when a program is compiled, if their
2632 conditions are known not to vary at run time, and eliminate code which
2633 can never be executed.  If you can count on your compiler to do this,
2634 you may find that your program is more readable if you use `if'
2635 statements with constant conditions (perhaps determined by macros).  Of
2636 course, you can only use this to exclude code, not type definitions or
2637 other preprocessing directives, and you can only do it if the code
2638 remains syntactically valid when it is not to be used.
2639
2640    GCC version 3 eliminates this kind of never-executed code even when
2641 not optimizing.  Older versions did it only when optimizing.
2642
2643 * Menu:
2644
2645 * Conditional Uses::
2646 * Conditional Syntax::
2647 * Deleted Code::
2648
2649 \1f
2650 File: cpp.info,  Node: Conditional Uses,  Next: Conditional Syntax,  Up: Conditionals
2651
2652 4.1 Conditional Uses
2653 ====================
2654
2655 There are three general reasons to use a conditional.
2656
2657    * A program may need to use different code depending on the machine
2658      or operating system it is to run on.  In some cases the code for
2659      one operating system may be erroneous on another operating system;
2660      for example, it might refer to data types or constants that do not
2661      exist on the other system.  When this happens, it is not enough to
2662      avoid executing the invalid code.  Its mere presence will cause
2663      the compiler to reject the program.  With a preprocessing
2664      conditional, the offending code can be effectively excised from
2665      the program when it is not valid.
2666
2667    * You may want to be able to compile the same source file into two
2668      different programs.  One version might make frequent time-consuming
2669      consistency checks on its intermediate data, or print the values of
2670      those data for debugging, and the other not.
2671
2672    * A conditional whose condition is always false is one way to
2673      exclude code from the program but keep it as a sort of comment for
2674      future reference.
2675
2676    Simple programs that do not need system-specific logic or complex
2677 debugging hooks generally will not need to use preprocessing
2678 conditionals.
2679
2680 \1f
2681 File: cpp.info,  Node: Conditional Syntax,  Next: Deleted Code,  Prev: Conditional Uses,  Up: Conditionals
2682
2683 4.2 Conditional Syntax
2684 ======================
2685
2686 A conditional in the C preprocessor begins with a "conditional
2687 directive": `#if', `#ifdef' or `#ifndef'.
2688
2689 * Menu:
2690
2691 * Ifdef::
2692 * If::
2693 * Defined::
2694 * Else::
2695 * Elif::
2696
2697 \1f
2698 File: cpp.info,  Node: Ifdef,  Next: If,  Up: Conditional Syntax
2699
2700 4.2.1 Ifdef
2701 -----------
2702
2703 The simplest sort of conditional is
2704
2705      #ifdef MACRO
2706
2707      CONTROLLED TEXT
2708
2709      #endif /* MACRO */
2710
2711    This block is called a "conditional group".  CONTROLLED TEXT will be
2712 included in the output of the preprocessor if and only if MACRO is
2713 defined.  We say that the conditional "succeeds" if MACRO is defined,
2714 "fails" if it is not.
2715
2716    The CONTROLLED TEXT inside of a conditional can include
2717 preprocessing directives.  They are executed only if the conditional
2718 succeeds.  You can nest conditional groups inside other conditional
2719 groups, but they must be completely nested.  In other words, `#endif'
2720 always matches the nearest `#ifdef' (or `#ifndef', or `#if').  Also,
2721 you cannot start a conditional group in one file and end it in another.
2722
2723    Even if a conditional fails, the CONTROLLED TEXT inside it is still
2724 run through initial transformations and tokenization.  Therefore, it
2725 must all be lexically valid C.  Normally the only way this matters is
2726 that all comments and string literals inside a failing conditional group
2727 must still be properly ended.
2728
2729    The comment following the `#endif' is not required, but it is a good
2730 practice if there is a lot of CONTROLLED TEXT, because it helps people
2731 match the `#endif' to the corresponding `#ifdef'.  Older programs
2732 sometimes put MACRO directly after the `#endif' without enclosing it in
2733 a comment.  This is invalid code according to the C standard.  CPP
2734 accepts it with a warning.  It never affects which `#ifndef' the
2735 `#endif' matches.
2736
2737    Sometimes you wish to use some code if a macro is _not_ defined.
2738 You can do this by writing `#ifndef' instead of `#ifdef'.  One common
2739 use of `#ifndef' is to include code only the first time a header file
2740 is included.  *Note Once-Only Headers::.
2741
2742    Macro definitions can vary between compilations for several reasons.
2743 Here are some samples.
2744
2745    * Some macros are predefined on each kind of machine (*note
2746      System-specific Predefined Macros::).  This allows you to provide
2747      code specially tuned for a particular machine.
2748
2749    * System header files define more macros, associated with the
2750      features they implement.  You can test these macros with
2751      conditionals to avoid using a system feature on a machine where it
2752      is not implemented.
2753
2754    * Macros can be defined or undefined with the `-D' and `-U' command
2755      line options when you compile the program.  You can arrange to
2756      compile the same source file into two different programs by
2757      choosing a macro name to specify which program you want, writing
2758      conditionals to test whether or how this macro is defined, and
2759      then controlling the state of the macro with command line options,
2760      perhaps set in the Makefile.  *Note Invocation::.
2761
2762    * Your program might have a special header file (often called
2763      `config.h') that is adjusted when the program is compiled.  It can
2764      define or not define macros depending on the features of the
2765      system and the desired capabilities of the program.  The
2766      adjustment can be automated by a tool such as `autoconf', or done
2767      by hand.
2768
2769 \1f
2770 File: cpp.info,  Node: If,  Next: Defined,  Prev: Ifdef,  Up: Conditional Syntax
2771
2772 4.2.2 If
2773 --------
2774
2775 The `#if' directive allows you to test the value of an arithmetic
2776 expression, rather than the mere existence of one macro.  Its syntax is
2777
2778      #if EXPRESSION
2779
2780      CONTROLLED TEXT
2781
2782      #endif /* EXPRESSION */
2783
2784    EXPRESSION is a C expression of integer type, subject to stringent
2785 restrictions.  It may contain
2786
2787    * Integer constants.
2788
2789    * Character constants, which are interpreted as they would be in
2790      normal code.
2791
2792    * Arithmetic operators for addition, subtraction, multiplication,
2793      division, bitwise operations, shifts, comparisons, and logical
2794      operations (`&&' and `||').  The latter two obey the usual
2795      short-circuiting rules of standard C.
2796
2797    * Macros.  All macros in the expression are expanded before actual
2798      computation of the expression's value begins.
2799
2800    * Uses of the `defined' operator, which lets you check whether macros
2801      are defined in the middle of an `#if'.
2802
2803    * Identifiers that are not macros, which are all considered to be the
2804      number zero.  This allows you to write `#if MACRO' instead of
2805      `#ifdef MACRO', if you know that MACRO, when defined, will always
2806      have a nonzero value.  Function-like macros used without their
2807      function call parentheses are also treated as zero.
2808
2809      In some contexts this shortcut is undesirable.  The `-Wundef'
2810      option causes GCC to warn whenever it encounters an identifier
2811      which is not a macro in an `#if'.
2812
2813    The preprocessor does not know anything about types in the language.
2814 Therefore, `sizeof' operators are not recognized in `#if', and neither
2815 are `enum' constants.  They will be taken as identifiers which are not
2816 macros, and replaced by zero.  In the case of `sizeof', this is likely
2817 to cause the expression to be invalid.
2818
2819    The preprocessor calculates the value of EXPRESSION.  It carries out
2820 all calculations in the widest integer type known to the compiler; on
2821 most machines supported by GCC this is 64 bits.  This is not the same
2822 rule as the compiler uses to calculate the value of a constant
2823 expression, and may give different results in some cases.  If the value
2824 comes out to be nonzero, the `#if' succeeds and the CONTROLLED TEXT is
2825 included; otherwise it is skipped.
2826
2827 \1f
2828 File: cpp.info,  Node: Defined,  Next: Else,  Prev: If,  Up: Conditional Syntax
2829
2830 4.2.3 Defined
2831 -------------
2832
2833 The special operator `defined' is used in `#if' and `#elif' expressions
2834 to test whether a certain name is defined as a macro.  `defined NAME'
2835 and `defined (NAME)' are both expressions whose value is 1 if NAME is
2836 defined as a macro at the current point in the program, and 0
2837 otherwise.  Thus,  `#if defined MACRO' is precisely equivalent to
2838 `#ifdef MACRO'.
2839
2840    `defined' is useful when you wish to test more than one macro for
2841 existence at once.  For example,
2842
2843      #if defined (__vax__) || defined (__ns16000__)
2844
2845 would succeed if either of the names `__vax__' or `__ns16000__' is
2846 defined as a macro.
2847
2848    Conditionals written like this:
2849
2850      #if defined BUFSIZE && BUFSIZE >= 1024
2851
2852 can generally be simplified to just `#if BUFSIZE >= 1024', since if
2853 `BUFSIZE' is not defined, it will be interpreted as having the value
2854 zero.
2855
2856    If the `defined' operator appears as a result of a macro expansion,
2857 the C standard says the behavior is undefined.  GNU cpp treats it as a
2858 genuine `defined' operator and evaluates it normally.  It will warn
2859 wherever your code uses this feature if you use the command-line option
2860 `-pedantic', since other compilers may handle it differently.
2861
2862 \1f
2863 File: cpp.info,  Node: Else,  Next: Elif,  Prev: Defined,  Up: Conditional Syntax
2864
2865 4.2.4 Else
2866 ----------
2867
2868 The `#else' directive can be added to a conditional to provide
2869 alternative text to be used if the condition fails.  This is what it
2870 looks like:
2871
2872      #if EXPRESSION
2873      TEXT-IF-TRUE
2874      #else /* Not EXPRESSION */
2875      TEXT-IF-FALSE
2876      #endif /* Not EXPRESSION */
2877
2878 If EXPRESSION is nonzero, the TEXT-IF-TRUE is included and the
2879 TEXT-IF-FALSE is skipped.  If EXPRESSION is zero, the opposite happens.
2880
2881    You can use `#else' with `#ifdef' and `#ifndef', too.
2882
2883 \1f
2884 File: cpp.info,  Node: Elif,  Prev: Else,  Up: Conditional Syntax
2885
2886 4.2.5 Elif
2887 ----------
2888
2889 One common case of nested conditionals is used to check for more than
2890 two possible alternatives.  For example, you might have
2891
2892      #if X == 1
2893      ...
2894      #else /* X != 1 */
2895      #if X == 2
2896      ...
2897      #else /* X != 2 */
2898      ...
2899      #endif /* X != 2 */
2900      #endif /* X != 1 */
2901
2902    Another conditional directive, `#elif', allows this to be
2903 abbreviated as follows:
2904
2905      #if X == 1
2906      ...
2907      #elif X == 2
2908      ...
2909      #else /* X != 2 and X != 1*/
2910      ...
2911      #endif /* X != 2 and X != 1*/
2912
2913    `#elif' stands for "else if".  Like `#else', it goes in the middle
2914 of a conditional group and subdivides it; it does not require a
2915 matching `#endif' of its own.  Like `#if', the `#elif' directive
2916 includes an expression to be tested.  The text following the `#elif' is
2917 processed only if the original `#if'-condition failed and the `#elif'
2918 condition succeeds.
2919
2920    More than one `#elif' can go in the same conditional group.  Then
2921 the text after each `#elif' is processed only if the `#elif' condition
2922 succeeds after the original `#if' and all previous `#elif' directives
2923 within it have failed.
2924
2925    `#else' is allowed after any number of `#elif' directives, but
2926 `#elif' may not follow `#else'.
2927
2928 \1f
2929 File: cpp.info,  Node: Deleted Code,  Prev: Conditional Syntax,  Up: Conditionals
2930
2931 4.3 Deleted Code
2932 ================
2933
2934 If you replace or delete a part of the program but want to keep the old
2935 code around for future reference, you often cannot simply comment it
2936 out.  Block comments do not nest, so the first comment inside the old
2937 code will end the commenting-out.  The probable result is a flood of
2938 syntax errors.
2939
2940    One way to avoid this problem is to use an always-false conditional
2941 instead.  For instance, put `#if 0' before the deleted code and
2942 `#endif' after it.  This works even if the code being turned off
2943 contains conditionals, but they must be entire conditionals (balanced
2944 `#if' and `#endif').
2945
2946    Some people use `#ifdef notdef' instead.  This is risky, because
2947 `notdef' might be accidentally defined as a macro, and then the
2948 conditional would succeed.  `#if 0' can be counted on to fail.
2949
2950    Do not use `#if 0' for comments which are not C code.  Use a real
2951 comment, instead.  The interior of `#if 0' must consist of complete
2952 tokens; in particular, single-quote characters must balance.  Comments
2953 often contain unbalanced single-quote characters (known in English as
2954 apostrophes).  These confuse `#if 0'.  They don't confuse `/*'.
2955
2956 \1f
2957 File: cpp.info,  Node: Diagnostics,  Next: Line Control,  Prev: Conditionals,  Up: Top
2958
2959 5 Diagnostics
2960 *************
2961
2962 The directive `#error' causes the preprocessor to report a fatal error.
2963 The tokens forming the rest of the line following `#error' are used as
2964 the error message.
2965
2966    You would use `#error' inside of a conditional that detects a
2967 combination of parameters which you know the program does not properly
2968 support.  For example, if you know that the program will not run
2969 properly on a VAX, you might write
2970
2971      #ifdef __vax__
2972      #error "Won't work on VAXen.  See comments at get_last_object."
2973      #endif
2974
2975    If you have several configuration parameters that must be set up by
2976 the installation in a consistent way, you can use conditionals to detect
2977 an inconsistency and report it with `#error'.  For example,
2978
2979      #if !defined(UNALIGNED_INT_ASM_OP) && defined(DWARF2_DEBUGGING_INFO)
2980      #error "DWARF2_DEBUGGING_INFO requires UNALIGNED_INT_ASM_OP."
2981      #endif
2982
2983    The directive `#warning' is like `#error', but causes the
2984 preprocessor to issue a warning and continue preprocessing.  The tokens
2985 following `#warning' are used as the warning message.
2986
2987    You might use `#warning' in obsolete header files, with a message
2988 directing the user to the header file which should be used instead.
2989
2990    Neither `#error' nor `#warning' macro-expands its argument.
2991 Internal whitespace sequences are each replaced with a single space.
2992 The line must consist of complete tokens.  It is wisest to make the
2993 argument of these directives be a single string constant; this avoids
2994 problems with apostrophes and the like.
2995
2996 \1f
2997 File: cpp.info,  Node: Line Control,  Next: Pragmas,  Prev: Diagnostics,  Up: Top
2998
2999 6 Line Control
3000 **************
3001
3002 The C preprocessor informs the C compiler of the location in your source
3003 code where each token came from.  Presently, this is just the file name
3004 and line number.  All the tokens resulting from macro expansion are
3005 reported as having appeared on the line of the source file where the
3006 outermost macro was used.  We intend to be more accurate in the future.
3007
3008    If you write a program which generates source code, such as the
3009 `bison' parser generator, you may want to adjust the preprocessor's
3010 notion of the current file name and line number by hand.  Parts of the
3011 output from `bison' are generated from scratch, other parts come from a
3012 standard parser file.  The rest are copied verbatim from `bison''s
3013 input.  You would like compiler error messages and symbolic debuggers
3014 to be able to refer to `bison''s input file.
3015
3016    `bison' or any such program can arrange this by writing `#line'
3017 directives into the output file.  `#line' is a directive that specifies
3018 the original line number and source file name for subsequent input in
3019 the current preprocessor input file.  `#line' has three variants:
3020
3021 `#line LINENUM'
3022      LINENUM is a non-negative decimal integer constant.  It specifies
3023      the line number which should be reported for the following line of
3024      input.  Subsequent lines are counted from LINENUM.
3025
3026 `#line LINENUM FILENAME'
3027      LINENUM is the same as for the first form, and has the same
3028      effect.  In addition, FILENAME is a string constant.  The
3029      following line and all subsequent lines are reported to come from
3030      the file it specifies, until something else happens to change that.
3031      FILENAME is interpreted according to the normal rules for a string
3032      constant: backslash escapes are interpreted.  This is different
3033      from `#include'.
3034
3035      Previous versions of CPP did not interpret escapes in `#line'; we
3036      have changed it because the standard requires they be interpreted,
3037      and most other compilers do.
3038
3039 `#line ANYTHING ELSE'
3040      ANYTHING ELSE is checked for macro calls, which are expanded.  The
3041      result should match one of the above two forms.
3042
3043    `#line' directives alter the results of the `__FILE__' and
3044 `__LINE__' predefined macros from that point on.  *Note Standard
3045 Predefined Macros::.  They do not have any effect on `#include''s idea
3046 of the directory containing the current file.  This is a change from
3047 GCC 2.95.  Previously, a file reading
3048
3049      #line 1 "../src/gram.y"
3050      #include "gram.h"
3051
3052    would search for `gram.h' in `../src', then the `-I' chain; the
3053 directory containing the physical source file would not be searched.
3054 In GCC 3.0 and later, the `#include' is not affected by the presence of
3055 a `#line' referring to a different directory.
3056
3057    We made this change because the old behavior caused problems when
3058 generated source files were transported between machines.  For instance,
3059 it is common practice to ship generated parsers with a source release,
3060 so that people building the distribution do not need to have yacc or
3061 Bison installed.  These files frequently have `#line' directives
3062 referring to the directory tree of the system where the distribution was
3063 created.  If GCC tries to search for headers in those directories, the
3064 build is likely to fail.
3065
3066    The new behavior can cause failures too, if the generated file is not
3067 in the same directory as its source and it attempts to include a header
3068 which would be visible searching from the directory containing the
3069 source file.  However, this problem is easily solved with an additional
3070 `-I' switch on the command line.  The failures caused by the old
3071 semantics could sometimes be corrected only by editing the generated
3072 files, which is difficult and error-prone.
3073
3074 \1f
3075 File: cpp.info,  Node: Pragmas,  Next: Other Directives,  Prev: Line Control,  Up: Top
3076
3077 7 Pragmas
3078 *********
3079
3080 The `#pragma' directive is the method specified by the C standard for
3081 providing additional information to the compiler, beyond what is
3082 conveyed in the language itself.  Three forms of this directive
3083 (commonly known as "pragmas") are specified by the 1999 C standard.  A
3084 C compiler is free to attach any meaning it likes to other pragmas.
3085
3086    GCC has historically preferred to use extensions to the syntax of the
3087 language, such as `__attribute__', for this purpose.  However, GCC does
3088 define a few pragmas of its own.  These mostly have effects on the
3089 entire translation unit or source file.
3090
3091    In GCC version 3, all GNU-defined, supported pragmas have been given
3092 a `GCC' prefix.  This is in line with the `STDC' prefix on all pragmas
3093 defined by C99.  For backward compatibility, pragmas which were
3094 recognized by previous versions are still recognized without the `GCC'
3095 prefix, but that usage is deprecated.  Some older pragmas are
3096 deprecated in their entirety.  They are not recognized with the `GCC'
3097 prefix.  *Note Obsolete Features::.
3098
3099    C99 introduces the `_Pragma' operator.  This feature addresses a
3100 major problem with `#pragma': being a directive, it cannot be produced
3101 as the result of macro expansion.  `_Pragma' is an operator, much like
3102 `sizeof' or `defined', and can be embedded in a macro.
3103
3104    Its syntax is `_Pragma (STRING-LITERAL)', where STRING-LITERAL can
3105 be either a normal or wide-character string literal.  It is
3106 destringized, by replacing all `\\' with a single `\' and all `\"' with
3107 a `"'.  The result is then processed as if it had appeared as the right
3108 hand side of a `#pragma' directive.  For example,
3109
3110      _Pragma ("GCC dependency \"parse.y\"")
3111
3112 has the same effect as `#pragma GCC dependency "parse.y"'.  The same
3113 effect could be achieved using macros, for example
3114
3115      #define DO_PRAGMA(x) _Pragma (#x)
3116      DO_PRAGMA (GCC dependency "parse.y")
3117
3118    The standard is unclear on where a `_Pragma' operator can appear.
3119 The preprocessor does not accept it within a preprocessing conditional
3120 directive like `#if'.  To be safe, you are probably best keeping it out
3121 of directives other than `#define', and putting it on a line of its own.
3122
3123    This manual documents the pragmas which are meaningful to the
3124 preprocessor itself.  Other pragmas are meaningful to the C or C++
3125 compilers.  They are documented in the GCC manual.
3126
3127 `#pragma GCC dependency'
3128      `#pragma GCC dependency' allows you to check the relative dates of
3129      the current file and another file.  If the other file is more
3130      recent than the current file, a warning is issued.  This is useful
3131      if the current file is derived from the other file, and should be
3132      regenerated.  The other file is searched for using the normal
3133      include search path.  Optional trailing text can be used to give
3134      more information in the warning message.
3135
3136           #pragma GCC dependency "parse.y"
3137           #pragma GCC dependency "/usr/include/time.h" rerun fixincludes
3138
3139 `#pragma GCC poison'
3140      Sometimes, there is an identifier that you want to remove
3141      completely from your program, and make sure that it never creeps
3142      back in.  To enforce this, you can "poison" the identifier with
3143      this pragma.  `#pragma GCC poison' is followed by a list of
3144      identifiers to poison.  If any of those identifiers appears
3145      anywhere in the source after the directive, it is a hard error.
3146      For example,
3147
3148           #pragma GCC poison printf sprintf fprintf
3149           sprintf(some_string, "hello");
3150
3151      will produce an error.
3152
3153      If a poisoned identifier appears as part of the expansion of a
3154      macro which was defined before the identifier was poisoned, it
3155      will _not_ cause an error.  This lets you poison an identifier
3156      without worrying about system headers defining macros that use it.
3157
3158      For example,
3159
3160           #define strrchr rindex
3161           #pragma GCC poison rindex
3162           strrchr(some_string, 'h');
3163
3164      will not produce an error.
3165
3166 `#pragma GCC system_header'
3167      This pragma takes no arguments.  It causes the rest of the code in
3168      the current file to be treated as if it came from a system header.
3169      *Note System Headers::.
3170
3171
3172 \1f
3173 File: cpp.info,  Node: Other Directives,  Next: Preprocessor Output,  Prev: Pragmas,  Up: Top
3174
3175 8 Other Directives
3176 ******************
3177
3178 The `#ident' directive takes one argument, a string constant.  On some
3179 systems, that string constant is copied into a special segment of the
3180 object file.  On other systems, the directive is ignored.  The `#sccs'
3181 directive is a synonym for `#ident'.
3182
3183    These directives are not part of the C standard, but they are not
3184 official GNU extensions either.  What historical information we have
3185 been able to find, suggests they originated with System V.
3186
3187    Both `#ident' and `#sccs' are deprecated extensions.
3188
3189    The "null directive" consists of a `#' followed by a newline, with
3190 only whitespace (including comments) in between.  A null directive is
3191 understood as a preprocessing directive but has no effect on the
3192 preprocessor output.  The primary significance of the existence of the
3193 null directive is that an input line consisting of just a `#' will
3194 produce no output, rather than a line of output containing just a `#'.
3195 Supposedly some old C programs contain such lines.
3196
3197 \1f
3198 File: cpp.info,  Node: Preprocessor Output,  Next: Traditional Mode,  Prev: Other Directives,  Up: Top
3199
3200 9 Preprocessor Output
3201 *********************
3202
3203 When the C preprocessor is used with the C, C++, or Objective-C
3204 compilers, it is integrated into the compiler and communicates a stream
3205 of binary tokens directly to the compiler's parser.  However, it can
3206 also be used in the more conventional standalone mode, where it produces
3207 textual output.
3208
3209    The output from the C preprocessor looks much like the input, except
3210 that all preprocessing directive lines have been replaced with blank
3211 lines and all comments with spaces.  Long runs of blank lines are
3212 discarded.
3213
3214    The ISO standard specifies that it is implementation defined whether
3215 a preprocessor preserves whitespace between tokens, or replaces it with
3216 e.g. a single space.  In GNU CPP, whitespace between tokens is collapsed
3217 to become a single space, with the exception that the first token on a
3218 non-directive line is preceded with sufficient spaces that it appears in
3219 the same column in the preprocessed output that it appeared in the
3220 original source file.  This is so the output is easy to read.  *Note
3221 Differences from previous versions::.  CPP does not insert any
3222 whitespace where there was none in the original source, except where
3223 necessary to prevent an accidental token paste.
3224
3225    Source file name and line number information is conveyed by lines of
3226 the form
3227
3228      # LINENUM FILENAME FLAGS
3229
3230 These are called "linemarkers".  They are inserted as needed into the
3231 output (but never within a string or character constant).  They mean
3232 that the following line originated in file FILENAME at line LINENUM.
3233 FILENAME will never contain any non-printing characters; they are
3234 replaced with octal escape sequences.
3235
3236    After the file name comes zero or more flags, which are `1', `2',
3237 `3', or `4'.  If there are multiple flags, spaces separate them.  Here
3238 is what the flags mean:
3239
3240 `1'
3241      This indicates the start of a new file.
3242
3243 `2'
3244      This indicates returning to a file (after having included another
3245      file).
3246
3247 `3'
3248      This indicates that the following text comes from a system header
3249      file, so certain warnings should be suppressed.
3250
3251 `4'
3252      This indicates that the following text should be treated as being
3253      wrapped in an implicit `extern "C"' block.
3254
3255    As an extension, the preprocessor accepts linemarkers in
3256 non-assembler input files.  They are treated like the corresponding
3257 `#line' directive, (*note Line Control::), except that trailing flags
3258 are permitted, and are interpreted with the meanings described above.
3259 If multiple flags are given, they must be in ascending order.
3260
3261    Some directives may be duplicated in the output of the preprocessor.
3262 These are `#ident' (always), `#pragma' (only if the preprocessor does
3263 not handle the pragma itself), and `#define' and `#undef' (with certain
3264 debugging options).  If this happens, the `#' of the directive will
3265 always be in the first column, and there will be no space between the
3266 `#' and the directive name.  If macro expansion happens to generate
3267 tokens which might be mistaken for a duplicated directive, a space will
3268 be inserted between the `#' and the directive name.
3269
3270 \1f
3271 File: cpp.info,  Node: Traditional Mode,  Next: Implementation Details,  Prev: Preprocessor Output,  Up: Top
3272
3273 10 Traditional Mode
3274 *******************
3275
3276 Traditional (pre-standard) C preprocessing is rather different from the
3277 preprocessing specified by the standard.  When GCC is given the
3278 `-traditional-cpp' option, it attempts to emulate a traditional
3279 preprocessor.
3280
3281    GCC versions 3.2 and later only support traditional mode semantics in
3282 the preprocessor, and not in the compiler front ends.  This chapter
3283 outlines the traditional preprocessor semantics we implemented.
3284
3285    The implementation does not correspond precisely to the behavior of
3286 earlier versions of GCC, nor to any true traditional preprocessor.
3287 After all, inconsistencies among traditional implementations were a
3288 major motivation for C standardization.  However, we intend that it
3289 should be compatible with true traditional preprocessors in all ways
3290 that actually matter.
3291
3292 * Menu:
3293
3294 * Traditional lexical analysis::
3295 * Traditional macros::
3296 * Traditional miscellany::
3297 * Traditional warnings::
3298
3299 \1f
3300 File: cpp.info,  Node: Traditional lexical analysis,  Next: Traditional macros,  Up: Traditional Mode
3301
3302 10.1 Traditional lexical analysis
3303 =================================
3304
3305 The traditional preprocessor does not decompose its input into tokens
3306 the same way a standards-conforming preprocessor does.  The input is
3307 simply treated as a stream of text with minimal internal form.
3308
3309    This implementation does not treat trigraphs (*note trigraphs::)
3310 specially since they were an invention of the standards committee.  It
3311 handles arbitrarily-positioned escaped newlines properly and splices
3312 the lines as you would expect; many traditional preprocessors did not
3313 do this.
3314
3315    The form of horizontal whitespace in the input file is preserved in
3316 the output.  In particular, hard tabs remain hard tabs.  This can be
3317 useful if, for example, you are preprocessing a Makefile.
3318
3319    Traditional CPP only recognizes C-style block comments, and treats
3320 the `/*' sequence as introducing a comment only if it lies outside
3321 quoted text.  Quoted text is introduced by the usual single and double
3322 quotes, and also by an initial `<' in a `#include' directive.
3323
3324    Traditionally, comments are completely removed and are not replaced
3325 with a space.  Since a traditional compiler does its own tokenization
3326 of the output of the preprocessor, this means that comments can
3327 effectively be used as token paste operators.  However, comments behave
3328 like separators for text handled by the preprocessor itself, since it
3329 doesn't re-lex its input.  For example, in
3330
3331      #if foo/**/bar
3332
3333 `foo' and `bar' are distinct identifiers and expanded separately if
3334 they happen to be macros.  In other words, this directive is equivalent
3335 to
3336
3337      #if foo bar
3338
3339 rather than
3340
3341      #if foobar
3342
3343    Generally speaking, in traditional mode an opening quote need not
3344 have a matching closing quote.  In particular, a macro may be defined
3345 with replacement text that contains an unmatched quote.  Of course, if
3346 you attempt to compile preprocessed output containing an unmatched quote
3347 you will get a syntax error.
3348
3349    However, all preprocessing directives other than `#define' require
3350 matching quotes.  For example:
3351
3352      #define m This macro's fine and has an unmatched quote
3353      "/* This is not a comment.  */
3354      /* This is a comment.  The following #include directive
3355         is ill-formed.  */
3356      #include <stdio.h
3357
3358    Just as for the ISO preprocessor, what would be a closing quote can
3359 be escaped with a backslash to prevent the quoted text from closing.
3360
3361 \1f
3362 File: cpp.info,  Node: Traditional macros,  Next: Traditional miscellany,  Prev: Traditional lexical analysis,  Up: Traditional Mode
3363
3364 10.2 Traditional macros
3365 =======================
3366
3367 The major difference between traditional and ISO macros is that the
3368 former expand to text rather than to a token sequence.  CPP removes all
3369 leading and trailing horizontal whitespace from a macro's replacement
3370 text before storing it, but preserves the form of internal whitespace.
3371
3372    One consequence is that it is legitimate for the replacement text to
3373 contain an unmatched quote (*note Traditional lexical analysis::).  An
3374 unclosed string or character constant continues into the text following
3375 the macro call.  Similarly, the text at the end of a macro's expansion
3376 can run together with the text after the macro invocation to produce a
3377 single token.
3378
3379    Normally comments are removed from the replacement text after the
3380 macro is expanded, but if the `-CC' option is passed on the command
3381 line comments are preserved.  (In fact, the current implementation
3382 removes comments even before saving the macro replacement text, but it
3383 careful to do it in such a way that the observed effect is identical
3384 even in the function-like macro case.)
3385
3386    The ISO stringification operator `#' and token paste operator `##'
3387 have no special meaning.  As explained later, an effect similar to
3388 these operators can be obtained in a different way.  Macro names that
3389 are embedded in quotes, either from the main file or after macro
3390 replacement, do not expand.
3391
3392    CPP replaces an unquoted object-like macro name with its replacement
3393 text, and then rescans it for further macros to replace.  Unlike
3394 standard macro expansion, traditional macro expansion has no provision
3395 to prevent recursion.  If an object-like macro appears unquoted in its
3396 replacement text, it will be replaced again during the rescan pass, and
3397 so on _ad infinitum_.  GCC detects when it is expanding recursive
3398 macros, emits an error message, and continues after the offending macro
3399 invocation.
3400
3401      #define PLUS +
3402      #define INC(x) PLUS+x
3403      INC(foo);
3404           ==> ++foo;
3405
3406    Function-like macros are similar in form but quite different in
3407 behavior to their ISO counterparts.  Their arguments are contained
3408 within parentheses, are comma-separated, and can cross physical lines.
3409 Commas within nested parentheses are not treated as argument
3410 separators.  Similarly, a quote in an argument cannot be left unclosed;
3411 a following comma or parenthesis that comes before the closing quote is
3412 treated like any other character.  There is no facility for handling
3413 variadic macros.
3414
3415    This implementation removes all comments from macro arguments, unless
3416 the `-C' option is given.  The form of all other horizontal whitespace
3417 in arguments is preserved, including leading and trailing whitespace.
3418 In particular
3419
3420      f( )
3421
3422 is treated as an invocation of the macro `f' with a single argument
3423 consisting of a single space.  If you want to invoke a function-like
3424 macro that takes no arguments, you must not leave any whitespace
3425 between the parentheses.
3426
3427    If a macro argument crosses a new line, the new line is replaced with
3428 a space when forming the argument.  If the previous line contained an
3429 unterminated quote, the following line inherits the quoted state.
3430
3431    Traditional preprocessors replace parameters in the replacement text
3432 with their arguments regardless of whether the parameters are within
3433 quotes or not.  This provides a way to stringize arguments.  For example
3434
3435      #define str(x) "x"
3436      str(/* A comment */some text )
3437           ==> "some text "
3438
3439 Note that the comment is removed, but that the trailing space is
3440 preserved.  Here is an example of using a comment to effect token
3441 pasting.
3442
3443      #define suffix(x) foo_/**/x
3444      suffix(bar)
3445           ==> foo_bar
3446
3447 \1f
3448 File: cpp.info,  Node: Traditional miscellany,  Next: Traditional warnings,  Prev: Traditional macros,  Up: Traditional Mode
3449
3450 10.3 Traditional miscellany
3451 ===========================
3452
3453 Here are some things to be aware of when using the traditional
3454 preprocessor.
3455
3456    * Preprocessing directives are recognized only when their leading
3457      `#' appears in the first column.  There can be no whitespace
3458      between the beginning of the line and the `#', but whitespace can
3459      follow the `#'.
3460
3461    * A true traditional C preprocessor does not recognize `#error' or
3462      `#pragma', and may not recognize `#elif'.  CPP supports all the
3463      directives in traditional mode that it supports in ISO mode,
3464      including extensions, with the exception that the effects of
3465      `#pragma GCC poison' are undefined.
3466
3467    * __STDC__ is not defined.
3468
3469    * If you use digraphs the behavior is undefined.
3470
3471    * If a line that looks like a directive appears within macro
3472      arguments, the behavior is undefined.
3473
3474
3475 \1f
3476 File: cpp.info,  Node: Traditional warnings,  Prev: Traditional miscellany,  Up: Traditional Mode
3477
3478 10.4 Traditional warnings
3479 =========================
3480
3481 You can request warnings about features that did not exist, or worked
3482 differently, in traditional C with the `-Wtraditional' option.  GCC
3483 does not warn about features of ISO C which you must use when you are
3484 using a conforming compiler, such as the `#' and `##' operators.
3485
3486    Presently `-Wtraditional' warns about:
3487
3488    * Macro parameters that appear within string literals in the macro
3489      body.  In traditional C macro replacement takes place within
3490      string literals, but does not in ISO C.
3491
3492    * In traditional C, some preprocessor directives did not exist.
3493      Traditional preprocessors would only consider a line to be a
3494      directive if the `#' appeared in column 1 on the line.  Therefore
3495      `-Wtraditional' warns about directives that traditional C
3496      understands but would ignore because the `#' does not appear as the
3497      first character on the line.  It also suggests you hide directives
3498      like `#pragma' not understood by traditional C by indenting them.
3499      Some traditional implementations would not recognize `#elif', so it
3500      suggests avoiding it altogether.
3501
3502    * A function-like macro that appears without an argument list.  In
3503      some traditional preprocessors this was an error.  In ISO C it
3504      merely means that the macro is not expanded.
3505
3506    * The unary plus operator.  This did not exist in traditional C.
3507
3508    * The `U' and `LL' integer constant suffixes, which were not
3509      available in traditional C.  (Traditional C does support the `L'
3510      suffix for simple long integer constants.)  You are not warned
3511      about uses of these suffixes in macros defined in system headers.
3512      For instance, `UINT_MAX' may well be defined as `4294967295U', but
3513      you will not be warned if you use `UINT_MAX'.
3514
3515      You can usually avoid the warning, and the related warning about
3516      constants which are so large that they are unsigned, by writing the
3517      integer constant in question in hexadecimal, with no U suffix.
3518      Take care, though, because this gives the wrong result in exotic
3519      cases.
3520
3521 \1f
3522 File: cpp.info,  Node: Implementation Details,  Next: Invocation,  Prev: Traditional Mode,  Up: Top
3523
3524 11 Implementation Details
3525 *************************
3526
3527 Here we document details of how the preprocessor's implementation
3528 affects its user-visible behavior.  You should try to avoid undue
3529 reliance on behavior described here, as it is possible that it will
3530 change subtly in future implementations.
3531
3532    Also documented here are obsolete features and changes from previous
3533 versions of CPP.
3534
3535 * Menu:
3536
3537 * Implementation-defined behavior::
3538 * Implementation limits::
3539 * Obsolete Features::
3540 * Differences from previous versions::
3541
3542 \1f
3543 File: cpp.info,  Node: Implementation-defined behavior,  Next: Implementation limits,  Up: Implementation Details
3544
3545 11.1 Implementation-defined behavior
3546 ====================================
3547
3548 This is how CPP behaves in all the cases which the C standard describes
3549 as "implementation-defined".  This term means that the implementation
3550 is free to do what it likes, but must document its choice and stick to
3551 it.
3552
3553    * The mapping of physical source file multi-byte characters to the
3554      execution character set.
3555
3556      The input character set can be specified using the
3557      `-finput-charset' option, while the execution character set may be
3558      controlled using the `-fexec-charset' and `-fwide-exec-charset'
3559      options.
3560
3561    * Identifier characters.
3562
3563      The C and C++ standards allow identifiers to be composed of `_'
3564      and the alphanumeric characters.  C++ and C99 also allow universal
3565      character names, and C99 further permits implementation-defined
3566      characters.  GCC currently only permits universal character names
3567      if `-fextended-identifiers' is used, because the implementation of
3568      universal character names in identifiers is experimental.
3569
3570      GCC allows the `$' character in identifiers as an extension for
3571      most targets.  This is true regardless of the `std=' switch, since
3572      this extension cannot conflict with standards-conforming programs.
3573      When preprocessing assembler, however, dollars are not identifier
3574      characters by default.
3575
3576      Currently the targets that by default do not permit `$' are AVR,
3577      IP2K, MMIX, MIPS Irix 3, ARM aout, and PowerPC targets for the AIX
3578      operating system.
3579
3580      You can override the default with `-fdollars-in-identifiers' or
3581      `fno-dollars-in-identifiers'.  *Note fdollars-in-identifiers::.
3582
3583    * Non-empty sequences of whitespace characters.
3584
3585      In textual output, each whitespace sequence is collapsed to a
3586      single space.  For aesthetic reasons, the first token on each
3587      non-directive line of output is preceded with sufficient spaces
3588      that it appears in the same column as it did in the original
3589      source file.
3590
3591    * The numeric value of character constants in preprocessor
3592      expressions.
3593
3594      The preprocessor and compiler interpret character constants in the
3595      same way; i.e. escape sequences such as `\a' are given the values
3596      they would have on the target machine.
3597
3598      The compiler values a multi-character character constant a
3599      character at a time, shifting the previous value left by the
3600      number of bits per target character, and then or-ing in the
3601      bit-pattern of the new character truncated to the width of a
3602      target character.  The final bit-pattern is given type `int', and
3603      is therefore signed, regardless of whether single characters are
3604      signed or not (a slight change from versions 3.1 and earlier of
3605      GCC).  If there are more characters in the constant than would fit
3606      in the target `int' the compiler issues a warning, and the excess
3607      leading characters are ignored.
3608
3609      For example, `'ab'' for a target with an 8-bit `char' would be
3610      interpreted as
3611      `(int) ((unsigned char) 'a' * 256 + (unsigned char) 'b')', and
3612      `'\234a'' as
3613      `(int) ((unsigned char) '\234' * 256 + (unsigned char) 'a')'.
3614
3615    * Source file inclusion.
3616
3617      For a discussion on how the preprocessor locates header files,
3618      *Note Include Operation::.
3619
3620    * Interpretation of the filename resulting from a macro-expanded
3621      `#include' directive.
3622
3623      *Note Computed Includes::.
3624
3625    * Treatment of a `#pragma' directive that after macro-expansion
3626      results in a standard pragma.
3627
3628      No macro expansion occurs on any `#pragma' directive line, so the
3629      question does not arise.
3630
3631      Note that GCC does not yet implement any of the standard pragmas.
3632
3633
3634 \1f
3635 File: cpp.info,  Node: Implementation limits,  Next: Obsolete Features,  Prev: Implementation-defined behavior,  Up: Implementation Details
3636
3637 11.2 Implementation limits
3638 ==========================
3639
3640 CPP has a small number of internal limits.  This section lists the
3641 limits which the C standard requires to be no lower than some minimum,
3642 and all the others known.  It is intended that there should be as few
3643 limits as possible.  If you encounter an undocumented or inconvenient
3644 limit, please report that as a bug.  *Note Reporting Bugs: (gcc)Bugs.
3645
3646    Where we say something is limited "only by available memory", that
3647 means that internal data structures impose no intrinsic limit, and space
3648 is allocated with `malloc' or equivalent.  The actual limit will
3649 therefore depend on many things, such as the size of other things
3650 allocated by the compiler at the same time, the amount of memory
3651 consumed by other processes on the same computer, etc.
3652
3653    * Nesting levels of `#include' files.
3654
3655      We impose an arbitrary limit of 200 levels, to avoid runaway
3656      recursion.  The standard requires at least 15 levels.
3657
3658    * Nesting levels of conditional inclusion.
3659
3660      The C standard mandates this be at least 63.  CPP is limited only
3661      by available memory.
3662
3663    * Levels of parenthesized expressions within a full expression.
3664
3665      The C standard requires this to be at least 63.  In preprocessor
3666      conditional expressions, it is limited only by available memory.
3667
3668    * Significant initial characters in an identifier or macro name.
3669
3670      The preprocessor treats all characters as significant.  The C
3671      standard requires only that the first 63 be significant.
3672
3673    * Number of macros simultaneously defined in a single translation
3674      unit.
3675
3676      The standard requires at least 4095 be possible.  CPP is limited
3677      only by available memory.
3678
3679    * Number of parameters in a macro definition and arguments in a
3680      macro call.
3681
3682      We allow `USHRT_MAX', which is no smaller than 65,535.  The minimum
3683      required by the standard is 127.
3684
3685    * Number of characters on a logical source line.
3686
3687      The C standard requires a minimum of 4096 be permitted.  CPP places
3688      no limits on this, but you may get incorrect column numbers
3689      reported in diagnostics for lines longer than 65,535 characters.
3690
3691    * Maximum size of a source file.
3692
3693      The standard does not specify any lower limit on the maximum size
3694      of a source file.  GNU cpp maps files into memory, so it is
3695      limited by the available address space.  This is generally at
3696      least two gigabytes.  Depending on the operating system, the size
3697      of physical memory may or may not be a limitation.
3698
3699
3700 \1f
3701 File: cpp.info,  Node: Obsolete Features,  Next: Differences from previous versions,  Prev: Implementation limits,  Up: Implementation Details
3702
3703 11.3 Obsolete Features
3704 ======================
3705
3706 CPP has some features which are present mainly for compatibility with
3707 older programs.  We discourage their use in new code.  In some cases,
3708 we plan to remove the feature in a future version of GCC.
3709
3710 11.3.1 Assertions
3711 -----------------
3712
3713 "Assertions" are a deprecated alternative to macros in writing
3714 conditionals to test what sort of computer or system the compiled
3715 program will run on.  Assertions are usually predefined, but you can
3716 define them with preprocessing directives or command-line options.
3717
3718    Assertions were intended to provide a more systematic way to describe
3719 the compiler's target system.  However, in practice they are just as
3720 unpredictable as the system-specific predefined macros.  In addition,
3721 they are not part of any standard, and only a few compilers support
3722 them.  Therefore, the use of assertions is *less* portable than the use
3723 of system-specific predefined macros.  We recommend you do not use them
3724 at all.
3725
3726    An assertion looks like this:
3727
3728      #PREDICATE (ANSWER)
3729
3730 PREDICATE must be a single identifier.  ANSWER can be any sequence of
3731 tokens; all characters are significant except for leading and trailing
3732 whitespace, and differences in internal whitespace sequences are
3733 ignored.  (This is similar to the rules governing macro redefinition.)
3734 Thus, `(x + y)' is different from `(x+y)' but equivalent to
3735 `( x + y )'.  Parentheses do not nest inside an answer.
3736
3737    To test an assertion, you write it in an `#if'.  For example, this
3738 conditional succeeds if either `vax' or `ns16000' has been asserted as
3739 an answer for `machine'.
3740
3741      #if #machine (vax) || #machine (ns16000)
3742
3743 You can test whether _any_ answer is asserted for a predicate by
3744 omitting the answer in the conditional:
3745
3746      #if #machine
3747
3748    Assertions are made with the `#assert' directive.  Its sole argument
3749 is the assertion to make, without the leading `#' that identifies
3750 assertions in conditionals.
3751
3752      #assert PREDICATE (ANSWER)
3753
3754 You may make several assertions with the same predicate and different
3755 answers.  Subsequent assertions do not override previous ones for the
3756 same predicate.  All the answers for any given predicate are
3757 simultaneously true.
3758
3759    Assertions can be canceled with the `#unassert' directive.  It has
3760 the same syntax as `#assert'.  In that form it cancels only the answer
3761 which was specified on the `#unassert' line; other answers for that
3762 predicate remain true.  You can cancel an entire predicate by leaving
3763 out the answer:
3764
3765      #unassert PREDICATE
3766
3767 In either form, if no such assertion has been made, `#unassert' has no
3768 effect.
3769
3770    You can also make or cancel assertions using command line options.
3771 *Note Invocation::.
3772
3773 \1f
3774 File: cpp.info,  Node: Differences from previous versions,  Prev: Obsolete Features,  Up: Implementation Details
3775
3776 11.4 Differences from previous versions
3777 =======================================
3778
3779 This section details behavior which has changed from previous versions
3780 of CPP.  We do not plan to change it again in the near future, but we
3781 do not promise not to, either.
3782
3783    The "previous versions" discussed here are 2.95 and before.  The
3784 behavior of GCC 3.0 is mostly the same as the behavior of the widely
3785 used 2.96 and 2.97 development snapshots.  Where there are differences,
3786 they generally represent bugs in the snapshots.
3787
3788    * -I- deprecated
3789
3790      This option has been deprecated in 4.0.  `-iquote' is meant to
3791      replace the need for this option.
3792
3793    * Order of evaluation of `#' and `##' operators
3794
3795      The standard does not specify the order of evaluation of a chain of
3796      `##' operators, nor whether `#' is evaluated before, after, or at
3797      the same time as `##'.  You should therefore not write any code
3798      which depends on any specific ordering.  It is possible to
3799      guarantee an ordering, if you need one, by suitable use of nested
3800      macros.
3801
3802      An example of where this might matter is pasting the arguments `1',
3803      `e' and `-2'.  This would be fine for left-to-right pasting, but
3804      right-to-left pasting would produce an invalid token `e-2'.
3805
3806      GCC 3.0 evaluates `#' and `##' at the same time and strictly left
3807      to right.  Older versions evaluated all `#' operators first, then
3808      all `##' operators, in an unreliable order.
3809
3810    * The form of whitespace between tokens in preprocessor output
3811
3812      *Note Preprocessor Output::, for the current textual format.  This
3813      is also the format used by stringification.  Normally, the
3814      preprocessor communicates tokens directly to the compiler's
3815      parser, and whitespace does not come up at all.
3816
3817      Older versions of GCC preserved all whitespace provided by the
3818      user and inserted lots more whitespace of their own, because they
3819      could not accurately predict when extra spaces were needed to
3820      prevent accidental token pasting.
3821
3822    * Optional argument when invoking rest argument macros
3823
3824      As an extension, GCC permits you to omit the variable arguments
3825      entirely when you use a variable argument macro.  This is
3826      forbidden by the 1999 C standard, and will provoke a pedantic
3827      warning with GCC 3.0.  Previous versions accepted it silently.
3828
3829    * `##' swallowing preceding text in rest argument macros
3830
3831      Formerly, in a macro expansion, if `##' appeared before a variable
3832      arguments parameter, and the set of tokens specified for that
3833      argument in the macro invocation was empty, previous versions of
3834      CPP would back up and remove the preceding sequence of
3835      non-whitespace characters (*not* the preceding token).  This
3836      extension is in direct conflict with the 1999 C standard and has
3837      been drastically pared back.
3838
3839      In the current version of the preprocessor, if `##' appears between
3840      a comma and a variable arguments parameter, and the variable
3841      argument is omitted entirely, the comma will be removed from the
3842      expansion.  If the variable argument is empty, or the token before
3843      `##' is not a comma, then `##' behaves as a normal token paste.
3844
3845    * `#line' and `#include'
3846
3847      The `#line' directive used to change GCC's notion of the
3848      "directory containing the current file", used by `#include' with a
3849      double-quoted header file name.  In 3.0 and later, it does not.
3850      *Note Line Control::, for further explanation.
3851
3852    * Syntax of `#line'
3853
3854      In GCC 2.95 and previous, the string constant argument to `#line'
3855      was treated the same way as the argument to `#include': backslash
3856      escapes were not honored, and the string ended at the second `"'.
3857      This is not compliant with the C standard.  In GCC 3.0, an attempt
3858      was made to correct the behavior, so that the string was treated
3859      as a real string constant, but it turned out to be buggy.  In 3.1,
3860      the bugs have been fixed.  (We are not fixing the bugs in 3.0
3861      because they affect relatively few people and the fix is quite
3862      invasive.)
3863
3864
3865 \1f
3866 File: cpp.info,  Node: Invocation,  Next: Environment Variables,  Prev: Implementation Details,  Up: Top
3867
3868 12 Invocation
3869 *************
3870
3871 Most often when you use the C preprocessor you will not have to invoke
3872 it explicitly: the C compiler will do so automatically.  However, the
3873 preprocessor is sometimes useful on its own.  All the options listed
3874 here are also acceptable to the C compiler and have the same meaning,
3875 except that the C compiler has different rules for specifying the output
3876 file.
3877
3878    _Note:_ Whether you use the preprocessor by way of `gcc' or `cpp',
3879 the "compiler driver" is run first.  This program's purpose is to
3880 translate your command into invocations of the programs that do the
3881 actual work.  Their command line interfaces are similar but not
3882 identical to the documented interface, and may change without notice.
3883
3884    The C preprocessor expects two file names as arguments, INFILE and
3885 OUTFILE.  The preprocessor reads INFILE together with any other files
3886 it specifies with `#include'.  All the output generated by the combined
3887 input files is written in OUTFILE.
3888
3889    Either INFILE or OUTFILE may be `-', which as INFILE means to read
3890 from standard input and as OUTFILE means to write to standard output.
3891 Also, if either file is omitted, it means the same as if `-' had been
3892 specified for that file.
3893
3894    Unless otherwise noted, or the option ends in `=', all options which
3895 take an argument may have that argument appear either immediately after
3896 the option, or with a space between option and argument: `-Ifoo' and
3897 `-I foo' have the same effect.
3898
3899    Many options have multi-letter names; therefore multiple
3900 single-letter options may _not_ be grouped: `-dM' is very different from
3901 `-d -M'.
3902
3903 `-D NAME'
3904      Predefine NAME as a macro, with definition `1'.
3905
3906 `-D NAME=DEFINITION'
3907      The contents of DEFINITION are tokenized and processed as if they
3908      appeared during translation phase three in a `#define' directive.
3909      In particular, the definition will be truncated by embedded
3910      newline characters.
3911
3912      If you are invoking the preprocessor from a shell or shell-like
3913      program you may need to use the shell's quoting syntax to protect
3914      characters such as spaces that have a meaning in the shell syntax.
3915
3916      If you wish to define a function-like macro on the command line,
3917      write its argument list with surrounding parentheses before the
3918      equals sign (if any).  Parentheses are meaningful to most shells,
3919      so you will need to quote the option.  With `sh' and `csh',
3920      `-D'NAME(ARGS...)=DEFINITION'' works.
3921
3922      `-D' and `-U' options are processed in the order they are given on
3923      the command line.  All `-imacros FILE' and `-include FILE' options
3924      are processed after all `-D' and `-U' options.
3925
3926 `-U NAME'
3927      Cancel any previous definition of NAME, either built in or
3928      provided with a `-D' option.
3929
3930 `-undef'
3931      Do not predefine any system-specific or GCC-specific macros.  The
3932      standard predefined macros remain defined.  *Note Standard
3933      Predefined Macros::.
3934
3935 `-I DIR'
3936      Add the directory DIR to the list of directories to be searched
3937      for header files.  *Note Search Path::.  Directories named by `-I'
3938      are searched before the standard system include directories.  If
3939      the directory DIR is a standard system include directory, the
3940      option is ignored to ensure that the default search order for
3941      system directories and the special treatment of system headers are
3942      not defeated (*note System Headers::) .  If DIR begins with `=',
3943      then the `=' will be replaced by the sysroot prefix; see
3944      `--sysroot' and `-isysroot'.
3945
3946 `-o FILE'
3947      Write output to FILE.  This is the same as specifying FILE as the
3948      second non-option argument to `cpp'.  `gcc' has a different
3949      interpretation of a second non-option argument, so you must use
3950      `-o' to specify the output file.
3951
3952 `-Wall'
3953      Turns on all optional warnings which are desirable for normal code.
3954      At present this is `-Wcomment', `-Wtrigraphs', `-Wmultichar' and a
3955      warning about integer promotion causing a change of sign in `#if'
3956      expressions.  Note that many of the preprocessor's warnings are on
3957      by default and have no options to control them.
3958
3959 `-Wcomment'
3960 `-Wcomments'
3961      Warn whenever a comment-start sequence `/*' appears in a `/*'
3962      comment, or whenever a backslash-newline appears in a `//' comment.
3963      (Both forms have the same effect.)
3964
3965 `-Wtrigraphs'
3966      Most trigraphs in comments cannot affect the meaning of the
3967      program.  However, a trigraph that would form an escaped newline
3968      (`??/' at the end of a line) can, by changing where the comment
3969      begins or ends.  Therefore, only trigraphs that would form escaped
3970      newlines produce warnings inside a comment.
3971
3972      This option is implied by `-Wall'.  If `-Wall' is not given, this
3973      option is still enabled unless trigraphs are enabled.  To get
3974      trigraph conversion without warnings, but get the other `-Wall'
3975      warnings, use `-trigraphs -Wall -Wno-trigraphs'.
3976
3977 `-Wtraditional'
3978      Warn about certain constructs that behave differently in
3979      traditional and ISO C.  Also warn about ISO C constructs that have
3980      no traditional C equivalent, and problematic constructs which
3981      should be avoided.  *Note Traditional Mode::.
3982
3983 `-Wundef'
3984      Warn whenever an identifier which is not a macro is encountered in
3985      an `#if' directive, outside of `defined'.  Such identifiers are
3986      replaced with zero.
3987
3988 `-Wunused-macros'
3989      Warn about macros defined in the main file that are unused.  A
3990      macro is "used" if it is expanded or tested for existence at least
3991      once.  The preprocessor will also warn if the macro has not been
3992      used at the time it is redefined or undefined.
3993
3994      Built-in macros, macros defined on the command line, and macros
3995      defined in include files are not warned about.
3996
3997      _Note:_ If a macro is actually used, but only used in skipped
3998      conditional blocks, then CPP will report it as unused.  To avoid
3999      the warning in such a case, you might improve the scope of the
4000      macro's definition by, for example, moving it into the first
4001      skipped block.  Alternatively, you could provide a dummy use with
4002      something like:
4003
4004           #if defined the_macro_causing_the_warning
4005           #endif
4006
4007 `-Wendif-labels'
4008      Warn whenever an `#else' or an `#endif' are followed by text.
4009      This usually happens in code of the form
4010
4011           #if FOO
4012           ...
4013           #else FOO
4014           ...
4015           #endif FOO
4016
4017      The second and third `FOO' should be in comments, but often are not
4018      in older programs.  This warning is on by default.
4019
4020 `-Werror'
4021      Make all warnings into hard errors.  Source code which triggers
4022      warnings will be rejected.
4023
4024 `-Wsystem-headers'
4025      Issue warnings for code in system headers.  These are normally
4026      unhelpful in finding bugs in your own code, therefore suppressed.
4027      If you are responsible for the system library, you may want to see
4028      them.
4029
4030 `-w'
4031      Suppress all warnings, including those which GNU CPP issues by
4032      default.
4033
4034 `-pedantic'
4035      Issue all the mandatory diagnostics listed in the C standard.
4036      Some of them are left out by default, since they trigger
4037      frequently on harmless code.
4038
4039 `-pedantic-errors'
4040      Issue all the mandatory diagnostics, and make all mandatory
4041      diagnostics into errors.  This includes mandatory diagnostics that
4042      GCC issues without `-pedantic' but treats as warnings.
4043
4044 `-M'
4045      Instead of outputting the result of preprocessing, output a rule
4046      suitable for `make' describing the dependencies of the main source
4047      file.  The preprocessor outputs one `make' rule containing the
4048      object file name for that source file, a colon, and the names of
4049      all the included files, including those coming from `-include' or
4050      `-imacros' command line options.
4051
4052      Unless specified explicitly (with `-MT' or `-MQ'), the object file
4053      name consists of the name of the source file with any suffix
4054      replaced with object file suffix and with any leading directory
4055      parts removed.  If there are many included files then the rule is
4056      split into several lines using `\'-newline.  The rule has no
4057      commands.
4058
4059      This option does not suppress the preprocessor's debug output,
4060      such as `-dM'.  To avoid mixing such debug output with the
4061      dependency rules you should explicitly specify the dependency
4062      output file with `-MF', or use an environment variable like
4063      `DEPENDENCIES_OUTPUT' (*note Environment Variables::).  Debug
4064      output will still be sent to the regular output stream as normal.
4065
4066      Passing `-M' to the driver implies `-E', and suppresses warnings
4067      with an implicit `-w'.
4068
4069 `-MM'
4070      Like `-M' but do not mention header files that are found in system
4071      header directories, nor header files that are included, directly
4072      or indirectly, from such a header.
4073
4074      This implies that the choice of angle brackets or double quotes in
4075      an `#include' directive does not in itself determine whether that
4076      header will appear in `-MM' dependency output.  This is a slight
4077      change in semantics from GCC versions 3.0 and earlier.
4078
4079 `-MF FILE'
4080      When used with `-M' or `-MM', specifies a file to write the
4081      dependencies to.  If no `-MF' switch is given the preprocessor
4082      sends the rules to the same place it would have sent preprocessed
4083      output.
4084
4085      When used with the driver options `-MD' or `-MMD', `-MF' overrides
4086      the default dependency output file.
4087
4088 `-MG'
4089      In conjunction with an option such as `-M' requesting dependency
4090      generation, `-MG' assumes missing header files are generated files
4091      and adds them to the dependency list without raising an error.
4092      The dependency filename is taken directly from the `#include'
4093      directive without prepending any path.  `-MG' also suppresses
4094      preprocessed output, as a missing header file renders this useless.
4095
4096      This feature is used in automatic updating of makefiles.
4097
4098 `-MP'
4099      This option instructs CPP to add a phony target for each dependency
4100      other than the main file, causing each to depend on nothing.  These
4101      dummy rules work around errors `make' gives if you remove header
4102      files without updating the `Makefile' to match.
4103
4104      This is typical output:
4105
4106           test.o: test.c test.h
4107
4108           test.h:
4109
4110 `-MT TARGET'
4111      Change the target of the rule emitted by dependency generation.  By
4112      default CPP takes the name of the main input file, deletes any
4113      directory components and any file suffix such as `.c', and appends
4114      the platform's usual object suffix.  The result is the target.
4115
4116      An `-MT' option will set the target to be exactly the string you
4117      specify.  If you want multiple targets, you can specify them as a
4118      single argument to `-MT', or use multiple `-MT' options.
4119
4120      For example, `-MT '$(objpfx)foo.o'' might give
4121
4122           $(objpfx)foo.o: foo.c
4123
4124 `-MQ TARGET'
4125      Same as `-MT', but it quotes any characters which are special to
4126      Make.  `-MQ '$(objpfx)foo.o'' gives
4127
4128           $$(objpfx)foo.o: foo.c
4129
4130      The default target is automatically quoted, as if it were given
4131      with `-MQ'.
4132
4133 `-MD'
4134      `-MD' is equivalent to `-M -MF FILE', except that `-E' is not
4135      implied.  The driver determines FILE based on whether an `-o'
4136      option is given.  If it is, the driver uses its argument but with
4137      a suffix of `.d', otherwise it takes the name of the input file,
4138      removes any directory components and suffix, and applies a `.d'
4139      suffix.
4140
4141      If `-MD' is used in conjunction with `-E', any `-o' switch is
4142      understood to specify the dependency output file (*note -MF:
4143      dashMF.), but if used without `-E', each `-o' is understood to
4144      specify a target object file.
4145
4146      Since `-E' is not implied, `-MD' can be used to generate a
4147      dependency output file as a side-effect of the compilation process.
4148
4149 `-MMD'
4150      Like `-MD' except mention only user header files, not system
4151      header files.
4152
4153 `-x c'
4154 `-x c++'
4155 `-x objective-c'
4156 `-x assembler-with-cpp'
4157      Specify the source language: C, C++, Objective-C, or assembly.
4158      This has nothing to do with standards conformance or extensions;
4159      it merely selects which base syntax to expect.  If you give none
4160      of these options, cpp will deduce the language from the extension
4161      of the source file: `.c', `.cc', `.m', or `.S'.  Some other common
4162      extensions for C++ and assembly are also recognized.  If cpp does
4163      not recognize the extension, it will treat the file as C; this is
4164      the most generic mode.
4165
4166      _Note:_ Previous versions of cpp accepted a `-lang' option which
4167      selected both the language and the standards conformance level.
4168      This option has been removed, because it conflicts with the `-l'
4169      option.
4170
4171 `-std=STANDARD'
4172 `-ansi'
4173      Specify the standard to which the code should conform.  Currently
4174      CPP knows about C and C++ standards; others may be added in the
4175      future.
4176
4177      STANDARD may be one of:
4178     `iso9899:1990'
4179     `c89'
4180           The ISO C standard from 1990.  `c89' is the customary
4181           shorthand for this version of the standard.
4182
4183           The `-ansi' option is equivalent to `-std=c89'.
4184
4185     `iso9899:199409'
4186           The 1990 C standard, as amended in 1994.
4187
4188     `iso9899:1999'
4189     `c99'
4190     `iso9899:199x'
4191     `c9x'
4192           The revised ISO C standard, published in December 1999.
4193           Before publication, this was known as C9X.
4194
4195     `gnu89'
4196           The 1990 C standard plus GNU extensions.  This is the default.
4197
4198     `gnu99'
4199     `gnu9x'
4200           The 1999 C standard plus GNU extensions.
4201
4202     `c++98'
4203           The 1998 ISO C++ standard plus amendments.
4204
4205     `gnu++98'
4206           The same as `-std=c++98' plus GNU extensions.  This is the
4207           default for C++ code.
4208
4209 `-I-'
4210      Split the include path.  Any directories specified with `-I'
4211      options before `-I-' are searched only for headers requested with
4212      `#include "FILE"'; they are not searched for `#include <FILE>'.
4213      If additional directories are specified with `-I' options after
4214      the `-I-', those directories are searched for all `#include'
4215      directives.
4216
4217      In addition, `-I-' inhibits the use of the directory of the current
4218      file directory as the first search directory for `#include "FILE"'.
4219      *Note Search Path::.  This option has been deprecated.
4220
4221 `-nostdinc'
4222      Do not search the standard system directories for header files.
4223      Only the directories you have specified with `-I' options (and the
4224      directory of the current file, if appropriate) are searched.
4225
4226 `-nostdinc++'
4227      Do not search for header files in the C++-specific standard
4228      directories, but do still search the other standard directories.
4229      (This option is used when building the C++ library.)
4230
4231 `-include FILE'
4232      Process FILE as if `#include "file"' appeared as the first line of
4233      the primary source file.  However, the first directory searched
4234      for FILE is the preprocessor's working directory _instead of_ the
4235      directory containing the main source file.  If not found there, it
4236      is searched for in the remainder of the `#include "..."' search
4237      chain as normal.
4238
4239      If multiple `-include' options are given, the files are included
4240      in the order they appear on the command line.
4241
4242 `-imacros FILE'
4243      Exactly like `-include', except that any output produced by
4244      scanning FILE is thrown away.  Macros it defines remain defined.
4245      This allows you to acquire all the macros from a header without
4246      also processing its declarations.
4247
4248      All files specified by `-imacros' are processed before all files
4249      specified by `-include'.
4250
4251 `-idirafter DIR'
4252      Search DIR for header files, but do it _after_ all directories
4253      specified with `-I' and the standard system directories have been
4254      exhausted.  DIR is treated as a system include directory.  If DIR
4255      begins with `=', then the `=' will be replaced by the sysroot
4256      prefix; see `--sysroot' and `-isysroot'.
4257
4258 `-iprefix PREFIX'
4259      Specify PREFIX as the prefix for subsequent `-iwithprefix'
4260      options.  If the prefix represents a directory, you should include
4261      the final `/'.
4262
4263 `-iwithprefix DIR'
4264 `-iwithprefixbefore DIR'
4265      Append DIR to the prefix specified previously with `-iprefix', and
4266      add the resulting directory to the include search path.
4267      `-iwithprefixbefore' puts it in the same place `-I' would;
4268      `-iwithprefix' puts it where `-idirafter' would.
4269
4270 `-isysroot DIR'
4271      This option is like the `--sysroot' option, but applies only to
4272      header files.  See the `--sysroot' option for more information.
4273
4274 `-imultilib DIR'
4275      Use DIR as a subdirectory of the directory containing
4276      target-specific C++ headers.
4277
4278 `-isystem DIR'
4279      Search DIR for header files, after all directories specified by
4280      `-I' but before the standard system directories.  Mark it as a
4281      system directory, so that it gets the same special treatment as is
4282      applied to the standard system directories.  *Note System
4283      Headers::.  If DIR begins with `=', then the `=' will be replaced
4284      by the sysroot prefix; see `--sysroot' and `-isysroot'.
4285
4286 `-iquote DIR'
4287      Search DIR only for header files requested with `#include "FILE"';
4288      they are not searched for `#include <FILE>', before all
4289      directories specified by `-I' and before the standard system
4290      directories.  *Note Search Path::.  If DIR begins with `=', then
4291      the `=' will be replaced by the sysroot prefix; see `--sysroot'
4292      and `-isysroot'.
4293
4294 `-fdirectives-only'
4295      When preprocessing, handle directives, but do not expand macros.
4296
4297      The option's behavior depends on the `-E' and `-fpreprocessed'
4298      options.
4299
4300      With `-E', preprocessing is limited to the handling of directives
4301      such as `#define', `#ifdef', and `#error'.  Other preprocessor
4302      operations, such as macro expansion and trigraph conversion are
4303      not performed.  In addition, the `-dD' option is implicitly
4304      enabled.
4305
4306      With `-fpreprocessed', predefinition of command line and most
4307      builtin macros is disabled.  Macros such as `__LINE__', which are
4308      contextually dependent, are handled normally.  This enables
4309      compilation of files previously preprocessed with `-E
4310      -fdirectives-only'.
4311
4312      With both `-E' and `-fpreprocessed', the rules for
4313      `-fpreprocessed' take precedence.  This enables full preprocessing
4314      of files previously preprocessed with `-E -fdirectives-only'.
4315
4316 `-fdollars-in-identifiers'
4317      Accept `$' in identifiers.  *Note Identifier characters::.
4318
4319 `-fextended-identifiers'
4320      Accept universal character names in identifiers.  This option is
4321      experimental; in a future version of GCC, it will be enabled by
4322      default for C99 and C++.
4323
4324 `-fpreprocessed'
4325      Indicate to the preprocessor that the input file has already been
4326      preprocessed.  This suppresses things like macro expansion,
4327      trigraph conversion, escaped newline splicing, and processing of
4328      most directives.  The preprocessor still recognizes and removes
4329      comments, so that you can pass a file preprocessed with `-C' to
4330      the compiler without problems.  In this mode the integrated
4331      preprocessor is little more than a tokenizer for the front ends.
4332
4333      `-fpreprocessed' is implicit if the input file has one of the
4334      extensions `.i', `.ii' or `.mi'.  These are the extensions that
4335      GCC uses for preprocessed files created by `-save-temps'.
4336
4337 `-ftabstop=WIDTH'
4338      Set the distance between tab stops.  This helps the preprocessor
4339      report correct column numbers in warnings or errors, even if tabs
4340      appear on the line.  If the value is less than 1 or greater than
4341      100, the option is ignored.  The default is 8.
4342
4343 `-fexec-charset=CHARSET'
4344      Set the execution character set, used for string and character
4345      constants.  The default is UTF-8.  CHARSET can be any encoding
4346      supported by the system's `iconv' library routine.
4347
4348 `-fwide-exec-charset=CHARSET'
4349      Set the wide execution character set, used for wide string and
4350      character constants.  The default is UTF-32 or UTF-16, whichever
4351      corresponds to the width of `wchar_t'.  As with `-fexec-charset',
4352      CHARSET can be any encoding supported by the system's `iconv'
4353      library routine; however, you will have problems with encodings
4354      that do not fit exactly in `wchar_t'.
4355
4356 `-finput-charset=CHARSET'
4357      Set the input character set, used for translation from the
4358      character set of the input file to the source character set used
4359      by GCC.  If the locale does not specify, or GCC cannot get this
4360      information from the locale, the default is UTF-8.  This can be
4361      overridden by either the locale or this command line option.
4362      Currently the command line option takes precedence if there's a
4363      conflict.  CHARSET can be any encoding supported by the system's
4364      `iconv' library routine.
4365
4366 `-fworking-directory'
4367      Enable generation of linemarkers in the preprocessor output that
4368      will let the compiler know the current working directory at the
4369      time of preprocessing.  When this option is enabled, the
4370      preprocessor will emit, after the initial linemarker, a second
4371      linemarker with the current working directory followed by two
4372      slashes.  GCC will use this directory, when it's present in the
4373      preprocessed input, as the directory emitted as the current
4374      working directory in some debugging information formats.  This
4375      option is implicitly enabled if debugging information is enabled,
4376      but this can be inhibited with the negated form
4377      `-fno-working-directory'.  If the `-P' flag is present in the
4378      command line, this option has no effect, since no `#line'
4379      directives are emitted whatsoever.
4380
4381 `-fno-show-column'
4382      Do not print column numbers in diagnostics.  This may be necessary
4383      if diagnostics are being scanned by a program that does not
4384      understand the column numbers, such as `dejagnu'.
4385
4386 `-A PREDICATE=ANSWER'
4387      Make an assertion with the predicate PREDICATE and answer ANSWER.
4388      This form is preferred to the older form `-A PREDICATE(ANSWER)',
4389      which is still supported, because it does not use shell special
4390      characters.  *Note Obsolete Features::.
4391
4392 `-A -PREDICATE=ANSWER'
4393      Cancel an assertion with the predicate PREDICATE and answer ANSWER.
4394
4395 `-dCHARS'
4396      CHARS is a sequence of one or more of the following characters,
4397      and must not be preceded by a space.  Other characters are
4398      interpreted by the compiler proper, or reserved for future
4399      versions of GCC, and so are silently ignored.  If you specify
4400      characters whose behavior conflicts, the result is undefined.
4401
4402     `M'
4403           Instead of the normal output, generate a list of `#define'
4404           directives for all the macros defined during the execution of
4405           the preprocessor, including predefined macros.  This gives
4406           you a way of finding out what is predefined in your version
4407           of the preprocessor.  Assuming you have no file `foo.h', the
4408           command
4409
4410                touch foo.h; cpp -dM foo.h
4411
4412           will show all the predefined macros.
4413
4414           If you use `-dM' without the `-E' option, `-dM' is
4415           interpreted as a synonym for `-fdump-rtl-mach'.  *Note
4416           Debugging Options: (gcc)Debugging Options.
4417
4418     `D'
4419           Like `M' except in two respects: it does _not_ include the
4420           predefined macros, and it outputs _both_ the `#define'
4421           directives and the result of preprocessing.  Both kinds of
4422           output go to the standard output file.
4423
4424     `N'
4425           Like `D', but emit only the macro names, not their expansions.
4426
4427     `I'
4428           Output `#include' directives in addition to the result of
4429           preprocessing.
4430
4431     `U'
4432           Like `D' except that only macros that are expanded, or whose
4433           definedness is tested in preprocessor directives, are output;
4434           the output is delayed until the use or test of the macro; and
4435           `#undef' directives are also output for macros tested but
4436           undefined at the time.
4437
4438 `-P'
4439      Inhibit generation of linemarkers in the output from the
4440      preprocessor.  This might be useful when running the preprocessor
4441      on something that is not C code, and will be sent to a program
4442      which might be confused by the linemarkers.  *Note Preprocessor
4443      Output::.
4444
4445 `-C'
4446      Do not discard comments.  All comments are passed through to the
4447      output file, except for comments in processed directives, which
4448      are deleted along with the directive.
4449
4450      You should be prepared for side effects when using `-C'; it causes
4451      the preprocessor to treat comments as tokens in their own right.
4452      For example, comments appearing at the start of what would be a
4453      directive line have the effect of turning that line into an
4454      ordinary source line, since the first token on the line is no
4455      longer a `#'.
4456
4457 `-CC'
4458      Do not discard comments, including during macro expansion.  This is
4459      like `-C', except that comments contained within macros are also
4460      passed through to the output file where the macro is expanded.
4461
4462      In addition to the side-effects of the `-C' option, the `-CC'
4463      option causes all C++-style comments inside a macro to be
4464      converted to C-style comments.  This is to prevent later use of
4465      that macro from inadvertently commenting out the remainder of the
4466      source line.
4467
4468      The `-CC' option is generally used to support lint comments.
4469
4470 `-traditional-cpp'
4471      Try to imitate the behavior of old-fashioned C preprocessors, as
4472      opposed to ISO C preprocessors.  *Note Traditional Mode::.
4473
4474 `-trigraphs'
4475      Process trigraph sequences.  *Note Initial processing::.
4476
4477 `-remap'
4478      Enable special code to work around file systems which only permit
4479      very short file names, such as MS-DOS.
4480
4481 `--help'
4482 `--target-help'
4483      Print text describing all the command line options instead of
4484      preprocessing anything.
4485
4486 `-v'
4487      Verbose mode.  Print out GNU CPP's version number at the beginning
4488      of execution, and report the final form of the include path.
4489
4490 `-H'
4491      Print the name of each header file used, in addition to other
4492      normal activities.  Each name is indented to show how deep in the
4493      `#include' stack it is.  Precompiled header files are also
4494      printed, even if they are found to be invalid; an invalid
4495      precompiled header file is printed with `...x' and a valid one
4496      with `...!' .
4497
4498 `-version'
4499 `--version'
4500      Print out GNU CPP's version number.  With one dash, proceed to
4501      preprocess as normal.  With two dashes, exit immediately.
4502
4503 \1f
4504 File: cpp.info,  Node: Environment Variables,  Next: GNU Free Documentation License,  Prev: Invocation,  Up: Top
4505
4506 13 Environment Variables
4507 ************************
4508
4509 This section describes the environment variables that affect how CPP
4510 operates.  You can use them to specify directories or prefixes to use
4511 when searching for include files, or to control dependency output.
4512
4513    Note that you can also specify places to search using options such as
4514 `-I', and control dependency output with options like `-M' (*note
4515 Invocation::).  These take precedence over environment variables, which
4516 in turn take precedence over the configuration of GCC.
4517
4518 `CPATH'
4519 `C_INCLUDE_PATH'
4520 `CPLUS_INCLUDE_PATH'
4521 `OBJC_INCLUDE_PATH'
4522      Each variable's value is a list of directories separated by a
4523      special character, much like `PATH', in which to look for header
4524      files.  The special character, `PATH_SEPARATOR', is
4525      target-dependent and determined at GCC build time.  For Microsoft
4526      Windows-based targets it is a semicolon, and for almost all other
4527      targets it is a colon.
4528
4529      `CPATH' specifies a list of directories to be searched as if
4530      specified with `-I', but after any paths given with `-I' options
4531      on the command line.  This environment variable is used regardless
4532      of which language is being preprocessed.
4533
4534      The remaining environment variables apply only when preprocessing
4535      the particular language indicated.  Each specifies a list of
4536      directories to be searched as if specified with `-isystem', but
4537      after any paths given with `-isystem' options on the command line.
4538
4539      In all these variables, an empty element instructs the compiler to
4540      search its current working directory.  Empty elements can appear
4541      at the beginning or end of a path.  For instance, if the value of
4542      `CPATH' is `:/special/include', that has the same effect as
4543      `-I. -I/special/include'.
4544
4545      See also *Note Search Path::.
4546
4547 `DEPENDENCIES_OUTPUT'
4548      If this variable is set, its value specifies how to output
4549      dependencies for Make based on the non-system header files
4550      processed by the compiler.  System header files are ignored in the
4551      dependency output.
4552
4553      The value of `DEPENDENCIES_OUTPUT' can be just a file name, in
4554      which case the Make rules are written to that file, guessing the
4555      target name from the source file name.  Or the value can have the
4556      form `FILE TARGET', in which case the rules are written to file
4557      FILE using TARGET as the target name.
4558
4559      In other words, this environment variable is equivalent to
4560      combining the options `-MM' and `-MF' (*note Invocation::), with
4561      an optional `-MT' switch too.
4562
4563 `SUNPRO_DEPENDENCIES'
4564      This variable is the same as `DEPENDENCIES_OUTPUT' (see above),
4565      except that system header files are not ignored, so it implies
4566      `-M' rather than `-MM'.  However, the dependence on the main input
4567      file is omitted.  *Note Invocation::.
4568
4569 \1f
4570 File: cpp.info,  Node: GNU Free Documentation License,  Next: Index of Directives,  Prev: Environment Variables,  Up: Top
4571
4572 GNU Free Documentation License
4573 ******************************
4574
4575                       Version 1.2, November 2002
4576
4577      Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
4578      51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
4579
4580      Everyone is permitted to copy and distribute verbatim copies
4581      of this license document, but changing it is not allowed.
4582
4583   0. PREAMBLE
4584
4585      The purpose of this License is to make a manual, textbook, or other
4586      functional and useful document "free" in the sense of freedom: to
4587      assure everyone the effective freedom to copy and redistribute it,
4588      with or without modifying it, either commercially or
4589      noncommercially.  Secondarily, this License preserves for the
4590      author and publisher a way to get credit for their work, while not
4591      being considered responsible for modifications made by others.
4592
4593      This License is a kind of "copyleft", which means that derivative
4594      works of the document must themselves be free in the same sense.
4595      It complements the GNU General Public License, which is a copyleft
4596      license designed for free software.
4597
4598      We have designed this License in order to use it for manuals for
4599      free software, because free software needs free documentation: a
4600      free program should come with manuals providing the same freedoms
4601      that the software does.  But this License is not limited to
4602      software manuals; it can be used for any textual work, regardless
4603      of subject matter or whether it is published as a printed book.
4604      We recommend this License principally for works whose purpose is
4605      instruction or reference.
4606
4607   1. APPLICABILITY AND DEFINITIONS
4608
4609      This License applies to any manual or other work, in any medium,
4610      that contains a notice placed by the copyright holder saying it
4611      can be distributed under the terms of this License.  Such a notice
4612      grants a world-wide, royalty-free license, unlimited in duration,
4613      to use that work under the conditions stated herein.  The
4614      "Document", below, refers to any such manual or work.  Any member
4615      of the public is a licensee, and is addressed as "you".  You
4616      accept the license if you copy, modify or distribute the work in a
4617      way requiring permission under copyright law.
4618
4619      A "Modified Version" of the Document means any work containing the
4620      Document or a portion of it, either copied verbatim, or with
4621      modifications and/or translated into another language.
4622
4623      A "Secondary Section" is a named appendix or a front-matter section
4624      of the Document that deals exclusively with the relationship of the
4625      publishers or authors of the Document to the Document's overall
4626      subject (or to related matters) and contains nothing that could
4627      fall directly within that overall subject.  (Thus, if the Document
4628      is in part a textbook of mathematics, a Secondary Section may not
4629      explain any mathematics.)  The relationship could be a matter of
4630      historical connection with the subject or with related matters, or
4631      of legal, commercial, philosophical, ethical or political position
4632      regarding them.
4633
4634      The "Invariant Sections" are certain Secondary Sections whose
4635      titles are designated, as being those of Invariant Sections, in
4636      the notice that says that the Document is released under this
4637      License.  If a section does not fit the above definition of
4638      Secondary then it is not allowed to be designated as Invariant.
4639      The Document may contain zero Invariant Sections.  If the Document
4640      does not identify any Invariant Sections then there are none.
4641
4642      The "Cover Texts" are certain short passages of text that are
4643      listed, as Front-Cover Texts or Back-Cover Texts, in the notice
4644      that says that the Document is released under this License.  A
4645      Front-Cover Text may be at most 5 words, and a Back-Cover Text may
4646      be at most 25 words.
4647
4648      A "Transparent" copy of the Document means a machine-readable copy,
4649      represented in a format whose specification is available to the
4650      general public, that is suitable for revising the document
4651      straightforwardly with generic text editors or (for images
4652      composed of pixels) generic paint programs or (for drawings) some
4653      widely available drawing editor, and that is suitable for input to
4654      text formatters or for automatic translation to a variety of
4655      formats suitable for input to text formatters.  A copy made in an
4656      otherwise Transparent file format whose markup, or absence of
4657      markup, has been arranged to thwart or discourage subsequent
4658      modification by readers is not Transparent.  An image format is
4659      not Transparent if used for any substantial amount of text.  A
4660      copy that is not "Transparent" is called "Opaque".
4661
4662      Examples of suitable formats for Transparent copies include plain
4663      ASCII without markup, Texinfo input format, LaTeX input format,
4664      SGML or XML using a publicly available DTD, and
4665      standard-conforming simple HTML, PostScript or PDF designed for
4666      human modification.  Examples of transparent image formats include
4667      PNG, XCF and JPG.  Opaque formats include proprietary formats that
4668      can be read and edited only by proprietary word processors, SGML or
4669      XML for which the DTD and/or processing tools are not generally
4670      available, and the machine-generated HTML, PostScript or PDF
4671      produced by some word processors for output purposes only.
4672
4673      The "Title Page" means, for a printed book, the title page itself,
4674      plus such following pages as are needed to hold, legibly, the
4675      material this License requires to appear in the title page.  For
4676      works in formats which do not have any title page as such, "Title
4677      Page" means the text near the most prominent appearance of the
4678      work's title, preceding the beginning of the body of the text.
4679
4680      A section "Entitled XYZ" means a named subunit of the Document
4681      whose title either is precisely XYZ or contains XYZ in parentheses
4682      following text that translates XYZ in another language.  (Here XYZ
4683      stands for a specific section name mentioned below, such as
4684      "Acknowledgements", "Dedications", "Endorsements", or "History".)
4685      To "Preserve the Title" of such a section when you modify the
4686      Document means that it remains a section "Entitled XYZ" according
4687      to this definition.
4688
4689      The Document may include Warranty Disclaimers next to the notice
4690      which states that this License applies to the Document.  These
4691      Warranty Disclaimers are considered to be included by reference in
4692      this License, but only as regards disclaiming warranties: any other
4693      implication that these Warranty Disclaimers may have is void and
4694      has no effect on the meaning of this License.
4695
4696   2. VERBATIM COPYING
4697
4698      You may copy and distribute the Document in any medium, either
4699      commercially or noncommercially, provided that this License, the
4700      copyright notices, and the license notice saying this License
4701      applies to the Document are reproduced in all copies, and that you
4702      add no other conditions whatsoever to those of this License.  You
4703      may not use technical measures to obstruct or control the reading
4704      or further copying of the copies you make or distribute.  However,
4705      you may accept compensation in exchange for copies.  If you
4706      distribute a large enough number of copies you must also follow
4707      the conditions in section 3.
4708
4709      You may also lend copies, under the same conditions stated above,
4710      and you may publicly display copies.
4711
4712   3. COPYING IN QUANTITY
4713
4714      If you publish printed copies (or copies in media that commonly
4715      have printed covers) of the Document, numbering more than 100, and
4716      the Document's license notice requires Cover Texts, you must
4717      enclose the copies in covers that carry, clearly and legibly, all
4718      these Cover Texts: Front-Cover Texts on the front cover, and
4719      Back-Cover Texts on the back cover.  Both covers must also clearly
4720      and legibly identify you as the publisher of these copies.  The
4721      front cover must present the full title with all words of the
4722      title equally prominent and visible.  You may add other material
4723      on the covers in addition.  Copying with changes limited to the
4724      covers, as long as they preserve the title of the Document and
4725      satisfy these conditions, can be treated as verbatim copying in
4726      other respects.
4727
4728      If the required texts for either cover are too voluminous to fit
4729      legibly, you should put the first ones listed (as many as fit
4730      reasonably) on the actual cover, and continue the rest onto
4731      adjacent pages.
4732
4733      If you publish or distribute Opaque copies of the Document
4734      numbering more than 100, you must either include a
4735      machine-readable Transparent copy along with each Opaque copy, or
4736      state in or with each Opaque copy a computer-network location from
4737      which the general network-using public has access to download
4738      using public-standard network protocols a complete Transparent
4739      copy of the Document, free of added material.  If you use the
4740      latter option, you must take reasonably prudent steps, when you
4741      begin distribution of Opaque copies in quantity, to ensure that
4742      this Transparent copy will remain thus accessible at the stated
4743      location until at least one year after the last time you
4744      distribute an Opaque copy (directly or through your agents or
4745      retailers) of that edition to the public.
4746
4747      It is requested, but not required, that you contact the authors of
4748      the Document well before redistributing any large number of
4749      copies, to give them a chance to provide you with an updated
4750      version of the Document.
4751
4752   4. MODIFICATIONS
4753
4754      You may copy and distribute a Modified Version of the Document
4755      under the conditions of sections 2 and 3 above, provided that you
4756      release the Modified Version under precisely this License, with
4757      the Modified Version filling the role of the Document, thus
4758      licensing distribution and modification of the Modified Version to
4759      whoever possesses a copy of it.  In addition, you must do these
4760      things in the Modified Version:
4761
4762        A. Use in the Title Page (and on the covers, if any) a title
4763           distinct from that of the Document, and from those of
4764           previous versions (which should, if there were any, be listed
4765           in the History section of the Document).  You may use the
4766           same title as a previous version if the original publisher of
4767           that version gives permission.
4768
4769        B. List on the Title Page, as authors, one or more persons or
4770           entities responsible for authorship of the modifications in
4771           the Modified Version, together with at least five of the
4772           principal authors of the Document (all of its principal
4773           authors, if it has fewer than five), unless they release you
4774           from this requirement.
4775
4776        C. State on the Title page the name of the publisher of the
4777           Modified Version, as the publisher.
4778
4779        D. Preserve all the copyright notices of the Document.
4780
4781        E. Add an appropriate copyright notice for your modifications
4782           adjacent to the other copyright notices.
4783
4784        F. Include, immediately after the copyright notices, a license
4785           notice giving the public permission to use the Modified
4786           Version under the terms of this License, in the form shown in
4787           the Addendum below.
4788
4789        G. Preserve in that license notice the full lists of Invariant
4790           Sections and required Cover Texts given in the Document's
4791           license notice.
4792
4793        H. Include an unaltered copy of this License.
4794
4795        I. Preserve the section Entitled "History", Preserve its Title,
4796           and add to it an item stating at least the title, year, new
4797           authors, and publisher of the Modified Version as given on
4798           the Title Page.  If there is no section Entitled "History" in
4799           the Document, create one stating the title, year, authors,
4800           and publisher of the Document as given on its Title Page,
4801           then add an item describing the Modified Version as stated in
4802           the previous sentence.
4803
4804        J. Preserve the network location, if any, given in the Document
4805           for public access to a Transparent copy of the Document, and
4806           likewise the network locations given in the Document for
4807           previous versions it was based on.  These may be placed in
4808           the "History" section.  You may omit a network location for a
4809           work that was published at least four years before the
4810           Document itself, or if the original publisher of the version
4811           it refers to gives permission.
4812
4813        K. For any section Entitled "Acknowledgements" or "Dedications",
4814           Preserve the Title of the section, and preserve in the
4815           section all the substance and tone of each of the contributor
4816           acknowledgements and/or dedications given therein.
4817
4818        L. Preserve all the Invariant Sections of the Document,
4819           unaltered in their text and in their titles.  Section numbers
4820           or the equivalent are not considered part of the section
4821           titles.
4822
4823        M. Delete any section Entitled "Endorsements".  Such a section
4824           may not be included in the Modified Version.
4825
4826        N. Do not retitle any existing section to be Entitled
4827           "Endorsements" or to conflict in title with any Invariant
4828           Section.
4829
4830        O. Preserve any Warranty Disclaimers.
4831
4832      If the Modified Version includes new front-matter sections or
4833      appendices that qualify as Secondary Sections and contain no
4834      material copied from the Document, you may at your option
4835      designate some or all of these sections as invariant.  To do this,
4836      add their titles to the list of Invariant Sections in the Modified
4837      Version's license notice.  These titles must be distinct from any
4838      other section titles.
4839
4840      You may add a section Entitled "Endorsements", provided it contains
4841      nothing but endorsements of your Modified Version by various
4842      parties--for example, statements of peer review or that the text
4843      has been approved by an organization as the authoritative
4844      definition of a standard.
4845
4846      You may add a passage of up to five words as a Front-Cover Text,
4847      and a passage of up to 25 words as a Back-Cover Text, to the end
4848      of the list of Cover Texts in the Modified Version.  Only one
4849      passage of Front-Cover Text and one of Back-Cover Text may be
4850      added by (or through arrangements made by) any one entity.  If the
4851      Document already includes a cover text for the same cover,
4852      previously added by you or by arrangement made by the same entity
4853      you are acting on behalf of, you may not add another; but you may
4854      replace the old one, on explicit permission from the previous
4855      publisher that added the old one.
4856
4857      The author(s) and publisher(s) of the Document do not by this
4858      License give permission to use their names for publicity for or to
4859      assert or imply endorsement of any Modified Version.
4860
4861   5. COMBINING DOCUMENTS
4862
4863      You may combine the Document with other documents released under
4864      this License, under the terms defined in section 4 above for
4865      modified versions, provided that you include in the combination
4866      all of the Invariant Sections of all of the original documents,
4867      unmodified, and list them all as Invariant Sections of your
4868      combined work in its license notice, and that you preserve all
4869      their Warranty Disclaimers.
4870
4871      The combined work need only contain one copy of this License, and
4872      multiple identical Invariant Sections may be replaced with a single
4873      copy.  If there are multiple Invariant Sections with the same name
4874      but different contents, make the title of each such section unique
4875      by adding at the end of it, in parentheses, the name of the
4876      original author or publisher of that section if known, or else a
4877      unique number.  Make the same adjustment to the section titles in
4878      the list of Invariant Sections in the license notice of the
4879      combined work.
4880
4881      In the combination, you must combine any sections Entitled
4882      "History" in the various original documents, forming one section
4883      Entitled "History"; likewise combine any sections Entitled
4884      "Acknowledgements", and any sections Entitled "Dedications".  You
4885      must delete all sections Entitled "Endorsements."
4886
4887   6. COLLECTIONS OF DOCUMENTS
4888
4889      You may make a collection consisting of the Document and other
4890      documents released under this License, and replace the individual
4891      copies of this License in the various documents with a single copy
4892      that is included in the collection, provided that you follow the
4893      rules of this License for verbatim copying of each of the
4894      documents in all other respects.
4895
4896      You may extract a single document from such a collection, and
4897      distribute it individually under this License, provided you insert
4898      a copy of this License into the extracted document, and follow
4899      this License in all other respects regarding verbatim copying of
4900      that document.
4901
4902   7. AGGREGATION WITH INDEPENDENT WORKS
4903
4904      A compilation of the Document or its derivatives with other
4905      separate and independent documents or works, in or on a volume of
4906      a storage or distribution medium, is called an "aggregate" if the
4907      copyright resulting from the compilation is not used to limit the
4908      legal rights of the compilation's users beyond what the individual
4909      works permit.  When the Document is included in an aggregate, this
4910      License does not apply to the other works in the aggregate which
4911      are not themselves derivative works of the Document.
4912
4913      If the Cover Text requirement of section 3 is applicable to these
4914      copies of the Document, then if the Document is less than one half
4915      of the entire aggregate, the Document's Cover Texts may be placed
4916      on covers that bracket the Document within the aggregate, or the
4917      electronic equivalent of covers if the Document is in electronic
4918      form.  Otherwise they must appear on printed covers that bracket
4919      the whole aggregate.
4920
4921   8. TRANSLATION
4922
4923      Translation is considered a kind of modification, so you may
4924      distribute translations of the Document under the terms of section
4925      4.  Replacing Invariant Sections with translations requires special
4926      permission from their copyright holders, but you may include
4927      translations of some or all Invariant Sections in addition to the
4928      original versions of these Invariant Sections.  You may include a
4929      translation of this License, and all the license notices in the
4930      Document, and any Warranty Disclaimers, provided that you also
4931      include the original English version of this License and the
4932      original versions of those notices and disclaimers.  In case of a
4933      disagreement between the translation and the original version of
4934      this License or a notice or disclaimer, the original version will
4935      prevail.
4936
4937      If a section in the Document is Entitled "Acknowledgements",
4938      "Dedications", or "History", the requirement (section 4) to
4939      Preserve its Title (section 1) will typically require changing the
4940      actual title.
4941
4942   9. TERMINATION
4943
4944      You may not copy, modify, sublicense, or distribute the Document
4945      except as expressly provided for under this License.  Any other
4946      attempt to copy, modify, sublicense or distribute the Document is
4947      void, and will automatically terminate your rights under this
4948      License.  However, parties who have received copies, or rights,
4949      from you under this License will not have their licenses
4950      terminated so long as such parties remain in full compliance.
4951
4952  10. FUTURE REVISIONS OF THIS LICENSE
4953
4954      The Free Software Foundation may publish new, revised versions of
4955      the GNU Free Documentation License from time to time.  Such new
4956      versions will be similar in spirit to the present version, but may
4957      differ in detail to address new problems or concerns.  See
4958      `http://www.gnu.org/copyleft/'.
4959
4960      Each version of the License is given a distinguishing version
4961      number.  If the Document specifies that a particular numbered
4962      version of this License "or any later version" applies to it, you
4963      have the option of following the terms and conditions either of
4964      that specified version or of any later version that has been
4965      published (not as a draft) by the Free Software Foundation.  If
4966      the Document does not specify a version number of this License,
4967      you may choose any version ever published (not as a draft) by the
4968      Free Software Foundation.
4969
4970 ADDENDUM: How to use this License for your documents
4971 ====================================================
4972
4973 To use this License in a document you have written, include a copy of
4974 the License in the document and put the following copyright and license
4975 notices just after the title page:
4976
4977        Copyright (C)  YEAR  YOUR NAME.
4978        Permission is granted to copy, distribute and/or modify this document
4979        under the terms of the GNU Free Documentation License, Version 1.2
4980        or any later version published by the Free Software Foundation;
4981        with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
4982        Texts.  A copy of the license is included in the section entitled ``GNU
4983        Free Documentation License''.
4984
4985    If you have Invariant Sections, Front-Cover Texts and Back-Cover
4986 Texts, replace the "with...Texts." line with this:
4987
4988          with the Invariant Sections being LIST THEIR TITLES, with
4989          the Front-Cover Texts being LIST, and with the Back-Cover Texts
4990          being LIST.
4991
4992    If you have Invariant Sections without Cover Texts, or some other
4993 combination of the three, merge those two alternatives to suit the
4994 situation.
4995
4996    If your document contains nontrivial examples of program code, we
4997 recommend releasing these examples in parallel under your choice of
4998 free software license, such as the GNU General Public License, to
4999 permit their use in free software.
5000
5001 \1f
5002 File: cpp.info,  Node: Index of Directives,  Next: Option Index,  Prev: GNU Free Documentation License,  Up: Top
5003
5004 Index of Directives
5005 *******************
5006
5007 \0\b[index\0\b]
5008 * Menu:
5009
5010 * #assert:                               Obsolete Features.    (line 48)
5011 * #define:                               Object-like Macros.   (line 11)
5012 * #elif:                                 Elif.                 (line  6)
5013 * #else:                                 Else.                 (line  6)
5014 * #endif:                                Ifdef.                (line  6)
5015 * #error:                                Diagnostics.          (line  6)
5016 * #ident:                                Other Directives.     (line  6)
5017 * #if:                                   Conditional Syntax.   (line  6)
5018 * #ifdef:                                Ifdef.                (line  6)
5019 * #ifndef:                               Ifdef.                (line 40)
5020 * #import:                               Alternatives to Wrapper #ifndef.
5021                                                                (line 11)
5022 * #include:                              Include Syntax.       (line  6)
5023 * #include_next:                         Wrapper Headers.      (line  6)
5024 * #line:                                 Line Control.         (line 20)
5025 * #pragma GCC dependency:                Pragmas.              (line 53)
5026 * #pragma GCC poison:                    Pragmas.              (line 65)
5027 * #pragma GCC system_header <1>:         Pragmas.              (line 92)
5028 * #pragma GCC system_header:             System Headers.       (line 31)
5029 * #sccs:                                 Other Directives.     (line  6)
5030 * #unassert:                             Obsolete Features.    (line 59)
5031 * #undef:                                Undefining and Redefining Macros.
5032                                                                (line  6)
5033 * #warning:                              Diagnostics.          (line 27)
5034
5035 \1f
5036 File: cpp.info,  Node: Option Index,  Next: Concept Index,  Prev: Index of Directives,  Up: Top
5037
5038 Option Index
5039 ************
5040
5041 CPP's command line options and environment variables are indexed here
5042 without any initial `-' or `--'.
5043
5044 \0\b[index\0\b]
5045 * Menu:
5046
5047 * A:                                     Invocation.          (line 522)
5048 * ansi:                                  Invocation.          (line 308)
5049 * C:                                     Invocation.          (line 581)
5050 * C_INCLUDE_PATH:                        Environment Variables.
5051                                                               (line  16)
5052 * CPATH:                                 Environment Variables.
5053                                                               (line  15)
5054 * CPLUS_INCLUDE_PATH:                    Environment Variables.
5055                                                               (line  17)
5056 * D:                                     Invocation.          (line  39)
5057 * dD:                                    Invocation.          (line 554)
5058 * DEPENDENCIES_OUTPUT:                   Environment Variables.
5059                                                               (line  44)
5060 * dI:                                    Invocation.          (line 563)
5061 * dM:                                    Invocation.          (line 538)
5062 * dN:                                    Invocation.          (line 560)
5063 * dU:                                    Invocation.          (line 567)
5064 * fdirectives-only:                      Invocation.          (line 430)
5065 * fdollars-in-identifiers:               Invocation.          (line 452)
5066 * fexec-charset:                         Invocation.          (line 479)
5067 * fextended-identifiers:                 Invocation.          (line 455)
5068 * finput-charset:                        Invocation.          (line 492)
5069 * fno-show-column:                       Invocation.          (line 517)
5070 * fno-working-directory:                 Invocation.          (line 502)
5071 * fpreprocessed:                         Invocation.          (line 460)
5072 * ftabstop:                              Invocation.          (line 473)
5073 * fwide-exec-charset:                    Invocation.          (line 484)
5074 * fworking-directory:                    Invocation.          (line 502)
5075 * H:                                     Invocation.          (line 626)
5076 * help:                                  Invocation.          (line 618)
5077 * I:                                     Invocation.          (line  71)
5078 * I-:                                    Invocation.          (line 345)
5079 * idirafter:                             Invocation.          (line 387)
5080 * imacros:                               Invocation.          (line 378)
5081 * imultilib:                             Invocation.          (line 410)
5082 * include:                               Invocation.          (line 367)
5083 * iprefix:                               Invocation.          (line 394)
5084 * iquote:                                Invocation.          (line 422)
5085 * isysroot:                              Invocation.          (line 406)
5086 * isystem:                               Invocation.          (line 414)
5087 * iwithprefix:                           Invocation.          (line 400)
5088 * iwithprefixbefore:                     Invocation.          (line 400)
5089 * M:                                     Invocation.          (line 180)
5090 * MD:                                    Invocation.          (line 269)
5091 * MF:                                    Invocation.          (line 215)
5092 * MG:                                    Invocation.          (line 224)
5093 * MM:                                    Invocation.          (line 205)
5094 * MMD:                                   Invocation.          (line 285)
5095 * MP:                                    Invocation.          (line 234)
5096 * MQ:                                    Invocation.          (line 260)
5097 * MT:                                    Invocation.          (line 246)
5098 * nostdinc:                              Invocation.          (line 357)
5099 * nostdinc++:                            Invocation.          (line 362)
5100 * o:                                     Invocation.          (line  82)
5101 * OBJC_INCLUDE_PATH:                     Environment Variables.
5102                                                               (line  18)
5103 * P:                                     Invocation.          (line 574)
5104 * pedantic:                              Invocation.          (line 170)
5105 * pedantic-errors:                       Invocation.          (line 175)
5106 * remap:                                 Invocation.          (line 613)
5107 * std=:                                  Invocation.          (line 308)
5108 * SUNPRO_DEPENDENCIES:                   Environment Variables.
5109                                                               (line  60)
5110 * target-help:                           Invocation.          (line 618)
5111 * traditional-cpp:                       Invocation.          (line 606)
5112 * trigraphs:                             Invocation.          (line 610)
5113 * U:                                     Invocation.          (line  62)
5114 * undef:                                 Invocation.          (line  66)
5115 * v:                                     Invocation.          (line 622)
5116 * version:                               Invocation.          (line 635)
5117 * w:                                     Invocation.          (line 166)
5118 * Wall:                                  Invocation.          (line  88)
5119 * Wcomment:                              Invocation.          (line  96)
5120 * Wcomments:                             Invocation.          (line  96)
5121 * Wendif-labels:                         Invocation.          (line 143)
5122 * Werror:                                Invocation.          (line 156)
5123 * Wsystem-headers:                       Invocation.          (line 160)
5124 * Wtraditional:                          Invocation.          (line 113)
5125 * Wtrigraphs:                            Invocation.          (line 101)
5126 * Wundef:                                Invocation.          (line 119)
5127 * Wunused-macros:                        Invocation.          (line 124)
5128 * x:                                     Invocation.          (line 292)
5129
5130 \1f
5131 File: cpp.info,  Node: Concept Index,  Prev: Option Index,  Up: Top
5132
5133 Concept Index
5134 *************
5135
5136 \0\b[index\0\b]
5137 * Menu:
5138
5139 * # operator:                            Stringification.     (line   6)
5140 * ## operator:                           Concatenation.       (line   6)
5141 * _Pragma:                               Pragmas.             (line  25)
5142 * alternative tokens:                    Tokenization.        (line 106)
5143 * arguments:                             Macro Arguments.     (line   6)
5144 * arguments in macro definitions:        Macro Arguments.     (line   6)
5145 * assertions:                            Obsolete Features.   (line  13)
5146 * assertions, canceling:                 Obsolete Features.   (line  59)
5147 * backslash-newline:                     Initial processing.  (line  61)
5148 * block comments:                        Initial processing.  (line  77)
5149 * C++ named operators:                   C++ Named Operators. (line   6)
5150 * character constants:                   Tokenization.        (line  85)
5151 * character set, execution:              Invocation.          (line 479)
5152 * character set, input:                  Invocation.          (line 492)
5153 * character set, wide execution:         Invocation.          (line 484)
5154 * command line:                          Invocation.          (line   6)
5155 * commenting out code:                   Deleted Code.        (line   6)
5156 * comments:                              Initial processing.  (line  77)
5157 * common predefined macros:              Common Predefined Macros.
5158                                                               (line   6)
5159 * computed includes:                     Computed Includes.   (line   6)
5160 * concatenation:                         Concatenation.       (line   6)
5161 * conditional group:                     Ifdef.               (line  14)
5162 * conditionals:                          Conditionals.        (line   6)
5163 * continued lines:                       Initial processing.  (line  61)
5164 * controlling macro:                     Once-Only Headers.   (line  35)
5165 * defined:                               Defined.             (line   6)
5166 * dependencies for make as output:       Environment Variables.
5167                                                               (line  45)
5168 * dependencies, make:                    Invocation.          (line 180)
5169 * diagnostic:                            Diagnostics.         (line   6)
5170 * differences from previous versions:    Differences from previous versions.
5171                                                               (line   6)
5172 * digraphs:                              Tokenization.        (line 106)
5173 * directive line:                        The preprocessing language.
5174                                                               (line   6)
5175 * directive name:                        The preprocessing language.
5176                                                               (line   6)
5177 * directives:                            The preprocessing language.
5178                                                               (line   6)
5179 * empty macro arguments:                 Macro Arguments.     (line  66)
5180 * environment variables:                 Environment Variables.
5181                                                               (line   6)
5182 * expansion of arguments:                Argument Prescan.    (line   6)
5183 * FDL, GNU Free Documentation License:   GNU Free Documentation License.
5184                                                               (line   6)
5185 * function-like macros:                  Function-like Macros.
5186                                                               (line   6)
5187 * grouping options:                      Invocation.          (line  34)
5188 * guard macro:                           Once-Only Headers.   (line  35)
5189 * header file:                           Header Files.        (line   6)
5190 * header file names:                     Tokenization.        (line  85)
5191 * identifiers:                           Tokenization.        (line  34)
5192 * implementation limits:                 Implementation limits.
5193                                                               (line   6)
5194 * implementation-defined behavior:       Implementation-defined behavior.
5195                                                               (line   6)
5196 * including just once:                   Once-Only Headers.   (line   6)
5197 * invocation:                            Invocation.          (line   6)
5198 * iso646.h:                              C++ Named Operators. (line   6)
5199 * line comments:                         Initial processing.  (line  77)
5200 * line control:                          Line Control.        (line   6)
5201 * line endings:                          Initial processing.  (line  14)
5202 * linemarkers:                           Preprocessor Output. (line  28)
5203 * macro argument expansion:              Argument Prescan.    (line   6)
5204 * macro arguments and directives:        Directives Within Macro Arguments.
5205                                                               (line   6)
5206 * macros in include:                     Computed Includes.   (line   6)
5207 * macros with arguments:                 Macro Arguments.     (line   6)
5208 * macros with variable arguments:        Variadic Macros.     (line   6)
5209 * make:                                  Invocation.          (line 180)
5210 * manifest constants:                    Object-like Macros.  (line   6)
5211 * named operators:                       C++ Named Operators. (line   6)
5212 * newlines in macro arguments:           Newlines in Arguments.
5213                                                               (line   6)
5214 * null directive:                        Other Directives.    (line  17)
5215 * numbers:                               Tokenization.        (line  61)
5216 * object-like macro:                     Object-like Macros.  (line   6)
5217 * options:                               Invocation.          (line  38)
5218 * options, grouping:                     Invocation.          (line  34)
5219 * other tokens:                          Tokenization.        (line 120)
5220 * output format:                         Preprocessor Output. (line  12)
5221 * overriding a header file:              Wrapper Headers.     (line   6)
5222 * parentheses in macro bodies:           Operator Precedence Problems.
5223                                                               (line   6)
5224 * pitfalls of macros:                    Macro Pitfalls.      (line   6)
5225 * predefined macros:                     Predefined Macros.   (line   6)
5226 * predefined macros, system-specific:    System-specific Predefined Macros.
5227                                                               (line   6)
5228 * predicates:                            Obsolete Features.   (line  26)
5229 * preprocessing directives:              The preprocessing language.
5230                                                               (line   6)
5231 * preprocessing numbers:                 Tokenization.        (line  61)
5232 * preprocessing tokens:                  Tokenization.        (line   6)
5233 * prescan of macro arguments:            Argument Prescan.    (line   6)
5234 * problems with macros:                  Macro Pitfalls.      (line   6)
5235 * punctuators:                           Tokenization.        (line 106)
5236 * redefining macros:                     Undefining and Redefining Macros.
5237                                                               (line   6)
5238 * repeated inclusion:                    Once-Only Headers.   (line   6)
5239 * reporting errors:                      Diagnostics.         (line   6)
5240 * reporting warnings:                    Diagnostics.         (line   6)
5241 * reserved namespace:                    System-specific Predefined Macros.
5242                                                               (line   6)
5243 * self-reference:                        Self-Referential Macros.
5244                                                               (line   6)
5245 * semicolons (after macro calls):        Swallowing the Semicolon.
5246                                                               (line   6)
5247 * side effects (in macro arguments):     Duplication of Side Effects.
5248                                                               (line   6)
5249 * standard predefined macros.:           Standard Predefined Macros.
5250                                                               (line   6)
5251 * string constants:                      Tokenization.        (line  85)
5252 * string literals:                       Tokenization.        (line  85)
5253 * stringification:                       Stringification.     (line   6)
5254 * symbolic constants:                    Object-like Macros.  (line   6)
5255 * system header files <1>:               System Headers.      (line   6)
5256 * system header files:                   Header Files.        (line  13)
5257 * system-specific predefined macros:     System-specific Predefined Macros.
5258                                                               (line   6)
5259 * testing predicates:                    Obsolete Features.   (line  37)
5260 * token concatenation:                   Concatenation.       (line   6)
5261 * token pasting:                         Concatenation.       (line   6)
5262 * tokens:                                Tokenization.        (line   6)
5263 * trigraphs:                             Initial processing.  (line  32)
5264 * undefining macros:                     Undefining and Redefining Macros.
5265                                                               (line   6)
5266 * unsafe macros:                         Duplication of Side Effects.
5267                                                               (line   6)
5268 * variable number of arguments:          Variadic Macros.     (line   6)
5269 * variadic macros:                       Variadic Macros.     (line   6)
5270 * wrapper #ifndef:                       Once-Only Headers.   (line   6)
5271 * wrapper headers:                       Wrapper Headers.     (line   6)
5272
5273
5274 \1f
5275 Tag Table:
5276 Node: Top\7f1117
5277 Node: Overview\7f3831
5278 Node: Character sets\7f6652
5279 Ref: Character sets-Footnote-1\7f8835
5280 Node: Initial processing\7f9016
5281 Ref: trigraphs\7f10575
5282 Node: Tokenization\7f14777
5283 Ref: Tokenization-Footnote-1\7f21913
5284 Node: The preprocessing language\7f22024
5285 Node: Header Files\7f24902
5286 Node: Include Syntax\7f26818
5287 Node: Include Operation\7f28455
5288 Node: Search Path\7f30303
5289 Node: Once-Only Headers\7f33493
5290 Node: Alternatives to Wrapper #ifndef\7f35152
5291 Node: Computed Includes\7f36895
5292 Node: Wrapper Headers\7f40053
5293 Node: System Headers\7f42479
5294 Node: Macros\7f44529
5295 Node: Object-like Macros\7f45670
5296 Node: Function-like Macros\7f49260
5297 Node: Macro Arguments\7f50876
5298 Node: Stringification\7f55021
5299 Node: Concatenation\7f58227
5300 Node: Variadic Macros\7f61335
5301 Node: Predefined Macros\7f66122
5302 Node: Standard Predefined Macros\7f66710
5303 Node: Common Predefined Macros\7f72646
5304 Node: System-specific Predefined Macros\7f85556
5305 Node: C++ Named Operators\7f87577
5306 Node: Undefining and Redefining Macros\7f88541
5307 Node: Directives Within Macro Arguments\7f90645
5308 Node: Macro Pitfalls\7f92193
5309 Node: Misnesting\7f92726
5310 Node: Operator Precedence Problems\7f93838
5311 Node: Swallowing the Semicolon\7f95704
5312 Node: Duplication of Side Effects\7f97727
5313 Node: Self-Referential Macros\7f99910
5314 Node: Argument Prescan\7f102319
5315 Node: Newlines in Arguments\7f106073
5316 Node: Conditionals\7f107024
5317 Node: Conditional Uses\7f108854
5318 Node: Conditional Syntax\7f110212
5319 Node: Ifdef\7f110532
5320 Node: If\7f113693
5321 Node: Defined\7f115997
5322 Node: Else\7f117280
5323 Node: Elif\7f117850
5324 Node: Deleted Code\7f119139
5325 Node: Diagnostics\7f120386
5326 Node: Line Control\7f122003
5327 Node: Pragmas\7f125807
5328 Node: Other Directives\7f130077
5329 Node: Preprocessor Output\7f131184
5330 Node: Traditional Mode\7f134385
5331 Node: Traditional lexical analysis\7f135443
5332 Node: Traditional macros\7f137946
5333 Node: Traditional miscellany\7f141748
5334 Node: Traditional warnings\7f142745
5335 Node: Implementation Details\7f144942
5336 Node: Implementation-defined behavior\7f145563
5337 Ref: Identifier characters\7f146315
5338 Node: Implementation limits\7f149390
5339 Node: Obsolete Features\7f152064
5340 Node: Differences from previous versions\7f154901
5341 Node: Invocation\7f159109
5342 Ref: Wtrigraphs\7f163561
5343 Ref: dashMF\7f168336
5344 Ref: fdollars-in-identifiers\7f177719
5345 Node: Environment Variables\7f185882
5346 Node: GNU Free Documentation License\7f188848
5347 Node: Index of Directives\7f211281
5348 Node: Option Index\7f213215
5349 Node: Concept Index\7f219399
5350 \1f
5351 End Tag Table