Preprocessor-Options.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>Using the GNU Compiler Collection (GCC): Preprocessor Options</title>
  20. <meta name="description" content="Using the GNU Compiler Collection (GCC): Preprocessor Options">
  21. <meta name="keywords" content="Using the GNU Compiler Collection (GCC): Preprocessor Options">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Invoking-GCC.html#Invoking-GCC" rel="up" title="Invoking GCC">
  30. <link href="Assembler-Options.html#Assembler-Options" rel="next" title="Assembler Options">
  31. <link href="Instrumentation-Options.html#Instrumentation-Options" rel="prev" title="Instrumentation Options">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Preprocessor-Options"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Assembler-Options.html#Assembler-Options" accesskey="n" rel="next">Assembler Options</a>, Previous: <a href="Instrumentation-Options.html#Instrumentation-Options" accesskey="p" rel="prev">Instrumentation Options</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="Options-Controlling-the-Preprocessor"></a>
  69. <h3 class="section">3.12 Options Controlling the Preprocessor</h3>
  70. <a name="index-preprocessor-options"></a>
  71. <a name="index-options_002c-preprocessor"></a>
  72. <p>These options control the C preprocessor, which is run on each C source
  73. file before actual compilation.
  74. </p>
  75. <p>If you use the <samp>-E</samp> option, nothing is done except preprocessing.
  76. Some of these options make sense only together with <samp>-E</samp> because
  77. they cause the preprocessor output to be unsuitable for actual
  78. compilation.
  79. </p>
  80. <p>In addition to the options listed here, there are a number of options
  81. to control search paths for include files documented in
  82. <a href="Directory-Options.html#Directory-Options">Directory Options</a>.
  83. Options to control preprocessor diagnostics are listed in
  84. <a href="Warning-Options.html#Warning-Options">Warning Options</a>.
  85. </p>
  86. <dl compact="compact">
  87. <dt><code>-D <var>name</var></code></dt>
  88. <dd><a name="index-D"></a>
  89. <p>Predefine <var>name</var> as a macro, with definition <code>1</code>.
  90. </p>
  91. </dd>
  92. <dt><code>-D <var>name</var>=<var>definition</var></code></dt>
  93. <dd><p>The contents of <var>definition</var> are tokenized and processed as if
  94. they appeared during translation phase three in a &lsquo;<samp>#define</samp>&rsquo;
  95. directive. In particular, the definition is truncated by
  96. embedded newline characters.
  97. </p>
  98. <p>If you are invoking the preprocessor from a shell or shell-like
  99. program you may need to use the shell&rsquo;s quoting syntax to protect
  100. characters such as spaces that have a meaning in the shell syntax.
  101. </p>
  102. <p>If you wish to define a function-like macro on the command line, write
  103. its argument list with surrounding parentheses before the equals sign
  104. (if any). Parentheses are meaningful to most shells, so you should
  105. quote the option. With <code>sh</code> and <code>csh</code>,
  106. <samp>-D'<var>name</var>(<var>args&hellip;</var>)=<var>definition</var>'</samp> works.
  107. </p>
  108. <p><samp>-D</samp> and <samp>-U</samp> options are processed in the order they
  109. are given on the command line. All <samp>-imacros <var>file</var></samp> and
  110. <samp>-include <var>file</var></samp> options are processed after all
  111. <samp>-D</samp> and <samp>-U</samp> options.
  112. </p>
  113. </dd>
  114. <dt><code>-U <var>name</var></code></dt>
  115. <dd><a name="index-U"></a>
  116. <p>Cancel any previous definition of <var>name</var>, either built in or
  117. provided with a <samp>-D</samp> option.
  118. </p>
  119. </dd>
  120. <dt><code>-include <var>file</var></code></dt>
  121. <dd><a name="index-include"></a>
  122. <p>Process <var>file</var> as if <code>#include &quot;file&quot;</code> appeared as the first
  123. line of the primary source file. However, the first directory searched
  124. for <var>file</var> is the preprocessor&rsquo;s working directory <em>instead of</em>
  125. the directory containing the main source file. If not found there, it
  126. is searched for in the remainder of the <code>#include &quot;&hellip;&quot;</code> search
  127. chain as normal.
  128. </p>
  129. <p>If multiple <samp>-include</samp> options are given, the files are included
  130. in the order they appear on the command line.
  131. </p>
  132. </dd>
  133. <dt><code>-imacros <var>file</var></code></dt>
  134. <dd><a name="index-imacros"></a>
  135. <p>Exactly like <samp>-include</samp>, except that any output produced by
  136. scanning <var>file</var> is thrown away. Macros it defines remain defined.
  137. This allows you to acquire all the macros from a header without also
  138. processing its declarations.
  139. </p>
  140. <p>All files specified by <samp>-imacros</samp> are processed before all files
  141. specified by <samp>-include</samp>.
  142. </p>
  143. </dd>
  144. <dt><code>-undef</code></dt>
  145. <dd><a name="index-undef"></a>
  146. <p>Do not predefine any system-specific or GCC-specific macros. The
  147. standard predefined macros remain defined.
  148. </p>
  149. </dd>
  150. <dt><code>-pthread</code></dt>
  151. <dd><a name="index-pthread"></a>
  152. <p>Define additional macros required for using the POSIX threads library.
  153. You should use this option consistently for both compilation and linking.
  154. This option is supported on GNU/Linux targets, most other Unix derivatives,
  155. and also on x86 Cygwin and MinGW targets.
  156. </p>
  157. </dd>
  158. <dt><code>-M</code></dt>
  159. <dd><a name="index-M"></a>
  160. <a name="index-make"></a>
  161. <a name="index-dependencies_002c-make"></a>
  162. <p>Instead of outputting the result of preprocessing, output a rule
  163. suitable for <code>make</code> describing the dependencies of the main
  164. source file. The preprocessor outputs one <code>make</code> rule containing
  165. the object file name for that source file, a colon, and the names of all
  166. the included files, including those coming from <samp>-include</samp> or
  167. <samp>-imacros</samp> command-line options.
  168. </p>
  169. <p>Unless specified explicitly (with <samp>-MT</samp> or <samp>-MQ</samp>), the
  170. object file name consists of the name of the source file with any
  171. suffix replaced with object file suffix and with any leading directory
  172. parts removed. If there are many included files then the rule is
  173. split into several lines using &lsquo;<samp>\</samp>&rsquo;-newline. The rule has no
  174. commands.
  175. </p>
  176. <p>This option does not suppress the preprocessor&rsquo;s debug output, such as
  177. <samp>-dM</samp>. To avoid mixing such debug output with the dependency
  178. rules you should explicitly specify the dependency output file with
  179. <samp>-MF</samp>, or use an environment variable like
  180. <code>DEPENDENCIES_OUTPUT</code> (see <a href="Environment-Variables.html#Environment-Variables">Environment Variables</a>). Debug output
  181. is still sent to the regular output stream as normal.
  182. </p>
  183. <p>Passing <samp>-M</samp> to the driver implies <samp>-E</samp>, and suppresses
  184. warnings with an implicit <samp>-w</samp>.
  185. </p>
  186. </dd>
  187. <dt><code>-MM</code></dt>
  188. <dd><a name="index-MM"></a>
  189. <p>Like <samp>-M</samp> but do not mention header files that are found in
  190. system header directories, nor header files that are included,
  191. directly or indirectly, from such a header.
  192. </p>
  193. <p>This implies that the choice of angle brackets or double quotes in an
  194. &lsquo;<samp>#include</samp>&rsquo; directive does not in itself determine whether that
  195. header appears in <samp>-MM</samp> dependency output.
  196. </p>
  197. <a name="dashMF"></a></dd>
  198. <dt><code>-MF <var>file</var></code></dt>
  199. <dd><a name="index-MF"></a>
  200. <p>When used with <samp>-M</samp> or <samp>-MM</samp>, specifies a
  201. file to write the dependencies to. If no <samp>-MF</samp> switch is given
  202. the preprocessor sends the rules to the same place it would send
  203. preprocessed output.
  204. </p>
  205. <p>When used with the driver options <samp>-MD</samp> or <samp>-MMD</samp>,
  206. <samp>-MF</samp> overrides the default dependency output file.
  207. </p>
  208. </dd>
  209. <dt><code>-MG</code></dt>
  210. <dd><a name="index-MG"></a>
  211. <p>In conjunction with an option such as <samp>-M</samp> requesting
  212. dependency generation, <samp>-MG</samp> assumes missing header files are
  213. generated files and adds them to the dependency list without raising
  214. an error. The dependency filename is taken directly from the
  215. <code>#include</code> directive without prepending any path. <samp>-MG</samp>
  216. also suppresses preprocessed output, as a missing header file renders
  217. this useless.
  218. </p>
  219. <p>This feature is used in automatic updating of makefiles.
  220. </p>
  221. </dd>
  222. <dt><code>-MP</code></dt>
  223. <dd><a name="index-MP"></a>
  224. <p>This option instructs CPP to add a phony target for each dependency
  225. other than the main file, causing each to depend on nothing. These
  226. dummy rules work around errors <code>make</code> gives if you remove header
  227. files without updating the <samp>Makefile</samp> to match.
  228. </p>
  229. <p>This is typical output:
  230. </p>
  231. <div class="smallexample">
  232. <pre class="smallexample">test.o: test.c test.h
  233. test.h:
  234. </pre></div>
  235. </dd>
  236. <dt><code>-MT <var>target</var></code></dt>
  237. <dd><a name="index-MT"></a>
  238. <p>Change the target of the rule emitted by dependency generation. By
  239. default CPP takes the name of the main input file, deletes any
  240. directory components and any file suffix such as &lsquo;<samp>.c</samp>&rsquo;, and
  241. appends the platform&rsquo;s usual object suffix. The result is the target.
  242. </p>
  243. <p>An <samp>-MT</samp> option sets the target to be exactly the string you
  244. specify. If you want multiple targets, you can specify them as a single
  245. argument to <samp>-MT</samp>, or use multiple <samp>-MT</samp> options.
  246. </p>
  247. <p>For example, <samp><span class="nolinebreak">-MT</span>&nbsp;'$(objpfx)foo.o'<!-- /@w --></samp> might give
  248. </p>
  249. <div class="smallexample">
  250. <pre class="smallexample">$(objpfx)foo.o: foo.c
  251. </pre></div>
  252. </dd>
  253. <dt><code>-MQ <var>target</var></code></dt>
  254. <dd><a name="index-MQ"></a>
  255. <p>Same as <samp>-MT</samp>, but it quotes any characters which are special to
  256. Make. <samp><span class="nolinebreak">-MQ</span>&nbsp;'$(objpfx)foo.o'<!-- /@w --></samp> gives
  257. </p>
  258. <div class="smallexample">
  259. <pre class="smallexample">$$(objpfx)foo.o: foo.c
  260. </pre></div>
  261. <p>The default target is automatically quoted, as if it were given with
  262. <samp>-MQ</samp>.
  263. </p>
  264. </dd>
  265. <dt><code>-MD</code></dt>
  266. <dd><a name="index-MD"></a>
  267. <p><samp>-MD</samp> is equivalent to <samp>-M -MF <var>file</var></samp>, except that
  268. <samp>-E</samp> is not implied. The driver determines <var>file</var> based on
  269. whether an <samp>-o</samp> option is given. If it is, the driver uses its
  270. argument but with a suffix of <samp>.d</samp>, otherwise it takes the name
  271. of the input file, removes any directory components and suffix, and
  272. applies a <samp>.d</samp> suffix.
  273. </p>
  274. <p>If <samp>-MD</samp> is used in conjunction with <samp>-E</samp>, any
  275. <samp>-o</samp> switch is understood to specify the dependency output file
  276. (see <a href="#dashMF">-MF</a>), but if used without <samp>-E</samp>, each <samp>-o</samp>
  277. is understood to specify a target object file.
  278. </p>
  279. <p>Since <samp>-E</samp> is not implied, <samp>-MD</samp> can be used to generate
  280. a dependency output file as a side-effect of the compilation process.
  281. </p>
  282. </dd>
  283. <dt><code>-MMD</code></dt>
  284. <dd><a name="index-MMD"></a>
  285. <p>Like <samp>-MD</samp> except mention only user header files, not system
  286. header files.
  287. </p>
  288. </dd>
  289. <dt><code>-fpreprocessed</code></dt>
  290. <dd><a name="index-fpreprocessed"></a>
  291. <p>Indicate to the preprocessor that the input file has already been
  292. preprocessed. This suppresses things like macro expansion, trigraph
  293. conversion, escaped newline splicing, and processing of most directives.
  294. The preprocessor still recognizes and removes comments, so that you can
  295. pass a file preprocessed with <samp>-C</samp> to the compiler without
  296. problems. In this mode the integrated preprocessor is little more than
  297. a tokenizer for the front ends.
  298. </p>
  299. <p><samp>-fpreprocessed</samp> is implicit if the input file has one of the
  300. extensions &lsquo;<samp>.i</samp>&rsquo;, &lsquo;<samp>.ii</samp>&rsquo; or &lsquo;<samp>.mi</samp>&rsquo;. These are the
  301. extensions that GCC uses for preprocessed files created by
  302. <samp>-save-temps</samp>.
  303. </p>
  304. </dd>
  305. <dt><code>-fdirectives-only</code></dt>
  306. <dd><a name="index-fdirectives_002donly"></a>
  307. <p>When preprocessing, handle directives, but do not expand macros.
  308. </p>
  309. <p>The option&rsquo;s behavior depends on the <samp>-E</samp> and <samp>-fpreprocessed</samp>
  310. options.
  311. </p>
  312. <p>With <samp>-E</samp>, preprocessing is limited to the handling of directives
  313. such as <code>#define</code>, <code>#ifdef</code>, and <code>#error</code>. Other
  314. preprocessor operations, such as macro expansion and trigraph
  315. conversion are not performed. In addition, the <samp>-dD</samp> option is
  316. implicitly enabled.
  317. </p>
  318. <p>With <samp>-fpreprocessed</samp>, predefinition of command line and most
  319. builtin macros is disabled. Macros such as <code>__LINE__</code>, which are
  320. contextually dependent, are handled normally. This enables compilation of
  321. files previously preprocessed with <code>-E -fdirectives-only</code>.
  322. </p>
  323. <p>With both <samp>-E</samp> and <samp>-fpreprocessed</samp>, the rules for
  324. <samp>-fpreprocessed</samp> take precedence. This enables full preprocessing of
  325. files previously preprocessed with <code>-E -fdirectives-only</code>.
  326. </p>
  327. </dd>
  328. <dt><code>-fdollars-in-identifiers</code></dt>
  329. <dd><a name="index-fdollars_002din_002didentifiers"></a>
  330. <a name="fdollars_002din_002didentifiers"></a><p>Accept &lsquo;<samp>$</samp>&rsquo; in identifiers.
  331. </p>
  332. </dd>
  333. <dt><code>-fextended-identifiers</code></dt>
  334. <dd><a name="index-fextended_002didentifiers"></a>
  335. <p>Accept universal character names in identifiers. This option is
  336. enabled by default for C99 (and later C standard versions) and C++.
  337. </p>
  338. </dd>
  339. <dt><code>-fno-canonical-system-headers</code></dt>
  340. <dd><a name="index-fno_002dcanonical_002dsystem_002dheaders"></a>
  341. <p>When preprocessing, do not shorten system header paths with canonicalization.
  342. </p>
  343. </dd>
  344. <dt><code>-ftabstop=<var>width</var></code></dt>
  345. <dd><a name="index-ftabstop"></a>
  346. <p>Set the distance between tab stops. This helps the preprocessor report
  347. correct column numbers in warnings or errors, even if tabs appear on the
  348. line. If the value is less than 1 or greater than 100, the option is
  349. ignored. The default is 8.
  350. </p>
  351. </dd>
  352. <dt><code>-ftrack-macro-expansion<span class="roman">[</span>=<var>level</var><span class="roman">]</span></code></dt>
  353. <dd><a name="index-ftrack_002dmacro_002dexpansion"></a>
  354. <p>Track locations of tokens across macro expansions. This allows the
  355. compiler to emit diagnostic about the current macro expansion stack
  356. when a compilation error occurs in a macro expansion. Using this
  357. option makes the preprocessor and the compiler consume more
  358. memory. The <var>level</var> parameter can be used to choose the level of
  359. precision of token location tracking thus decreasing the memory
  360. consumption if necessary. Value &lsquo;<samp>0</samp>&rsquo; of <var>level</var> de-activates
  361. this option. Value &lsquo;<samp>1</samp>&rsquo; tracks tokens locations in a
  362. degraded mode for the sake of minimal memory overhead. In this mode
  363. all tokens resulting from the expansion of an argument of a
  364. function-like macro have the same location. Value &lsquo;<samp>2</samp>&rsquo; tracks
  365. tokens locations completely. This value is the most memory hungry.
  366. When this option is given no argument, the default parameter value is
  367. &lsquo;<samp>2</samp>&rsquo;.
  368. </p>
  369. <p>Note that <code>-ftrack-macro-expansion=2</code> is activated by default.
  370. </p>
  371. </dd>
  372. <dt><code>-fexec-charset=<var>charset</var></code></dt>
  373. <dd><a name="index-fexec_002dcharset"></a>
  374. <a name="index-character-set_002c-execution"></a>
  375. <p>Set the execution character set, used for string and character
  376. constants. The default is UTF-8. <var>charset</var> can be any encoding
  377. supported by the system&rsquo;s <code>iconv</code> library routine.
  378. </p>
  379. </dd>
  380. <dt><code>-fwide-exec-charset=<var>charset</var></code></dt>
  381. <dd><a name="index-fwide_002dexec_002dcharset"></a>
  382. <a name="index-character-set_002c-wide-execution"></a>
  383. <p>Set the wide execution character set, used for wide string and
  384. character constants. The default is UTF-32 or UTF-16, whichever
  385. corresponds to the width of <code>wchar_t</code>. As with
  386. <samp>-fexec-charset</samp>, <var>charset</var> can be any encoding supported
  387. by the system&rsquo;s <code>iconv</code> library routine; however, you will have
  388. problems with encodings that do not fit exactly in <code>wchar_t</code>.
  389. </p>
  390. </dd>
  391. <dt><code>-finput-charset=<var>charset</var></code></dt>
  392. <dd><a name="index-finput_002dcharset"></a>
  393. <a name="index-character-set_002c-input"></a>
  394. <p>Set the input character set, used for translation from the character
  395. set of the input file to the source character set used by GCC. If the
  396. locale does not specify, or GCC cannot get this information from the
  397. locale, the default is UTF-8. This can be overridden by either the locale
  398. or this command-line option. Currently the command-line option takes
  399. precedence if there&rsquo;s a conflict. <var>charset</var> can be any encoding
  400. supported by the system&rsquo;s <code>iconv</code> library routine.
  401. </p>
  402. </dd>
  403. <dt><code>-fpch-deps</code></dt>
  404. <dd><a name="index-fpch_002ddeps"></a>
  405. <p>When using precompiled headers (see <a href="Precompiled-Headers.html#Precompiled-Headers">Precompiled Headers</a>), this flag
  406. causes the dependency-output flags to also list the files from the
  407. precompiled header&rsquo;s dependencies. If not specified, only the
  408. precompiled header are listed and not the files that were used to
  409. create it, because those files are not consulted when a precompiled
  410. header is used.
  411. </p>
  412. </dd>
  413. <dt><code>-fpch-preprocess</code></dt>
  414. <dd><a name="index-fpch_002dpreprocess"></a>
  415. <p>This option allows use of a precompiled header (see <a href="Precompiled-Headers.html#Precompiled-Headers">Precompiled Headers</a>) together with <samp>-E</samp>. It inserts a special <code>#pragma</code>,
  416. <code>#pragma GCC pch_preprocess &quot;<var>filename</var>&quot;</code> in the output to mark
  417. the place where the precompiled header was found, and its <var>filename</var>.
  418. When <samp>-fpreprocessed</samp> is in use, GCC recognizes this <code>#pragma</code>
  419. and loads the PCH.
  420. </p>
  421. <p>This option is off by default, because the resulting preprocessed output
  422. is only really suitable as input to GCC. It is switched on by
  423. <samp>-save-temps</samp>.
  424. </p>
  425. <p>You should not write this <code>#pragma</code> in your own code, but it is
  426. safe to edit the filename if the PCH file is available in a different
  427. location. The filename may be absolute or it may be relative to GCC&rsquo;s
  428. current directory.
  429. </p>
  430. </dd>
  431. <dt><code>-fworking-directory</code></dt>
  432. <dd><a name="index-fworking_002ddirectory"></a>
  433. <a name="index-fno_002dworking_002ddirectory"></a>
  434. <p>Enable generation of linemarkers in the preprocessor output that
  435. let the compiler know the current working directory at the time of
  436. preprocessing. When this option is enabled, the preprocessor
  437. emits, after the initial linemarker, a second linemarker with the
  438. current working directory followed by two slashes. GCC uses this
  439. directory, when it&rsquo;s present in the preprocessed input, as the
  440. directory emitted as the current working directory in some debugging
  441. information formats. This option is implicitly enabled if debugging
  442. information is enabled, but this can be inhibited with the negated
  443. form <samp>-fno-working-directory</samp>. If the <samp>-P</samp> flag is
  444. present in the command line, this option has no effect, since no
  445. <code>#line</code> directives are emitted whatsoever.
  446. </p>
  447. </dd>
  448. <dt><code>-A <var>predicate</var>=<var>answer</var></code></dt>
  449. <dd><a name="index-A"></a>
  450. <p>Make an assertion with the predicate <var>predicate</var> and answer
  451. <var>answer</var>. This form is preferred to the older form <samp>-A
  452. <var>predicate</var>(<var>answer</var>)</samp>, which is still supported, because
  453. it does not use shell special characters.
  454. </p>
  455. </dd>
  456. <dt><code>-A -<var>predicate</var>=<var>answer</var></code></dt>
  457. <dd><p>Cancel an assertion with the predicate <var>predicate</var> and answer
  458. <var>answer</var>.
  459. </p>
  460. </dd>
  461. <dt><code>-C</code></dt>
  462. <dd><a name="index-C"></a>
  463. <p>Do not discard comments. All comments are passed through to the output
  464. file, except for comments in processed directives, which are deleted
  465. along with the directive.
  466. </p>
  467. <p>You should be prepared for side effects when using <samp>-C</samp>; it
  468. causes the preprocessor to treat comments as tokens in their own right.
  469. For example, comments appearing at the start of what would be a
  470. directive line have the effect of turning that line into an ordinary
  471. source line, since the first token on the line is no longer a &lsquo;<samp>#</samp>&rsquo;.
  472. </p>
  473. </dd>
  474. <dt><code>-CC</code></dt>
  475. <dd><a name="index-CC"></a>
  476. <p>Do not discard comments, including during macro expansion. This is
  477. like <samp>-C</samp>, except that comments contained within macros are
  478. also passed through to the output file where the macro is expanded.
  479. </p>
  480. <p>In addition to the side-effects of the <samp>-C</samp> option, the
  481. <samp>-CC</samp> option causes all C++-style comments inside a macro
  482. to be converted to C-style comments. This is to prevent later use
  483. of that macro from inadvertently commenting out the remainder of
  484. the source line.
  485. </p>
  486. <p>The <samp>-CC</samp> option is generally used to support lint comments.
  487. </p>
  488. </dd>
  489. <dt><code>-P</code></dt>
  490. <dd><a name="index-P"></a>
  491. <p>Inhibit generation of linemarkers in the output from the preprocessor.
  492. This might be useful when running the preprocessor on something that is
  493. not C code, and will be sent to a program which might be confused by the
  494. linemarkers.
  495. </p>
  496. <a name="index-traditional-C-language"></a>
  497. <a name="index-C-language_002c-traditional"></a>
  498. </dd>
  499. <dt><code>-traditional</code></dt>
  500. <dt><code>-traditional-cpp</code></dt>
  501. <dd><a name="index-traditional_002dcpp"></a>
  502. <a name="index-traditional"></a>
  503. <p>Try to imitate the behavior of pre-standard C preprocessors, as
  504. opposed to ISO C preprocessors.
  505. See the GNU CPP manual for details.
  506. </p>
  507. <p>Note that GCC does not otherwise attempt to emulate a pre-standard
  508. C compiler, and these options are only supported with the <samp>-E</samp>
  509. switch, or when invoking CPP explicitly.
  510. </p>
  511. </dd>
  512. <dt><code>-trigraphs</code></dt>
  513. <dd><a name="index-trigraphs"></a>
  514. <p>Support ISO C trigraphs.
  515. These are three-character sequences, all starting with &lsquo;<samp>??</samp>&rsquo;, that
  516. are defined by ISO C to stand for single characters. For example,
  517. &lsquo;<samp>??/</samp>&rsquo; stands for &lsquo;<samp>\</samp>&rsquo;, so &lsquo;<samp>'??/n'</samp>&rsquo; is a character
  518. constant for a newline.
  519. </p>
  520. <p>The nine trigraphs and their replacements are
  521. </p>
  522. <div class="smallexample">
  523. <pre class="smallexample">Trigraph: ??( ??) ??&lt; ??&gt; ??= ??/ ??' ??! ??-
  524. Replacement: [ ] { } # \ ^ | ~
  525. </pre></div>
  526. <p>By default, GCC ignores trigraphs, but in
  527. standard-conforming modes it converts them. See the <samp>-std</samp> and
  528. <samp>-ansi</samp> options.
  529. </p>
  530. </dd>
  531. <dt><code>-remap</code></dt>
  532. <dd><a name="index-remap"></a>
  533. <p>Enable special code to work around file systems which only permit very
  534. short file names, such as MS-DOS.
  535. </p>
  536. </dd>
  537. <dt><code>-H</code></dt>
  538. <dd><a name="index-H"></a>
  539. <p>Print the name of each header file used, in addition to other normal
  540. activities. Each name is indented to show how deep in the
  541. &lsquo;<samp>#include</samp>&rsquo; stack it is. Precompiled header files are also
  542. printed, even if they are found to be invalid; an invalid precompiled
  543. header file is printed with &lsquo;<samp>...x</samp>&rsquo; and a valid one with &lsquo;<samp>...!</samp>&rsquo; .
  544. </p>
  545. </dd>
  546. <dt><code>-d<var>letters</var></code></dt>
  547. <dd><a name="index-d"></a>
  548. <p>Says to make debugging dumps during compilation as specified by
  549. <var>letters</var>. The flags documented here are those relevant to the
  550. preprocessor. Other <var>letters</var> are interpreted
  551. by the compiler proper, or reserved for future versions of GCC, and so
  552. are silently ignored. If you specify <var>letters</var> whose behavior
  553. conflicts, the result is undefined.
  554. See <a href="Developer-Options.html#Developer-Options">Developer Options</a>, for more information.
  555. </p>
  556. <dl compact="compact">
  557. <dt><code>-dM</code></dt>
  558. <dd><a name="index-dM"></a>
  559. <p>Instead of the normal output, generate a list of &lsquo;<samp>#define</samp>&rsquo;
  560. directives for all the macros defined during the execution of the
  561. preprocessor, including predefined macros. This gives you a way of
  562. finding out what is predefined in your version of the preprocessor.
  563. Assuming you have no file <samp>foo.h</samp>, the command
  564. </p>
  565. <div class="smallexample">
  566. <pre class="smallexample">touch foo.h; cpp -dM foo.h
  567. </pre></div>
  568. <p>shows all the predefined macros.
  569. </p>
  570. <p>If you use <samp>-dM</samp> without the <samp>-E</samp> option, <samp>-dM</samp> is
  571. interpreted as a synonym for <samp>-fdump-rtl-mach</samp>.
  572. See <a href="http://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html#Developer-Options">(gcc)Developer Options</a>.
  573. </p>
  574. </dd>
  575. <dt><code>-dD</code></dt>
  576. <dd><a name="index-dD"></a>
  577. <p>Like <samp>-dM</samp> except in two respects: it does <em>not</em> include the
  578. predefined macros, and it outputs <em>both</em> the &lsquo;<samp>#define</samp>&rsquo;
  579. directives and the result of preprocessing. Both kinds of output go to
  580. the standard output file.
  581. </p>
  582. </dd>
  583. <dt><code>-dN</code></dt>
  584. <dd><a name="index-dN"></a>
  585. <p>Like <samp>-dD</samp>, but emit only the macro names, not their expansions.
  586. </p>
  587. </dd>
  588. <dt><code>-dI</code></dt>
  589. <dd><a name="index-dI"></a>
  590. <p>Output &lsquo;<samp>#include</samp>&rsquo; directives in addition to the result of
  591. preprocessing.
  592. </p>
  593. </dd>
  594. <dt><code>-dU</code></dt>
  595. <dd><a name="index-dU"></a>
  596. <p>Like <samp>-dD</samp> except that only macros that are expanded, or whose
  597. definedness is tested in preprocessor directives, are output; the
  598. output is delayed until the use or test of the macro; and
  599. &lsquo;<samp>#undef</samp>&rsquo; directives are also output for macros tested but
  600. undefined at the time.
  601. </p></dd>
  602. </dl>
  603. </dd>
  604. <dt><code>-fdebug-cpp</code></dt>
  605. <dd><a name="index-fdebug_002dcpp"></a>
  606. <p>This option is only useful for debugging GCC. When used from CPP or with
  607. <samp>-E</samp>, it dumps debugging information about location maps. Every
  608. token in the output is preceded by the dump of the map its location
  609. belongs to.
  610. </p>
  611. <p>When used from GCC without <samp>-E</samp>, this option has no effect.
  612. </p>
  613. </dd>
  614. <dt><code>-Wp,<var>option</var></code></dt>
  615. <dd><a name="index-Wp"></a>
  616. <p>You can use <samp>-Wp,<var>option</var></samp> to bypass the compiler driver
  617. and pass <var>option</var> directly through to the preprocessor. If
  618. <var>option</var> contains commas, it is split into multiple options at the
  619. commas. However, many options are modified, translated or interpreted
  620. by the compiler driver before being passed to the preprocessor, and
  621. <samp>-Wp</samp> forcibly bypasses this phase. The preprocessor&rsquo;s direct
  622. interface is undocumented and subject to change, so whenever possible
  623. you should avoid using <samp>-Wp</samp> and let the driver handle the
  624. options instead.
  625. </p>
  626. </dd>
  627. <dt><code>-Xpreprocessor <var>option</var></code></dt>
  628. <dd><a name="index-Xpreprocessor"></a>
  629. <p>Pass <var>option</var> as an option to the preprocessor. You can use this to
  630. supply system-specific preprocessor options that GCC does not
  631. recognize.
  632. </p>
  633. <p>If you want to pass an option that takes an argument, you must use
  634. <samp>-Xpreprocessor</samp> twice, once for the option and once for the argument.
  635. </p>
  636. </dd>
  637. <dt><code>-no-integrated-cpp</code></dt>
  638. <dd><a name="index-no_002dintegrated_002dcpp"></a>
  639. <p>Perform preprocessing as a separate pass before compilation.
  640. By default, GCC performs preprocessing as an integrated part of
  641. input tokenization and parsing.
  642. If this option is provided, the appropriate language front end
  643. (<code>cc1</code>, <code>cc1plus</code>, or <code>cc1obj</code> for C, C++,
  644. and Objective-C, respectively) is instead invoked twice,
  645. once for preprocessing only and once for actual compilation
  646. of the preprocessed input.
  647. This option may be useful in conjunction with the <samp>-B</samp> or
  648. <samp>-wrapper</samp> options to specify an alternate preprocessor or
  649. perform additional processing of the program source between
  650. normal preprocessing and compilation.
  651. </p>
  652. </dd>
  653. </dl>
  654. <hr>
  655. <div class="header">
  656. <p>
  657. Next: <a href="Assembler-Options.html#Assembler-Options" accesskey="n" rel="next">Assembler Options</a>, Previous: <a href="Instrumentation-Options.html#Instrumentation-Options" accesskey="p" rel="prev">Instrumentation Options</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  658. </div>
  659. </body>
  660. </html>