home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !gcc / docs / cpp < prev    next >
Encoding:
Text File  |  2004-09-05  |  217.3 KB  |  5,168 lines

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