1<html lang="en"> 2<head> 3<title>Preprocessor Options - Using the GNU Compiler Collection (GCC)</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Using the GNU Compiler Collection (GCC)"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Invoking-GCC.html#Invoking-GCC" title="Invoking GCC"> 9<link rel="prev" href="Optimize-Options.html#Optimize-Options" title="Optimize Options"> 10<link rel="next" href="Assembler-Options.html#Assembler-Options" title="Assembler Options"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 141998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 152010 Free 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; with the 20Invariant Sections being ``Funding Free Software'', the Front-Cover 21Texts being (a) (see below), and with the Back-Cover Texts being (b) 22(see below). A copy of the license is included in the section entitled 23``GNU Free Documentation License''. 24 25(a) The FSF's Front-Cover Text is: 26 27 A GNU Manual 28 29(b) The FSF's Back-Cover Text is: 30 31 You have freedom to copy and modify this GNU Manual, like GNU 32 software. Copies published by the Free Software Foundation raise 33 funds for GNU development.--> 34<meta http-equiv="Content-Style-Type" content="text/css"> 35<style type="text/css"><!-- 36 pre.display { font-family:inherit } 37 pre.format { font-family:inherit } 38 pre.smalldisplay { font-family:inherit; font-size:smaller } 39 pre.smallformat { font-family:inherit; font-size:smaller } 40 pre.smallexample { font-size:smaller } 41 pre.smalllisp { font-size:smaller } 42 span.sc { font-variant:small-caps } 43 span.roman { font-family:serif; font-weight:normal; } 44 span.sansserif { font-family:sans-serif; font-weight:normal; } 45--></style> 46<link rel="stylesheet" type="text/css" href="../cs.css"> 47</head> 48<body> 49<div class="node"> 50<a name="Preprocessor-Options"></a> 51<p> 52Next: <a rel="next" accesskey="n" href="Assembler-Options.html#Assembler-Options">Assembler Options</a>, 53Previous: <a rel="previous" accesskey="p" href="Optimize-Options.html#Optimize-Options">Optimize Options</a>, 54Up: <a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking-GCC">Invoking GCC</a> 55<hr> 56</div> 57 58<h3 class="section">3.11 Options Controlling the Preprocessor</h3> 59 60<p><a name="index-preprocessor-options-884"></a><a name="index-options_002c-preprocessor-885"></a> 61These options control the C preprocessor, which is run on each C source 62file before actual compilation. 63 64 <p>If you use the <samp><span class="option">-E</span></samp> option, nothing is done except preprocessing. 65Some of these options make sense only together with <samp><span class="option">-E</span></samp> because 66they cause the preprocessor output to be unsuitable for actual 67compilation. 68 69 <dl> 70<dt><code>-Wp,</code><var>option</var><dd><a name="index-Wp-886"></a>You can use <samp><span class="option">-Wp,</span><var>option</var></samp> to bypass the compiler driver 71and pass <var>option</var> directly through to the preprocessor. If 72<var>option</var> contains commas, it is split into multiple options at the 73commas. However, many options are modified, translated or interpreted 74by the compiler driver before being passed to the preprocessor, and 75<samp><span class="option">-Wp</span></samp> forcibly bypasses this phase. The preprocessor's direct 76interface is undocumented and subject to change, so whenever possible 77you should avoid using <samp><span class="option">-Wp</span></samp> and let the driver handle the 78options instead. 79 80 <br><dt><code>-Xpreprocessor </code><var>option</var><dd><a name="index-Xpreprocessor-887"></a>Pass <var>option</var> as an option to the preprocessor. You can use this to 81supply system-specific preprocessor options which GCC does not know how to 82recognize. 83 84 <p>If you want to pass an option that takes an argument, you must use 85<samp><span class="option">-Xpreprocessor</span></samp> twice, once for the option and once for the argument. 86</dl> 87 88<!-- Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, --> 89<!-- 2010, Free Software Foundation, Inc. --> 90<!-- This is part of the CPP and GCC manuals. --> 91<!-- For copying conditions, see the file gcc.texi. --> 92<!-- --> 93<!-- Options affecting the preprocessor --> 94<!-- --> 95<!-- If this file is included with the flag ``cppmanual'' set, it is --> 96<!-- formatted for inclusion in the CPP manual; otherwise the main GCC manual. --> 97 <dl> 98<dt><code>-D </code><var>name</var><dd><a name="index-D-888"></a>Predefine <var>name</var> as a macro, with definition <code>1</code>. 99 100 <br><dt><code>-D </code><var>name</var><code>=</code><var>definition</var><dd>The contents of <var>definition</var> are tokenized and processed as if 101they appeared during translation phase three in a ‘<samp><span class="samp">#define</span></samp>’ 102directive. In particular, the definition will be truncated by 103embedded newline characters. 104 105 <p>If you are invoking the preprocessor from a shell or shell-like 106program you may need to use the shell's quoting syntax to protect 107characters such as spaces that have a meaning in the shell syntax. 108 109 <p>If you wish to define a function-like macro on the command line, write 110its argument list with surrounding parentheses before the equals sign 111(if any). Parentheses are meaningful to most shells, so you will need 112to quote the option. With <samp><span class="command">sh</span></samp> and <samp><span class="command">csh</span></samp>, 113<samp><span class="option">-D'</span><var>name</var><span class="option">(</span><var>args<small class="dots">...</small></var><span class="option">)=</span><var>definition</var><span class="option">'</span></samp> works. 114 115 <p><samp><span class="option">-D</span></samp> and <samp><span class="option">-U</span></samp> options are processed in the order they 116are given on the command line. All <samp><span class="option">-imacros </span><var>file</var></samp> and 117<samp><span class="option">-include </span><var>file</var></samp> options are processed after all 118<samp><span class="option">-D</span></samp> and <samp><span class="option">-U</span></samp> options. 119 120 <br><dt><code>-U </code><var>name</var><dd><a name="index-U-889"></a>Cancel any previous definition of <var>name</var>, either built in or 121provided with a <samp><span class="option">-D</span></samp> option. 122 123 <br><dt><code>-undef</code><dd><a name="index-undef-890"></a>Do not predefine any system-specific or GCC-specific macros. The 124standard predefined macros remain defined. 125 126 <br><dt><code>-I </code><var>dir</var><dd><a name="index-I-891"></a>Add the directory <var>dir</var> to the list of directories to be searched 127for header files. 128Directories named by <samp><span class="option">-I</span></samp> are searched before the standard 129system include directories. If the directory <var>dir</var> is a standard 130system include directory, the option is ignored to ensure that the 131default search order for system directories and the special treatment 132of system headers are not defeated 133. 134If <var>dir</var> begins with <code>=</code>, then the <code>=</code> will be replaced 135by the sysroot prefix; see <samp><span class="option">--sysroot</span></samp> and <samp><span class="option">-isysroot</span></samp>. 136 137 <br><dt><code>-o </code><var>file</var><dd><a name="index-o-892"></a>Write output to <var>file</var>. This is the same as specifying <var>file</var> 138as the second non-option argument to <samp><span class="command">cpp</span></samp>. <samp><span class="command">gcc</span></samp> has a 139different interpretation of a second non-option argument, so you must 140use <samp><span class="option">-o</span></samp> to specify the output file. 141 142 <br><dt><code>-Wall</code><dd><a name="index-Wall-893"></a>Turns on all optional warnings which are desirable for normal code. 143At present this is <samp><span class="option">-Wcomment</span></samp>, <samp><span class="option">-Wtrigraphs</span></samp>, 144<samp><span class="option">-Wmultichar</span></samp> and a warning about integer promotion causing a 145change of sign in <code>#if</code> expressions. Note that many of the 146preprocessor's warnings are on by default and have no options to 147control them. 148 149 <br><dt><code>-Wcomment</code><dt><code>-Wcomments</code><dd><a name="index-Wcomment-894"></a><a name="index-Wcomments-895"></a>Warn whenever a comment-start sequence ‘<samp><span class="samp">/*</span></samp>’ appears in a ‘<samp><span class="samp">/*</span></samp>’ 150comment, or whenever a backslash-newline appears in a ‘<samp><span class="samp">//</span></samp>’ comment. 151(Both forms have the same effect.) 152 153 <br><dt><code>-Wtrigraphs</code><dd><a name="index-Wtrigraphs-896"></a><a name="Wtrigraphs"></a>Most trigraphs in comments cannot affect the meaning of the program. 154However, a trigraph that would form an escaped newline (‘<samp><span class="samp">??/</span></samp>’ at 155the end of a line) can, by changing where the comment begins or ends. 156Therefore, only trigraphs that would form escaped newlines produce 157warnings inside a comment. 158 159 <p>This option is implied by <samp><span class="option">-Wall</span></samp>. If <samp><span class="option">-Wall</span></samp> is not 160given, this option is still enabled unless trigraphs are enabled. To 161get trigraph conversion without warnings, but get the other 162<samp><span class="option">-Wall</span></samp> warnings, use ‘<samp><span class="samp">-trigraphs -Wall -Wno-trigraphs</span></samp>’. 163 164 <br><dt><code>-Wtraditional</code><dd><a name="index-Wtraditional-897"></a>Warn about certain constructs that behave differently in traditional and 165ISO C. Also warn about ISO C constructs that have no traditional C 166equivalent, and problematic constructs which should be avoided. 167 168 <br><dt><code>-Wundef</code><dd><a name="index-Wundef-898"></a>Warn whenever an identifier which is not a macro is encountered in an 169‘<samp><span class="samp">#if</span></samp>’ directive, outside of ‘<samp><span class="samp">defined</span></samp>’. Such identifiers are 170replaced with zero. 171 172 <br><dt><code>-Wunused-macros</code><dd><a name="index-Wunused_002dmacros-899"></a>Warn about macros defined in the main file that are unused. A macro 173is <dfn>used</dfn> if it is expanded or tested for existence at least once. 174The preprocessor will also warn if the macro has not been used at the 175time it is redefined or undefined. 176 177 <p>Built-in macros, macros defined on the command line, and macros 178defined in include files are not warned about. 179 180 <p><em>Note:</em> If a macro is actually used, but only used in skipped 181conditional blocks, then CPP will report it as unused. To avoid the 182warning in such a case, you might improve the scope of the macro's 183definition by, for example, moving it into the first skipped block. 184Alternatively, you could provide a dummy use with something like: 185 186 <pre class="smallexample"> #if defined the_macro_causing_the_warning 187 #endif 188</pre> 189 <br><dt><code>-Wendif-labels</code><dd><a name="index-Wendif_002dlabels-900"></a>Warn whenever an ‘<samp><span class="samp">#else</span></samp>’ or an ‘<samp><span class="samp">#endif</span></samp>’ are followed by text. 190This usually happens in code of the form 191 192 <pre class="smallexample"> #if FOO 193 ... 194 #else FOO 195 ... 196 #endif FOO 197</pre> 198 <p class="noindent">The second and third <code>FOO</code> should be in comments, but often are not 199in older programs. This warning is on by default. 200 201 <br><dt><code>-Werror</code><dd><a name="index-Werror-901"></a>Make all warnings into hard errors. Source code which triggers warnings 202will be rejected. 203 204 <br><dt><code>-Wsystem-headers</code><dd><a name="index-Wsystem_002dheaders-902"></a>Issue warnings for code in system headers. These are normally unhelpful 205in finding bugs in your own code, therefore suppressed. If you are 206responsible for the system library, you may want to see them. 207 208 <br><dt><code>-w</code><dd><a name="index-w-903"></a>Suppress all warnings, including those which GNU CPP issues by default. 209 210 <br><dt><code>-pedantic</code><dd><a name="index-pedantic-904"></a>Issue all the mandatory diagnostics listed in the C standard. Some of 211them are left out by default, since they trigger frequently on harmless 212code. 213 214 <br><dt><code>-pedantic-errors</code><dd><a name="index-pedantic_002derrors-905"></a>Issue all the mandatory diagnostics, and make all mandatory diagnostics 215into errors. This includes mandatory diagnostics that GCC issues 216without ‘<samp><span class="samp">-pedantic</span></samp>’ but treats as warnings. 217 218 <br><dt><code>-M</code><dd><a name="index-M-906"></a><a name="index-g_t_0040command_007bmake_007d-907"></a><a name="index-dependencies_002c-_0040command_007bmake_007d-908"></a>Instead of outputting the result of preprocessing, output a rule 219suitable for <samp><span class="command">make</span></samp> describing the dependencies of the main 220source file. The preprocessor outputs one <samp><span class="command">make</span></samp> rule containing 221the object file name for that source file, a colon, and the names of all 222the included files, including those coming from <samp><span class="option">-include</span></samp> or 223<samp><span class="option">-imacros</span></samp> command line options. 224 225 <p>Unless specified explicitly (with <samp><span class="option">-MT</span></samp> or <samp><span class="option">-MQ</span></samp>), the 226object file name consists of the name of the source file with any 227suffix replaced with object file suffix and with any leading directory 228parts removed. If there are many included files then the rule is 229split into several lines using ‘<samp><span class="samp">\</span></samp>’-newline. The rule has no 230commands. 231 232 <p>This option does not suppress the preprocessor's debug output, such as 233<samp><span class="option">-dM</span></samp>. To avoid mixing such debug output with the dependency 234rules you should explicitly specify the dependency output file with 235<samp><span class="option">-MF</span></samp>, or use an environment variable like 236<samp><span class="env">DEPENDENCIES_OUTPUT</span></samp> (see <a href="Environment-Variables.html#Environment-Variables">Environment Variables</a>). Debug output 237will still be sent to the regular output stream as normal. 238 239 <p>Passing <samp><span class="option">-M</span></samp> to the driver implies <samp><span class="option">-E</span></samp>, and suppresses 240warnings with an implicit <samp><span class="option">-w</span></samp>. 241 242 <br><dt><code>-MM</code><dd><a name="index-MM-909"></a>Like <samp><span class="option">-M</span></samp> but do not mention header files that are found in 243system header directories, nor header files that are included, 244directly or indirectly, from such a header. 245 246 <p>This implies that the choice of angle brackets or double quotes in an 247‘<samp><span class="samp">#include</span></samp>’ directive does not in itself determine whether that 248header will appear in <samp><span class="option">-MM</span></samp> dependency output. This is a 249slight change in semantics from GCC versions 3.0 and earlier. 250 251 <p><a name="dashMF"></a><br><dt><code>-MF </code><var>file</var><dd><a name="index-MF-910"></a>When used with <samp><span class="option">-M</span></samp> or <samp><span class="option">-MM</span></samp>, specifies a 252file to write the dependencies to. If no <samp><span class="option">-MF</span></samp> switch is given 253the preprocessor sends the rules to the same place it would have sent 254preprocessed output. 255 256 <p>When used with the driver options <samp><span class="option">-MD</span></samp> or <samp><span class="option">-MMD</span></samp>, 257<samp><span class="option">-MF</span></samp> overrides the default dependency output file. 258 259 <br><dt><code>-MG</code><dd><a name="index-MG-911"></a>In conjunction with an option such as <samp><span class="option">-M</span></samp> requesting 260dependency generation, <samp><span class="option">-MG</span></samp> assumes missing header files are 261generated files and adds them to the dependency list without raising 262an error. The dependency filename is taken directly from the 263<code>#include</code> directive without prepending any path. <samp><span class="option">-MG</span></samp> 264also suppresses preprocessed output, as a missing header file renders 265this useless. 266 267 <p>This feature is used in automatic updating of makefiles. 268 269 <br><dt><code>-MP</code><dd><a name="index-MP-912"></a>This option instructs CPP to add a phony target for each dependency 270other than the main file, causing each to depend on nothing. These 271dummy rules work around errors <samp><span class="command">make</span></samp> gives if you remove header 272files without updating the <samp><span class="file">Makefile</span></samp> to match. 273 274 <p>This is typical output: 275 276 <pre class="smallexample"> test.o: test.c test.h 277 278 test.h: 279</pre> 280 <br><dt><code>-MT </code><var>target</var><dd><a name="index-MT-913"></a> 281Change the target of the rule emitted by dependency generation. By 282default CPP takes the name of the main input file, deletes any 283directory components and any file suffix such as ‘<samp><span class="samp">.c</span></samp>’, and 284appends the platform's usual object suffix. The result is the target. 285 286 <p>An <samp><span class="option">-MT</span></samp> option will set the target to be exactly the string you 287specify. If you want multiple targets, you can specify them as a single 288argument to <samp><span class="option">-MT</span></samp>, or use multiple <samp><span class="option">-MT</span></samp> options. 289 290 <p>For example, <samp><span class="option">-MT '$(objpfx)foo.o'<!-- /@w --></span></samp> might give 291 292 <pre class="smallexample"> $(objpfx)foo.o: foo.c 293</pre> 294 <br><dt><code>-MQ </code><var>target</var><dd><a name="index-MQ-914"></a> 295Same as <samp><span class="option">-MT</span></samp>, but it quotes any characters which are special to 296Make. <samp><span class="option">-MQ '$(objpfx)foo.o'<!-- /@w --></span></samp> gives 297 298 <pre class="smallexample"> $$(objpfx)foo.o: foo.c 299</pre> 300 <p>The default target is automatically quoted, as if it were given with 301<samp><span class="option">-MQ</span></samp>. 302 303 <br><dt><code>-MD</code><dd><a name="index-MD-915"></a><samp><span class="option">-MD</span></samp> is equivalent to <samp><span class="option">-M -MF </span><var>file</var></samp>, except that 304<samp><span class="option">-E</span></samp> is not implied. The driver determines <var>file</var> based on 305whether an <samp><span class="option">-o</span></samp> option is given. If it is, the driver uses its 306argument but with a suffix of <samp><span class="file">.d</span></samp>, otherwise it takes the name 307of the input file, removes any directory components and suffix, and 308applies a <samp><span class="file">.d</span></samp> suffix. 309 310 <p>If <samp><span class="option">-MD</span></samp> is used in conjunction with <samp><span class="option">-E</span></samp>, any 311<samp><span class="option">-o</span></samp> switch is understood to specify the dependency output file 312(see <a href="dashMF.html#dashMF">-MF</a>), but if used without <samp><span class="option">-E</span></samp>, each <samp><span class="option">-o</span></samp> 313is understood to specify a target object file. 314 315 <p>Since <samp><span class="option">-E</span></samp> is not implied, <samp><span class="option">-MD</span></samp> can be used to generate 316a dependency output file as a side-effect of the compilation process. 317 318 <br><dt><code>-MMD</code><dd><a name="index-MMD-916"></a>Like <samp><span class="option">-MD</span></samp> except mention only user header files, not system 319header files. 320 321 <br><dt><code>-fpch-deps</code><dd><a name="index-fpch_002ddeps-917"></a>When using precompiled headers (see <a href="Precompiled-Headers.html#Precompiled-Headers">Precompiled Headers</a>), this flag 322will cause the dependency-output flags to also list the files from the 323precompiled header's dependencies. If not specified only the 324precompiled header would be listed and not the files that were used to 325create it because those files are not consulted when a precompiled 326header is used. 327 328 <br><dt><code>-fpch-preprocess</code><dd><a name="index-fpch_002dpreprocess-918"></a>This option allows use of a precompiled header (see <a href="Precompiled-Headers.html#Precompiled-Headers">Precompiled Headers</a>) together with <samp><span class="option">-E</span></samp>. It inserts a special <code>#pragma</code>, 329<code>#pragma GCC pch_preprocess "</code><var>filename</var><code>"</code> in the output to mark 330the place where the precompiled header was found, and its <var>filename</var>. 331When <samp><span class="option">-fpreprocessed</span></samp> is in use, GCC recognizes this <code>#pragma</code> 332and loads the PCH. 333 334 <p>This option is off by default, because the resulting preprocessed output 335is only really suitable as input to GCC. It is switched on by 336<samp><span class="option">-save-temps</span></samp>. 337 338 <p>You should not write this <code>#pragma</code> in your own code, but it is 339safe to edit the filename if the PCH file is available in a different 340location. The filename may be absolute or it may be relative to GCC's 341current directory. 342 343 <br><dt><code>-x c</code><dt><code>-x c++</code><dt><code>-x objective-c</code><dt><code>-x assembler-with-cpp</code><dd><a name="index-x-919"></a>Specify the source language: C, C++, Objective-C, or assembly. This has 344nothing to do with standards conformance or extensions; it merely 345selects which base syntax to expect. If you give none of these options, 346cpp will deduce the language from the extension of the source file: 347‘<samp><span class="samp">.c</span></samp>’, ‘<samp><span class="samp">.cc</span></samp>’, ‘<samp><span class="samp">.m</span></samp>’, or ‘<samp><span class="samp">.S</span></samp>’. Some other common 348extensions for C++ and assembly are also recognized. If cpp does not 349recognize the extension, it will treat the file as C; this is the most 350generic mode. 351 352 <p><em>Note:</em> Previous versions of cpp accepted a <samp><span class="option">-lang</span></samp> option 353which selected both the language and the standards conformance level. 354This option has been removed, because it conflicts with the <samp><span class="option">-l</span></samp> 355option. 356 357 <br><dt><code>-std=</code><var>standard</var><dt><code>-ansi</code><dd><a name="index-ansi-920"></a><a name="index-std_003d-921"></a>Specify the standard to which the code should conform. Currently CPP 358knows about C and C++ standards; others may be added in the future. 359 360 <p><var>standard</var> 361may be one of: 362 <dl> 363<dt><code>c90</code><dt><code>c89</code><dt><code>iso9899:1990</code><dd>The ISO C standard from 1990. ‘<samp><span class="samp">c90</span></samp>’ is the customary shorthand for 364this version of the standard. 365 366 <p>The <samp><span class="option">-ansi</span></samp> option is equivalent to <samp><span class="option">-std=c90</span></samp>. 367 368 <br><dt><code>iso9899:199409</code><dd>The 1990 C standard, as amended in 1994. 369 370 <br><dt><code>iso9899:1999</code><dt><code>c99</code><dt><code>iso9899:199x</code><dt><code>c9x</code><dd>The revised ISO C standard, published in December 1999. Before 371publication, this was known as C9X. 372 373 <br><dt><code>c1x</code><dd>The next version of the ISO C standard, still under development. 374 375 <br><dt><code>gnu90</code><dt><code>gnu89</code><dd>The 1990 C standard plus GNU extensions. This is the default. 376 377 <br><dt><code>gnu99</code><dt><code>gnu9x</code><dd>The 1999 C standard plus GNU extensions. 378 379 <br><dt><code>gnu1x</code><dd>The next version of the ISO C standard, still under development, plus 380GNU extensions. 381 382 <br><dt><code>c++98</code><dd>The 1998 ISO C++ standard plus amendments. 383 384 <br><dt><code>gnu++98</code><dd>The same as <samp><span class="option">-std=c++98</span></samp> plus GNU extensions. This is the 385default for C++ code. 386</dl> 387 388 <br><dt><code>-I-</code><dd><a name="index-I_002d-922"></a>Split the include path. Any directories specified with <samp><span class="option">-I</span></samp> 389options before <samp><span class="option">-I-</span></samp> are searched only for headers requested with 390<code>#include "</code><var>file</var><code>"<!-- /@w --></code>; they are not searched for 391<code>#include <</code><var>file</var><code>><!-- /@w --></code>. If additional directories are 392specified with <samp><span class="option">-I</span></samp> options after the <samp><span class="option">-I-</span></samp>, those 393directories are searched for all ‘<samp><span class="samp">#include</span></samp>’ directives. 394 395 <p>In addition, <samp><span class="option">-I-</span></samp> inhibits the use of the directory of the current 396file directory as the first search directory for <code>#include "</code><var>file</var><code>"<!-- /@w --></code>. 397This option has been deprecated. 398 399 <br><dt><code>-nostdinc</code><dd><a name="index-nostdinc-923"></a>Do not search the standard system directories for header files. 400Only the directories you have specified with <samp><span class="option">-I</span></samp> options 401(and the directory of the current file, if appropriate) are searched. 402 403 <br><dt><code>-nostdinc++</code><dd><a name="index-nostdinc_002b_002b-924"></a>Do not search for header files in the C++-specific standard directories, 404but do still search the other standard directories. (This option is 405used when building the C++ library.) 406 407 <br><dt><code>-include </code><var>file</var><dd><a name="index-include-925"></a>Process <var>file</var> as if <code>#include "file"</code> appeared as the first 408line of the primary source file. However, the first directory searched 409for <var>file</var> is the preprocessor's working directory <em>instead of</em> 410the directory containing the main source file. If not found there, it 411is searched for in the remainder of the <code>#include "..."</code> search 412chain as normal. 413 414 <p>If multiple <samp><span class="option">-include</span></samp> options are given, the files are included 415in the order they appear on the command line. 416 417 <br><dt><code>-imacros </code><var>file</var><dd><a name="index-imacros-926"></a>Exactly like <samp><span class="option">-include</span></samp>, except that any output produced by 418scanning <var>file</var> is thrown away. Macros it defines remain defined. 419This allows you to acquire all the macros from a header without also 420processing its declarations. 421 422 <p>All files specified by <samp><span class="option">-imacros</span></samp> are processed before all files 423specified by <samp><span class="option">-include</span></samp>. 424 425 <br><dt><code>-idirafter </code><var>dir</var><dd><a name="index-idirafter-927"></a>Search <var>dir</var> for header files, but do it <em>after</em> all 426directories specified with <samp><span class="option">-I</span></samp> and the standard system directories 427have been exhausted. <var>dir</var> is treated as a system include directory. 428If <var>dir</var> begins with <code>=</code>, then the <code>=</code> will be replaced 429by the sysroot prefix; see <samp><span class="option">--sysroot</span></samp> and <samp><span class="option">-isysroot</span></samp>. 430 431 <br><dt><code>-iprefix </code><var>prefix</var><dd><a name="index-iprefix-928"></a>Specify <var>prefix</var> as the prefix for subsequent <samp><span class="option">-iwithprefix</span></samp> 432options. If the prefix represents a directory, you should include the 433final ‘<samp><span class="samp">/</span></samp>’. 434 435 <br><dt><code>-iwithprefix </code><var>dir</var><dt><code>-iwithprefixbefore </code><var>dir</var><dd><a name="index-iwithprefix-929"></a><a name="index-iwithprefixbefore-930"></a>Append <var>dir</var> to the prefix specified previously with 436<samp><span class="option">-iprefix</span></samp>, and add the resulting directory to the include search 437path. <samp><span class="option">-iwithprefixbefore</span></samp> puts it in the same place <samp><span class="option">-I</span></samp> 438would; <samp><span class="option">-iwithprefix</span></samp> puts it where <samp><span class="option">-idirafter</span></samp> would. 439 440 <br><dt><code>-isysroot </code><var>dir</var><dd><a name="index-isysroot-931"></a>This option is like the <samp><span class="option">--sysroot</span></samp> option, but applies only to 441header files (except for Darwin targets, where it applies to both header 442files and libraries). See the <samp><span class="option">--sysroot</span></samp> option for more 443information. 444 445 <br><dt><code>-imultilib </code><var>dir</var><dd><a name="index-imultilib-932"></a>Use <var>dir</var> as a subdirectory of the directory containing 446target-specific C++ headers. 447 448 <br><dt><code>-isystem </code><var>dir</var><dd><a name="index-isystem-933"></a>Search <var>dir</var> for header files, after all directories specified by 449<samp><span class="option">-I</span></samp> but before the standard system directories. Mark it 450as a system directory, so that it gets the same special treatment as 451is applied to the standard system directories. 452If <var>dir</var> begins with <code>=</code>, then the <code>=</code> will be replaced 453by the sysroot prefix; see <samp><span class="option">--sysroot</span></samp> and <samp><span class="option">-isysroot</span></samp>. 454 455 <br><dt><code>-iquote </code><var>dir</var><dd><a name="index-iquote-934"></a>Search <var>dir</var> only for header files requested with 456<code>#include "</code><var>file</var><code>"<!-- /@w --></code>; they are not searched for 457<code>#include <</code><var>file</var><code>><!-- /@w --></code>, before all directories specified by 458<samp><span class="option">-I</span></samp> and before the standard system directories. 459If <var>dir</var> begins with <code>=</code>, then the <code>=</code> will be replaced 460by the sysroot prefix; see <samp><span class="option">--sysroot</span></samp> and <samp><span class="option">-isysroot</span></samp>. 461 462 <br><dt><code>-fdirectives-only</code><dd><a name="index-fdirectives_002donly-935"></a>When preprocessing, handle directives, but do not expand macros. 463 464 <p>The option's behavior depends on the <samp><span class="option">-E</span></samp> and <samp><span class="option">-fpreprocessed</span></samp> 465options. 466 467 <p>With <samp><span class="option">-E</span></samp>, preprocessing is limited to the handling of directives 468such as <code>#define</code>, <code>#ifdef</code>, and <code>#error</code>. Other 469preprocessor operations, such as macro expansion and trigraph 470conversion are not performed. In addition, the <samp><span class="option">-dD</span></samp> option is 471implicitly enabled. 472 473 <p>With <samp><span class="option">-fpreprocessed</span></samp>, predefinition of command line and most 474builtin macros is disabled. Macros such as <code>__LINE__</code>, which are 475contextually dependent, are handled normally. This enables compilation of 476files previously preprocessed with <code>-E -fdirectives-only</code>. 477 478 <p>With both <samp><span class="option">-E</span></samp> and <samp><span class="option">-fpreprocessed</span></samp>, the rules for 479<samp><span class="option">-fpreprocessed</span></samp> take precedence. This enables full preprocessing of 480files previously preprocessed with <code>-E -fdirectives-only</code>. 481 482 <br><dt><code>-fdollars-in-identifiers</code><dd><a name="index-fdollars_002din_002didentifiers-936"></a><a name="fdollars_002din_002didentifiers"></a>Accept ‘<samp><span class="samp">$</span></samp>’ in identifiers. 483 484 <br><dt><code>-fextended-identifiers</code><dd><a name="index-fextended_002didentifiers-937"></a>Accept universal character names in identifiers. This option is 485experimental; in a future version of GCC, it will be enabled by 486default for C99 and C++. 487 488 <br><dt><code>-fpreprocessed</code><dd><a name="index-fpreprocessed-938"></a>Indicate to the preprocessor that the input file has already been 489preprocessed. This suppresses things like macro expansion, trigraph 490conversion, escaped newline splicing, and processing of most directives. 491The preprocessor still recognizes and removes comments, so that you can 492pass a file preprocessed with <samp><span class="option">-C</span></samp> to the compiler without 493problems. In this mode the integrated preprocessor is little more than 494a tokenizer for the front ends. 495 496 <p><samp><span class="option">-fpreprocessed</span></samp> is implicit if the input file has one of the 497extensions ‘<samp><span class="samp">.i</span></samp>’, ‘<samp><span class="samp">.ii</span></samp>’ or ‘<samp><span class="samp">.mi</span></samp>’. These are the 498extensions that GCC uses for preprocessed files created by 499<samp><span class="option">-save-temps</span></samp>. 500 501 <br><dt><code>-ftabstop=</code><var>width</var><dd><a name="index-ftabstop-939"></a>Set the distance between tab stops. This helps the preprocessor report 502correct column numbers in warnings or errors, even if tabs appear on the 503line. If the value is less than 1 or greater than 100, the option is 504ignored. The default is 8. 505 506 <br><dt><code>-fexec-charset=</code><var>charset</var><dd><a name="index-fexec_002dcharset-940"></a><a name="index-character-set_002c-execution-941"></a>Set the execution character set, used for string and character 507constants. The default is UTF-8. <var>charset</var> can be any encoding 508supported by the system's <code>iconv</code> library routine. 509 510 <br><dt><code>-fwide-exec-charset=</code><var>charset</var><dd><a name="index-fwide_002dexec_002dcharset-942"></a><a name="index-character-set_002c-wide-execution-943"></a>Set the wide execution character set, used for wide string and 511character constants. The default is UTF-32 or UTF-16, whichever 512corresponds to the width of <code>wchar_t</code>. As with 513<samp><span class="option">-fexec-charset</span></samp>, <var>charset</var> can be any encoding supported 514by the system's <code>iconv</code> library routine; however, you will have 515problems with encodings that do not fit exactly in <code>wchar_t</code>. 516 517 <br><dt><code>-finput-charset=</code><var>charset</var><dd><a name="index-finput_002dcharset-944"></a><a name="index-character-set_002c-input-945"></a>Set the input character set, used for translation from the character 518set of the input file to the source character set used by GCC. If the 519locale does not specify, or GCC cannot get this information from the 520locale, the default is UTF-8. This can be overridden by either the locale 521or this command line option. Currently the command line option takes 522precedence if there's a conflict. <var>charset</var> can be any encoding 523supported by the system's <code>iconv</code> library routine. 524 525 <br><dt><code>-fworking-directory</code><dd><a name="index-fworking_002ddirectory-946"></a><a name="index-fno_002dworking_002ddirectory-947"></a>Enable generation of linemarkers in the preprocessor output that will 526let the compiler know the current working directory at the time of 527preprocessing. When this option is enabled, the preprocessor will 528emit, after the initial linemarker, a second linemarker with the 529current working directory followed by two slashes. GCC will use this 530directory, when it's present in the preprocessed input, as the 531directory emitted as the current working directory in some debugging 532information formats. This option is implicitly enabled if debugging 533information is enabled, but this can be inhibited with the negated 534form <samp><span class="option">-fno-working-directory</span></samp>. If the <samp><span class="option">-P</span></samp> flag is 535present in the command line, this option has no effect, since no 536<code>#line</code> directives are emitted whatsoever. 537 538 <br><dt><code>-fno-show-column</code><dd><a name="index-fno_002dshow_002dcolumn-948"></a>Do not print column numbers in diagnostics. This may be necessary if 539diagnostics are being scanned by a program that does not understand the 540column numbers, such as <samp><span class="command">dejagnu</span></samp>. 541 542 <br><dt><code>-A </code><var>predicate</var><code>=</code><var>answer</var><dd><a name="index-A-949"></a>Make an assertion with the predicate <var>predicate</var> and answer 543<var>answer</var>. This form is preferred to the older form <samp><span class="option">-A 544</span><var>predicate</var><span class="option">(</span><var>answer</var><span class="option">)</span></samp>, which is still supported, because 545it does not use shell special characters. 546 547 <br><dt><code>-A -</code><var>predicate</var><code>=</code><var>answer</var><dd>Cancel an assertion with the predicate <var>predicate</var> and answer 548<var>answer</var>. 549 550 <br><dt><code>-dCHARS</code><dd><var>CHARS</var> is a sequence of one or more of the following characters, 551and must not be preceded by a space. Other characters are interpreted 552by the compiler proper, or reserved for future versions of GCC, and so 553are silently ignored. If you specify characters whose behavior 554conflicts, the result is undefined. 555 556 <dl> 557<dt>‘<samp><span class="samp">M</span></samp>’<dd><a name="index-dM-950"></a>Instead of the normal output, generate a list of ‘<samp><span class="samp">#define</span></samp>’ 558directives for all the macros defined during the execution of the 559preprocessor, including predefined macros. This gives you a way of 560finding out what is predefined in your version of the preprocessor. 561Assuming you have no file <samp><span class="file">foo.h</span></samp>, the command 562 563 <pre class="smallexample"> touch foo.h; cpp -dM foo.h 564</pre> 565 <p class="noindent">will show all the predefined macros. 566 567 <p>If you use <samp><span class="option">-dM</span></samp> without the <samp><span class="option">-E</span></samp> option, <samp><span class="option">-dM</span></samp> is 568interpreted as a synonym for <samp><span class="option">-fdump-rtl-mach</span></samp>. 569See <a href="../gcc/Debugging-Options.html#Debugging-Options">Debugging Options</a>. 570 571 <br><dt>‘<samp><span class="samp">D</span></samp>’<dd><a name="index-dD-951"></a>Like ‘<samp><span class="samp">M</span></samp>’ except in two respects: it does <em>not</em> include the 572predefined macros, and it outputs <em>both</em> the ‘<samp><span class="samp">#define</span></samp>’ 573directives and the result of preprocessing. Both kinds of output go to 574the standard output file. 575 576 <br><dt>‘<samp><span class="samp">N</span></samp>’<dd><a name="index-dN-952"></a>Like ‘<samp><span class="samp">D</span></samp>’, but emit only the macro names, not their expansions. 577 578 <br><dt>‘<samp><span class="samp">I</span></samp>’<dd><a name="index-dI-953"></a>Output ‘<samp><span class="samp">#include</span></samp>’ directives in addition to the result of 579preprocessing. 580 581 <br><dt>‘<samp><span class="samp">U</span></samp>’<dd><a name="index-dU-954"></a>Like ‘<samp><span class="samp">D</span></samp>’ except that only macros that are expanded, or whose 582definedness is tested in preprocessor directives, are output; the 583output is delayed until the use or test of the macro; and 584‘<samp><span class="samp">#undef</span></samp>’ directives are also output for macros tested but 585undefined at the time. 586</dl> 587 588 <br><dt><code>-P</code><dd><a name="index-P-955"></a>Inhibit generation of linemarkers in the output from the preprocessor. 589This might be useful when running the preprocessor on something that is 590not C code, and will be sent to a program which might be confused by the 591linemarkers. 592 593 <br><dt><code>-C</code><dd><a name="index-C-956"></a>Do not discard comments. All comments are passed through to the output 594file, except for comments in processed directives, which are deleted 595along with the directive. 596 597 <p>You should be prepared for side effects when using <samp><span class="option">-C</span></samp>; it 598causes the preprocessor to treat comments as tokens in their own right. 599For example, comments appearing at the start of what would be a 600directive line have the effect of turning that line into an ordinary 601source line, since the first token on the line is no longer a ‘<samp><span class="samp">#</span></samp>’. 602 603 <br><dt><code>-CC</code><dd>Do not discard comments, including during macro expansion. This is 604like <samp><span class="option">-C</span></samp>, except that comments contained within macros are 605also passed through to the output file where the macro is expanded. 606 607 <p>In addition to the side-effects of the <samp><span class="option">-C</span></samp> option, the 608<samp><span class="option">-CC</span></samp> option causes all C++-style comments inside a macro 609to be converted to C-style comments. This is to prevent later use 610of that macro from inadvertently commenting out the remainder of 611the source line. 612 613 <p>The <samp><span class="option">-CC</span></samp> option is generally used to support lint comments. 614 615 <br><dt><code>-traditional-cpp</code><dd><a name="index-traditional_002dcpp-957"></a>Try to imitate the behavior of old-fashioned C preprocessors, as 616opposed to ISO C preprocessors. 617 618 <br><dt><code>-trigraphs</code><dd><a name="index-trigraphs-958"></a>Process trigraph sequences. 619These are three-character sequences, all starting with ‘<samp><span class="samp">??</span></samp>’, that 620are defined by ISO C to stand for single characters. For example, 621‘<samp><span class="samp">??/</span></samp>’ stands for ‘<samp><span class="samp">\</span></samp>’, so ‘<samp><span class="samp">'??/n'</span></samp>’ is a character 622constant for a newline. By default, GCC ignores trigraphs, but in 623standard-conforming modes it converts them. See the <samp><span class="option">-std</span></samp> and 624<samp><span class="option">-ansi</span></samp> options. 625 626 <p>The nine trigraphs and their replacements are 627 628 <pre class="smallexample"> Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- 629 Replacement: [ ] { } # \ ^ | ~ 630</pre> 631 <br><dt><code>-remap</code><dd><a name="index-remap-959"></a>Enable special code to work around file systems which only permit very 632short file names, such as MS-DOS. 633 634 <dt><code>--help</code><dt><code>--target-help</code><dd><a name="index-help-960"></a><a name="index-target_002dhelp-961"></a>Print text describing all the command line options instead of 635preprocessing anything. 636 637 <br><dt><code>-v</code><dd><a name="index-v-962"></a>Verbose mode. Print out GNU CPP's version number at the beginning of 638execution, and report the final form of the include path. 639 640 <br><dt><code>-H</code><dd><a name="index-H-963"></a>Print the name of each header file used, in addition to other normal 641activities. Each name is indented to show how deep in the 642‘<samp><span class="samp">#include</span></samp>’ stack it is. Precompiled header files are also 643printed, even if they are found to be invalid; an invalid precompiled 644header file is printed with ‘<samp><span class="samp">...x</span></samp>’ and a valid one with ‘<samp><span class="samp">...!</span></samp>’ . 645 646 <br><dt><code>-version</code><dt><code>--version</code><dd><a name="index-version-964"></a>Print out GNU CPP's version number. With one dash, proceed to 647preprocess as normal. With two dashes, exit immediately. 648</dl> 649 650 </body></html> 651 652