1<html lang="en"> 2<head> 3<title>Preprocessor Output - The C Preprocessor</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="The C Preprocessor"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="Other-Directives.html#Other-Directives" title="Other Directives"> 9<link rel="next" href="Traditional-Mode.html#Traditional-Mode" title="Traditional Mode"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 131997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 142008, 2009, 2010, 2011 15Free Software Foundation, Inc. 16 17Permission is granted to copy, distribute and/or modify this document 18under the terms of the GNU Free Documentation License, Version 1.3 or 19any later version published by the Free Software Foundation. A copy of 20the license is included in the 21section entitled ``GNU Free Documentation License''. 22 23This manual contains no Invariant Sections. The Front-Cover Texts are 24(a) (see below), and the Back-Cover Texts are (b) (see below). 25 26(a) The FSF's Front-Cover Text is: 27 28 A GNU Manual 29 30(b) The FSF's Back-Cover Text is: 31 32 You have freedom to copy and modify this GNU Manual, like GNU 33 software. Copies published by the Free Software Foundation raise 34 funds for GNU development. 35--> 36<meta http-equiv="Content-Style-Type" content="text/css"> 37<style type="text/css"><!-- 38 pre.display { font-family:inherit } 39 pre.format { font-family:inherit } 40 pre.smalldisplay { font-family:inherit; font-size:smaller } 41 pre.smallformat { font-family:inherit; font-size:smaller } 42 pre.smallexample { font-size:smaller } 43 pre.smalllisp { font-size:smaller } 44 span.sc { font-variant:small-caps } 45 span.roman { font-family:serif; font-weight:normal; } 46 span.sansserif { font-family:sans-serif; font-weight:normal; } 47--></style> 48<link rel="stylesheet" type="text/css" href="../cs.css"> 49</head> 50<body> 51<div class="node"> 52<a name="Preprocessor-Output"></a> 53<p> 54Next: <a rel="next" accesskey="n" href="Traditional-Mode.html#Traditional-Mode">Traditional Mode</a>, 55Previous: <a rel="previous" accesskey="p" href="Other-Directives.html#Other-Directives">Other Directives</a>, 56Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 57<hr> 58</div> 59 60<h2 class="chapter">9 Preprocessor Output</h2> 61 62<p>When the C preprocessor is used with the C, C++, or Objective-C 63compilers, it is integrated into the compiler and communicates a stream 64of binary tokens directly to the compiler's parser. However, it can 65also be used in the more conventional standalone mode, where it produces 66textual output. 67<!-- FIXME: Document the library interface. --> 68 69 <p><a name="index-output-format-107"></a>The output from the C preprocessor looks much like the input, except 70that all preprocessing directive lines have been replaced with blank 71lines and all comments with spaces. Long runs of blank lines are 72discarded. 73 74 <p>The ISO standard specifies that it is implementation defined whether a 75preprocessor preserves whitespace between tokens, or replaces it with 76e.g. a single space. In GNU CPP, whitespace between tokens is collapsed 77to become a single space, with the exception that the first token on a 78non-directive line is preceded with sufficient spaces that it appears in 79the same column in the preprocessed output that it appeared in the 80original source file. This is so the output is easy to read. 81See <a href="Differences-from-previous-versions.html#Differences-from-previous-versions">Differences from previous versions</a>. CPP does not insert any 82whitespace where there was none in the original source, except where 83necessary to prevent an accidental token paste. 84 85 <p><a name="index-linemarkers-108"></a>Source file name and line number information is conveyed by lines 86of the form 87 88<pre class="smallexample"> # <var>linenum</var> <var>filename</var> <var>flags</var> 89</pre> 90 <p class="noindent">These are called <dfn>linemarkers</dfn>. They are inserted as needed into 91the output (but never within a string or character constant). They mean 92that the following line originated in file <var>filename</var> at line 93<var>linenum</var>. <var>filename</var> will never contain any non-printing 94characters; they are replaced with octal escape sequences. 95 96 <p>After the file name comes zero or more flags, which are ‘<samp><span class="samp">1</span></samp>’, 97‘<samp><span class="samp">2</span></samp>’, ‘<samp><span class="samp">3</span></samp>’, or ‘<samp><span class="samp">4</span></samp>’. If there are multiple flags, spaces 98separate them. Here is what the flags mean: 99 100 <dl> 101<dt>‘<samp><span class="samp">1</span></samp>’<dd>This indicates the start of a new file. 102<br><dt>‘<samp><span class="samp">2</span></samp>’<dd>This indicates returning to a file (after having included another file). 103<br><dt>‘<samp><span class="samp">3</span></samp>’<dd>This indicates that the following text comes from a system header file, 104so certain warnings should be suppressed. 105<br><dt>‘<samp><span class="samp">4</span></samp>’<dd>This indicates that the following text should be treated as being 106wrapped in an implicit <code>extern "C"</code> block. 107<!-- maybe cross reference NO_IMPLICIT_EXTERN_C --> 108</dl> 109 110 <p>As an extension, the preprocessor accepts linemarkers in non-assembler 111input files. They are treated like the corresponding ‘<samp><span class="samp">#line</span></samp>’ 112directive, (see <a href="Line-Control.html#Line-Control">Line Control</a>), except that trailing flags are 113permitted, and are interpreted with the meanings described above. If 114multiple flags are given, they must be in ascending order. 115 116 <p>Some directives may be duplicated in the output of the preprocessor. 117These are ‘<samp><span class="samp">#ident</span></samp>’ (always), ‘<samp><span class="samp">#pragma</span></samp>’ (only if the 118preprocessor does not handle the pragma itself), and ‘<samp><span class="samp">#define</span></samp>’ and 119‘<samp><span class="samp">#undef</span></samp>’ (with certain debugging options). If this happens, the 120‘<samp><span class="samp">#</span></samp>’ of the directive will always be in the first column, and there 121will be no space between the ‘<samp><span class="samp">#</span></samp>’ and the directive name. If macro 122expansion happens to generate tokens which might be mistaken for a 123duplicated directive, a space will be inserted between the ‘<samp><span class="samp">#</span></samp>’ and 124the directive name. 125 126 </body></html> 127 128