You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Preprocessor-Options.html 31KB

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