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