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