cpp: Preprocessor Output

1 
1 9 Preprocessor Output
1 *********************
1 
1 When the C preprocessor is used with the C, C++, or Objective-C
1 compilers, it is integrated into the compiler and communicates a stream
1 of binary tokens directly to the compiler's parser.  However, it can
1 also be used in the more conventional standalone mode, where it produces
1 textual output.
1 
1    The output from the C preprocessor looks much like the input, except
1 that all preprocessing directive lines have been replaced with blank
1 lines and all comments with spaces.  Long runs of blank lines are
1 discarded.
1 
1    The ISO standard specifies that it is implementation defined whether
1 a preprocessor preserves whitespace between tokens, or replaces it with
1 e.g. a single space.  In GNU CPP, whitespace between tokens is collapsed
1 to become a single space, with the exception that the first token on a
1 non-directive line is preceded with sufficient spaces that it appears in
1 the same column in the preprocessed output that it appeared in the
1 original source file.  This is so the output is easy to read.  CPP does
1 not insert any whitespace where there was none in the original source,
1 except where necessary to prevent an accidental token paste.
1 
1    Source file name and line number information is conveyed by lines of
1 the form
1 
1      # LINENUM FILENAME FLAGS
1 
1 These are called "linemarkers".  They are inserted as needed into the
1 output (but never within a string or character constant).  They mean
1 that the following line originated in file FILENAME at line LINENUM.
1 FILENAME will never contain any non-printing characters; they are
1 replaced with octal escape sequences.
1 
1    After the file name comes zero or more flags, which are '1', '2',
1 '3', or '4'.  If there are multiple flags, spaces separate them.  Here
1 is what the flags mean:
1 
1 '1'
1      This indicates the start of a new file.
1 '2'
1      This indicates returning to a file (after having included another
1      file).
1 '3'
1      This indicates that the following text comes from a system header
1      file, so certain warnings should be suppressed.
1 '4'
1      This indicates that the following text should be treated as being
1      wrapped in an implicit 'extern "C"' block.
1 
1    As an extension, the preprocessor accepts linemarkers in
1 non-assembler input files.  They are treated like the corresponding
1 '#line' directive, (⇒Line Control), except that trailing flags
1 are permitted, and are interpreted with the meanings described above.
1 If multiple flags are given, they must be in ascending order.
1 
1    Some directives may be duplicated in the output of the preprocessor.
1 These are '#ident' (always), '#pragma' (only if the preprocessor does
1 not handle the pragma itself), and '#define' and '#undef' (with certain
1 debugging options).  If this happens, the '#' of the directive will
1 always be in the first column, and there will be no space between the
1 '#' and the directive name.  If macro expansion happens to generate
1 tokens which might be mistaken for a duplicated directive, a space will
1 be inserted between the '#' and the directive name.
1