cppopts.texi 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  1. @c Copyright (C) 1999-2015 Free Software Foundation, Inc.
  2. @c This is part of the CPP and GCC manuals.
  3. @c For copying conditions, see the file gcc.texi.
  4. @c ---------------------------------------------------------------------
  5. @c Options affecting the preprocessor
  6. @c ---------------------------------------------------------------------
  7. @c If this file is included with the flag ``cppmanual'' set, it is
  8. @c formatted for inclusion in the CPP manual; otherwise the main GCC manual.
  9. @table @gcctabopt
  10. @item -D @var{name}
  11. @opindex D
  12. Predefine @var{name} as a macro, with definition @code{1}.
  13. @item -D @var{name}=@var{definition}
  14. The contents of @var{definition} are tokenized and processed as if
  15. they appeared during translation phase three in a @samp{#define}
  16. directive. In particular, the definition will be truncated by
  17. embedded newline characters.
  18. If you are invoking the preprocessor from a shell or shell-like
  19. program you may need to use the shell's quoting syntax to protect
  20. characters such as spaces that have a meaning in the shell syntax.
  21. If you wish to define a function-like macro on the command line, write
  22. its argument list with surrounding parentheses before the equals sign
  23. (if any). Parentheses are meaningful to most shells, so you will need
  24. to quote the option. With @command{sh} and @command{csh},
  25. @option{-D'@var{name}(@var{args@dots{}})=@var{definition}'} works.
  26. @option{-D} and @option{-U} options are processed in the order they
  27. are given on the command line. All @option{-imacros @var{file}} and
  28. @option{-include @var{file}} options are processed after all
  29. @option{-D} and @option{-U} options.
  30. @item -U @var{name}
  31. @opindex U
  32. Cancel any previous definition of @var{name}, either built in or
  33. provided with a @option{-D} option.
  34. @item -undef
  35. @opindex undef
  36. Do not predefine any system-specific or GCC-specific macros. The
  37. standard predefined macros remain defined.
  38. @ifset cppmanual
  39. @xref{Standard Predefined Macros}.
  40. @end ifset
  41. @item -I @var{dir}
  42. @opindex I
  43. Add the directory @var{dir} to the list of directories to be searched
  44. for header files.
  45. @ifset cppmanual
  46. @xref{Search Path}.
  47. @end ifset
  48. Directories named by @option{-I} are searched before the standard
  49. system include directories. If the directory @var{dir} is a standard
  50. system include directory, the option is ignored to ensure that the
  51. default search order for system directories and the special treatment
  52. of system headers are not defeated
  53. @ifset cppmanual
  54. (@pxref{System Headers})
  55. @end ifset
  56. .
  57. If @var{dir} begins with @code{=}, then the @code{=} will be replaced
  58. by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
  59. @item -o @var{file}
  60. @opindex o
  61. Write output to @var{file}. This is the same as specifying @var{file}
  62. as the second non-option argument to @command{cpp}. @command{gcc} has a
  63. different interpretation of a second non-option argument, so you must
  64. use @option{-o} to specify the output file.
  65. @item -Wall
  66. @opindex Wall
  67. Turns on all optional warnings which are desirable for normal code.
  68. At present this is @option{-Wcomment}, @option{-Wtrigraphs},
  69. @option{-Wmultichar} and a warning about integer promotion causing a
  70. change of sign in @code{#if} expressions. Note that many of the
  71. preprocessor's warnings are on by default and have no options to
  72. control them.
  73. @item -Wcomment
  74. @itemx -Wcomments
  75. @opindex Wcomment
  76. @opindex Wcomments
  77. Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
  78. comment, or whenever a backslash-newline appears in a @samp{//} comment.
  79. (Both forms have the same effect.)
  80. @item -Wtrigraphs
  81. @opindex Wtrigraphs
  82. @anchor{Wtrigraphs}
  83. Most trigraphs in comments cannot affect the meaning of the program.
  84. However, a trigraph that would form an escaped newline (@samp{??/} at
  85. the end of a line) can, by changing where the comment begins or ends.
  86. Therefore, only trigraphs that would form escaped newlines produce
  87. warnings inside a comment.
  88. This option is implied by @option{-Wall}. If @option{-Wall} is not
  89. given, this option is still enabled unless trigraphs are enabled. To
  90. get trigraph conversion without warnings, but get the other
  91. @option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
  92. @item -Wtraditional
  93. @opindex Wtraditional
  94. Warn about certain constructs that behave differently in traditional and
  95. ISO C@. Also warn about ISO C constructs that have no traditional C
  96. equivalent, and problematic constructs which should be avoided.
  97. @ifset cppmanual
  98. @xref{Traditional Mode}.
  99. @end ifset
  100. @item -Wundef
  101. @opindex Wundef
  102. Warn whenever an identifier which is not a macro is encountered in an
  103. @samp{#if} directive, outside of @samp{defined}. Such identifiers are
  104. replaced with zero.
  105. @item -Wunused-macros
  106. @opindex Wunused-macros
  107. Warn about macros defined in the main file that are unused. A macro
  108. is @dfn{used} if it is expanded or tested for existence at least once.
  109. The preprocessor will also warn if the macro has not been used at the
  110. time it is redefined or undefined.
  111. Built-in macros, macros defined on the command line, and macros
  112. defined in include files are not warned about.
  113. @emph{Note:} If a macro is actually used, but only used in skipped
  114. conditional blocks, then CPP will report it as unused. To avoid the
  115. warning in such a case, you might improve the scope of the macro's
  116. definition by, for example, moving it into the first skipped block.
  117. Alternatively, you could provide a dummy use with something like:
  118. @smallexample
  119. #if defined the_macro_causing_the_warning
  120. #endif
  121. @end smallexample
  122. @item -Wendif-labels
  123. @opindex Wendif-labels
  124. Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
  125. This usually happens in code of the form
  126. @smallexample
  127. #if FOO
  128. @dots{}
  129. #else FOO
  130. @dots{}
  131. #endif FOO
  132. @end smallexample
  133. @noindent
  134. The second and third @code{FOO} should be in comments, but often are not
  135. in older programs. This warning is on by default.
  136. @item -Werror
  137. @opindex Werror
  138. Make all warnings into hard errors. Source code which triggers warnings
  139. will be rejected.
  140. @item -Wsystem-headers
  141. @opindex Wsystem-headers
  142. Issue warnings for code in system headers. These are normally unhelpful
  143. in finding bugs in your own code, therefore suppressed. If you are
  144. responsible for the system library, you may want to see them.
  145. @item -w
  146. @opindex w
  147. Suppress all warnings, including those which GNU CPP issues by default.
  148. @item -pedantic
  149. @opindex pedantic
  150. Issue all the mandatory diagnostics listed in the C standard. Some of
  151. them are left out by default, since they trigger frequently on harmless
  152. code.
  153. @item -pedantic-errors
  154. @opindex pedantic-errors
  155. Issue all the mandatory diagnostics, and make all mandatory diagnostics
  156. into errors. This includes mandatory diagnostics that GCC issues
  157. without @samp{-pedantic} but treats as warnings.
  158. @item -M
  159. @opindex M
  160. @cindex @command{make}
  161. @cindex dependencies, @command{make}
  162. Instead of outputting the result of preprocessing, output a rule
  163. suitable for @command{make} describing the dependencies of the main
  164. source file. The preprocessor outputs one @command{make} 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 @option{-include} or
  167. @option{-imacros} command-line options.
  168. Unless specified explicitly (with @option{-MT} or @option{-MQ}), 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 @samp{\}-newline. The rule has no
  173. commands.
  174. This option does not suppress the preprocessor's debug output, such as
  175. @option{-dM}. To avoid mixing such debug output with the dependency
  176. rules you should explicitly specify the dependency output file with
  177. @option{-MF}, or use an environment variable like
  178. @env{DEPENDENCIES_OUTPUT} (@pxref{Environment Variables}). Debug output
  179. will still be sent to the regular output stream as normal.
  180. Passing @option{-M} to the driver implies @option{-E}, and suppresses
  181. warnings with an implicit @option{-w}.
  182. @item -MM
  183. @opindex MM
  184. Like @option{-M} but do not mention header files that are found in
  185. system header directories, nor header files that are included,
  186. directly or indirectly, from such a header.
  187. This implies that the choice of angle brackets or double quotes in an
  188. @samp{#include} directive does not in itself determine whether that
  189. header will appear in @option{-MM} dependency output. This is a
  190. slight change in semantics from GCC versions 3.0 and earlier.
  191. @anchor{dashMF}
  192. @item -MF @var{file}
  193. @opindex MF
  194. When used with @option{-M} or @option{-MM}, specifies a
  195. file to write the dependencies to. If no @option{-MF} switch is given
  196. the preprocessor sends the rules to the same place it would have sent
  197. preprocessed output.
  198. When used with the driver options @option{-MD} or @option{-MMD},
  199. @option{-MF} overrides the default dependency output file.
  200. @item -MG
  201. @opindex MG
  202. In conjunction with an option such as @option{-M} requesting
  203. dependency generation, @option{-MG} assumes missing header files are
  204. generated files and adds them to the dependency list without raising
  205. an error. The dependency filename is taken directly from the
  206. @code{#include} directive without prepending any path. @option{-MG}
  207. also suppresses preprocessed output, as a missing header file renders
  208. this useless.
  209. This feature is used in automatic updating of makefiles.
  210. @item -MP
  211. @opindex MP
  212. This option instructs CPP to add a phony target for each dependency
  213. other than the main file, causing each to depend on nothing. These
  214. dummy rules work around errors @command{make} gives if you remove header
  215. files without updating the @file{Makefile} to match.
  216. This is typical output:
  217. @smallexample
  218. test.o: test.c test.h
  219. test.h:
  220. @end smallexample
  221. @item -MT @var{target}
  222. @opindex MT
  223. Change the target of the rule emitted by dependency generation. By
  224. default CPP takes the name of the main input file, deletes any
  225. directory components and any file suffix such as @samp{.c}, and
  226. appends the platform's usual object suffix. The result is the target.
  227. An @option{-MT} option will set the target to be exactly the string you
  228. specify. If you want multiple targets, you can specify them as a single
  229. argument to @option{-MT}, or use multiple @option{-MT} options.
  230. For example, @option{@w{-MT '$(objpfx)foo.o'}} might give
  231. @smallexample
  232. $(objpfx)foo.o: foo.c
  233. @end smallexample
  234. @item -MQ @var{target}
  235. @opindex MQ
  236. Same as @option{-MT}, but it quotes any characters which are special to
  237. Make. @option{@w{-MQ '$(objpfx)foo.o'}} gives
  238. @smallexample
  239. $$(objpfx)foo.o: foo.c
  240. @end smallexample
  241. The default target is automatically quoted, as if it were given with
  242. @option{-MQ}.
  243. @item -MD
  244. @opindex MD
  245. @option{-MD} is equivalent to @option{-M -MF @var{file}}, except that
  246. @option{-E} is not implied. The driver determines @var{file} based on
  247. whether an @option{-o} option is given. If it is, the driver uses its
  248. argument but with a suffix of @file{.d}, otherwise it takes the name
  249. of the input file, removes any directory components and suffix, and
  250. applies a @file{.d} suffix.
  251. If @option{-MD} is used in conjunction with @option{-E}, any
  252. @option{-o} switch is understood to specify the dependency output file
  253. (@pxref{dashMF,,-MF}), but if used without @option{-E}, each @option{-o}
  254. is understood to specify a target object file.
  255. Since @option{-E} is not implied, @option{-MD} can be used to generate
  256. a dependency output file as a side-effect of the compilation process.
  257. @item -MMD
  258. @opindex MMD
  259. Like @option{-MD} except mention only user header files, not system
  260. header files.
  261. @ifclear cppmanual
  262. @item -fpch-deps
  263. @opindex fpch-deps
  264. When using precompiled headers (@pxref{Precompiled Headers}), this flag
  265. will cause the dependency-output flags to also list the files from the
  266. precompiled header's dependencies. If not specified only the
  267. precompiled header would be listed and not the files that were used to
  268. create it because those files are not consulted when a precompiled
  269. header is used.
  270. @item -fpch-preprocess
  271. @opindex fpch-preprocess
  272. This option allows use of a precompiled header (@pxref{Precompiled
  273. Headers}) together with @option{-E}. It inserts a special @code{#pragma},
  274. @code{#pragma GCC pch_preprocess "@var{filename}"} in the output to mark
  275. the place where the precompiled header was found, and its @var{filename}.
  276. When @option{-fpreprocessed} is in use, GCC recognizes this @code{#pragma}
  277. and loads the PCH@.
  278. This option is off by default, because the resulting preprocessed output
  279. is only really suitable as input to GCC@. It is switched on by
  280. @option{-save-temps}.
  281. You should not write this @code{#pragma} in your own code, but it is
  282. safe to edit the filename if the PCH file is available in a different
  283. location. The filename may be absolute or it may be relative to GCC's
  284. current directory.
  285. @end ifclear
  286. @item -x c
  287. @itemx -x c++
  288. @itemx -x objective-c
  289. @itemx -x assembler-with-cpp
  290. @opindex x
  291. Specify the source language: C, C++, Objective-C, or assembly. This has
  292. nothing to do with standards conformance or extensions; it merely
  293. selects which base syntax to expect. If you give none of these options,
  294. cpp will deduce the language from the extension of the source file:
  295. @samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}. Some other common
  296. extensions for C++ and assembly are also recognized. If cpp does not
  297. recognize the extension, it will treat the file as C; this is the most
  298. generic mode.
  299. @emph{Note:} Previous versions of cpp accepted a @option{-lang} option
  300. which selected both the language and the standards conformance level.
  301. This option has been removed, because it conflicts with the @option{-l}
  302. option.
  303. @item -std=@var{standard}
  304. @itemx -ansi
  305. @opindex ansi
  306. @opindex std=
  307. Specify the standard to which the code should conform. Currently CPP
  308. knows about C and C++ standards; others may be added in the future.
  309. @var{standard}
  310. may be one of:
  311. @table @code
  312. @item c90
  313. @itemx c89
  314. @itemx iso9899:1990
  315. The ISO C standard from 1990. @samp{c90} is the customary shorthand for
  316. this version of the standard.
  317. The @option{-ansi} option is equivalent to @option{-std=c90}.
  318. @item iso9899:199409
  319. The 1990 C standard, as amended in 1994.
  320. @item iso9899:1999
  321. @itemx c99
  322. @itemx iso9899:199x
  323. @itemx c9x
  324. The revised ISO C standard, published in December 1999. Before
  325. publication, this was known as C9X@.
  326. @item iso9899:2011
  327. @itemx c11
  328. @itemx c1x
  329. The revised ISO C standard, published in December 2011. Before
  330. publication, this was known as C1X@.
  331. @item gnu90
  332. @itemx gnu89
  333. The 1990 C standard plus GNU extensions. This is the default.
  334. @item gnu99
  335. @itemx gnu9x
  336. The 1999 C standard plus GNU extensions.
  337. @item gnu11
  338. @itemx gnu1x
  339. The 2011 C standard plus GNU extensions.
  340. @item c++98
  341. The 1998 ISO C++ standard plus amendments.
  342. @item gnu++98
  343. The same as @option{-std=c++98} plus GNU extensions. This is the
  344. default for C++ code.
  345. @end table
  346. @item -I-
  347. @opindex I-
  348. Split the include path. Any directories specified with @option{-I}
  349. options before @option{-I-} are searched only for headers requested with
  350. @code{@w{#include "@var{file}"}}; they are not searched for
  351. @code{@w{#include <@var{file}>}}. If additional directories are
  352. specified with @option{-I} options after the @option{-I-}, those
  353. directories are searched for all @samp{#include} directives.
  354. In addition, @option{-I-} inhibits the use of the directory of the current
  355. file directory as the first search directory for @code{@w{#include
  356. "@var{file}"}}.
  357. @ifset cppmanual
  358. @xref{Search Path}.
  359. @end ifset
  360. This option has been deprecated.
  361. @item -nostdinc
  362. @opindex nostdinc
  363. Do not search the standard system directories for header files.
  364. Only the directories you have specified with @option{-I} options
  365. (and the directory of the current file, if appropriate) are searched.
  366. @item -nostdinc++
  367. @opindex nostdinc++
  368. Do not search for header files in the C++-specific standard directories,
  369. but do still search the other standard directories. (This option is
  370. used when building the C++ library.)
  371. @item -include @var{file}
  372. @opindex include
  373. Process @var{file} as if @code{#include "file"} appeared as the first
  374. line of the primary source file. However, the first directory searched
  375. for @var{file} is the preprocessor's working directory @emph{instead of}
  376. the directory containing the main source file. If not found there, it
  377. is searched for in the remainder of the @code{#include "@dots{}"} search
  378. chain as normal.
  379. If multiple @option{-include} options are given, the files are included
  380. in the order they appear on the command line.
  381. @item -imacros @var{file}
  382. @opindex imacros
  383. Exactly like @option{-include}, except that any output produced by
  384. scanning @var{file} is thrown away. Macros it defines remain defined.
  385. This allows you to acquire all the macros from a header without also
  386. processing its declarations.
  387. All files specified by @option{-imacros} are processed before all files
  388. specified by @option{-include}.
  389. @item -idirafter @var{dir}
  390. @opindex idirafter
  391. Search @var{dir} for header files, but do it @emph{after} all
  392. directories specified with @option{-I} and the standard system directories
  393. have been exhausted. @var{dir} is treated as a system include directory.
  394. If @var{dir} begins with @code{=}, then the @code{=} will be replaced
  395. by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
  396. @item -iprefix @var{prefix}
  397. @opindex iprefix
  398. Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
  399. options. If the prefix represents a directory, you should include the
  400. final @samp{/}.
  401. @item -iwithprefix @var{dir}
  402. @itemx -iwithprefixbefore @var{dir}
  403. @opindex iwithprefix
  404. @opindex iwithprefixbefore
  405. Append @var{dir} to the prefix specified previously with
  406. @option{-iprefix}, and add the resulting directory to the include search
  407. path. @option{-iwithprefixbefore} puts it in the same place @option{-I}
  408. would; @option{-iwithprefix} puts it where @option{-idirafter} would.
  409. @item -isysroot @var{dir}
  410. @opindex isysroot
  411. This option is like the @option{--sysroot} option, but applies only to
  412. header files (except for Darwin targets, where it applies to both header
  413. files and libraries). See the @option{--sysroot} option for more
  414. information.
  415. @item -imultilib @var{dir}
  416. @opindex imultilib
  417. Use @var{dir} as a subdirectory of the directory containing
  418. target-specific C++ headers.
  419. @item -isystem @var{dir}
  420. @opindex isystem
  421. Search @var{dir} for header files, after all directories specified by
  422. @option{-I} but before the standard system directories. Mark it
  423. as a system directory, so that it gets the same special treatment as
  424. is applied to the standard system directories.
  425. @ifset cppmanual
  426. @xref{System Headers}.
  427. @end ifset
  428. If @var{dir} begins with @code{=}, then the @code{=} will be replaced
  429. by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
  430. @item -iquote @var{dir}
  431. @opindex iquote
  432. Search @var{dir} only for header files requested with
  433. @code{@w{#include "@var{file}"}}; they are not searched for
  434. @code{@w{#include <@var{file}>}}, before all directories specified by
  435. @option{-I} and before the standard system directories.
  436. @ifset cppmanual
  437. @xref{Search Path}.
  438. @end ifset
  439. If @var{dir} begins with @code{=}, then the @code{=} will be replaced
  440. by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
  441. @item -fdirectives-only
  442. @opindex fdirectives-only
  443. When preprocessing, handle directives, but do not expand macros.
  444. The option's behavior depends on the @option{-E} and @option{-fpreprocessed}
  445. options.
  446. With @option{-E}, preprocessing is limited to the handling of directives
  447. such as @code{#define}, @code{#ifdef}, and @code{#error}. Other
  448. preprocessor operations, such as macro expansion and trigraph
  449. conversion are not performed. In addition, the @option{-dD} option is
  450. implicitly enabled.
  451. With @option{-fpreprocessed}, predefinition of command line and most
  452. builtin macros is disabled. Macros such as @code{__LINE__}, which are
  453. contextually dependent, are handled normally. This enables compilation of
  454. files previously preprocessed with @code{-E -fdirectives-only}.
  455. With both @option{-E} and @option{-fpreprocessed}, the rules for
  456. @option{-fpreprocessed} take precedence. This enables full preprocessing of
  457. files previously preprocessed with @code{-E -fdirectives-only}.
  458. @item -fdollars-in-identifiers
  459. @opindex fdollars-in-identifiers
  460. @anchor{fdollars-in-identifiers}
  461. Accept @samp{$} in identifiers.
  462. @ifset cppmanual
  463. @xref{Identifier characters}.
  464. @end ifset
  465. @item -fextended-identifiers
  466. @opindex fextended-identifiers
  467. Accept universal character names in identifiers. This option is
  468. enabled by default for C99 (and later C standard versions) and C++.
  469. @item -fno-canonical-system-headers
  470. @opindex fno-canonical-system-headers
  471. When preprocessing, do not shorten system header paths with canonicalization.
  472. @item -fpreprocessed
  473. @opindex fpreprocessed
  474. Indicate to the preprocessor that the input file has already been
  475. preprocessed. This suppresses things like macro expansion, trigraph
  476. conversion, escaped newline splicing, and processing of most directives.
  477. The preprocessor still recognizes and removes comments, so that you can
  478. pass a file preprocessed with @option{-C} to the compiler without
  479. problems. In this mode the integrated preprocessor is little more than
  480. a tokenizer for the front ends.
  481. @option{-fpreprocessed} is implicit if the input file has one of the
  482. extensions @samp{.i}, @samp{.ii} or @samp{.mi}. These are the
  483. extensions that GCC uses for preprocessed files created by
  484. @option{-save-temps}.
  485. @item -ftabstop=@var{width}
  486. @opindex ftabstop
  487. Set the distance between tab stops. This helps the preprocessor report
  488. correct column numbers in warnings or errors, even if tabs appear on the
  489. line. If the value is less than 1 or greater than 100, the option is
  490. ignored. The default is 8.
  491. @item -fdebug-cpp
  492. @opindex fdebug-cpp
  493. This option is only useful for debugging GCC. When used with
  494. @option{-E}, dumps debugging information about location maps. Every
  495. token in the output is preceded by the dump of the map its location
  496. belongs to. The dump of the map holding the location of a token would
  497. be:
  498. @smallexample
  499. @{@samp{P}:@file{/file/path};@samp{F}:@file{/includer/path};@samp{L}:@var{line_num};@samp{C}:@var{col_num};@samp{S}:@var{system_header_p};@samp{M}:@var{map_address};@samp{E}:@var{macro_expansion_p},@samp{loc}:@var{location}@}
  500. @end smallexample
  501. When used without @option{-E}, this option has no effect.
  502. @item -ftrack-macro-expansion@r{[}=@var{level}@r{]}
  503. @opindex ftrack-macro-expansion
  504. Track locations of tokens across macro expansions. This allows the
  505. compiler to emit diagnostic about the current macro expansion stack
  506. when a compilation error occurs in a macro expansion. Using this
  507. option makes the preprocessor and the compiler consume more
  508. memory. The @var{level} parameter can be used to choose the level of
  509. precision of token location tracking thus decreasing the memory
  510. consumption if necessary. Value @samp{0} of @var{level} de-activates
  511. this option just as if no @option{-ftrack-macro-expansion} was present
  512. on the command line. Value @samp{1} tracks tokens locations in a
  513. degraded mode for the sake of minimal memory overhead. In this mode
  514. all tokens resulting from the expansion of an argument of a
  515. function-like macro have the same location. Value @samp{2} tracks
  516. tokens locations completely. This value is the most memory hungry.
  517. When this option is given no argument, the default parameter value is
  518. @samp{2}.
  519. Note that @code{-ftrack-macro-expansion=2} is activated by default.
  520. @item -fexec-charset=@var{charset}
  521. @opindex fexec-charset
  522. @cindex character set, execution
  523. Set the execution character set, used for string and character
  524. constants. The default is UTF-8. @var{charset} can be any encoding
  525. supported by the system's @code{iconv} library routine.
  526. @item -fwide-exec-charset=@var{charset}
  527. @opindex fwide-exec-charset
  528. @cindex character set, wide execution
  529. Set the wide execution character set, used for wide string and
  530. character constants. The default is UTF-32 or UTF-16, whichever
  531. corresponds to the width of @code{wchar_t}. As with
  532. @option{-fexec-charset}, @var{charset} can be any encoding supported
  533. by the system's @code{iconv} library routine; however, you will have
  534. problems with encodings that do not fit exactly in @code{wchar_t}.
  535. @item -finput-charset=@var{charset}
  536. @opindex finput-charset
  537. @cindex character set, input
  538. Set the input character set, used for translation from the character
  539. set of the input file to the source character set used by GCC@. If the
  540. locale does not specify, or GCC cannot get this information from the
  541. locale, the default is UTF-8. This can be overridden by either the locale
  542. or this command-line option. Currently the command-line option takes
  543. precedence if there's a conflict. @var{charset} can be any encoding
  544. supported by the system's @code{iconv} library routine.
  545. @item -fworking-directory
  546. @opindex fworking-directory
  547. @opindex fno-working-directory
  548. Enable generation of linemarkers in the preprocessor output that will
  549. let the compiler know the current working directory at the time of
  550. preprocessing. When this option is enabled, the preprocessor will
  551. emit, after the initial linemarker, a second linemarker with the
  552. current working directory followed by two slashes. GCC will use this
  553. directory, when it's present in the preprocessed input, as the
  554. directory emitted as the current working directory in some debugging
  555. information formats. This option is implicitly enabled if debugging
  556. information is enabled, but this can be inhibited with the negated
  557. form @option{-fno-working-directory}. If the @option{-P} flag is
  558. present in the command line, this option has no effect, since no
  559. @code{#line} directives are emitted whatsoever.
  560. @item -fno-show-column
  561. @opindex fno-show-column
  562. Do not print column numbers in diagnostics. This may be necessary if
  563. diagnostics are being scanned by a program that does not understand the
  564. column numbers, such as @command{dejagnu}.
  565. @item -A @var{predicate}=@var{answer}
  566. @opindex A
  567. Make an assertion with the predicate @var{predicate} and answer
  568. @var{answer}. This form is preferred to the older form @option{-A
  569. @var{predicate}(@var{answer})}, which is still supported, because
  570. it does not use shell special characters.
  571. @ifset cppmanual
  572. @xref{Obsolete Features}.
  573. @end ifset
  574. @item -A -@var{predicate}=@var{answer}
  575. Cancel an assertion with the predicate @var{predicate} and answer
  576. @var{answer}.
  577. @item -dCHARS
  578. @var{CHARS} is a sequence of one or more of the following characters,
  579. and must not be preceded by a space. Other characters are interpreted
  580. by the compiler proper, or reserved for future versions of GCC, and so
  581. are silently ignored. If you specify characters whose behavior
  582. conflicts, the result is undefined.
  583. @table @samp
  584. @item M
  585. @opindex dM
  586. Instead of the normal output, generate a list of @samp{#define}
  587. directives for all the macros defined during the execution of the
  588. preprocessor, including predefined macros. This gives you a way of
  589. finding out what is predefined in your version of the preprocessor.
  590. Assuming you have no file @file{foo.h}, the command
  591. @smallexample
  592. touch foo.h; cpp -dM foo.h
  593. @end smallexample
  594. @noindent
  595. will show all the predefined macros.
  596. If you use @option{-dM} without the @option{-E} option, @option{-dM} is
  597. interpreted as a synonym for @option{-fdump-rtl-mach}.
  598. @xref{Debugging Options, , ,gcc}.
  599. @item D
  600. @opindex dD
  601. Like @samp{M} except in two respects: it does @emph{not} include the
  602. predefined macros, and it outputs @emph{both} the @samp{#define}
  603. directives and the result of preprocessing. Both kinds of output go to
  604. the standard output file.
  605. @item N
  606. @opindex dN
  607. Like @samp{D}, but emit only the macro names, not their expansions.
  608. @item I
  609. @opindex dI
  610. Output @samp{#include} directives in addition to the result of
  611. preprocessing.
  612. @item U
  613. @opindex dU
  614. Like @samp{D} except that only macros that are expanded, or whose
  615. definedness is tested in preprocessor directives, are output; the
  616. output is delayed until the use or test of the macro; and
  617. @samp{#undef} directives are also output for macros tested but
  618. undefined at the time.
  619. @end table
  620. @item -P
  621. @opindex P
  622. Inhibit generation of linemarkers in the output from the preprocessor.
  623. This might be useful when running the preprocessor on something that is
  624. not C code, and will be sent to a program which might be confused by the
  625. linemarkers.
  626. @ifset cppmanual
  627. @xref{Preprocessor Output}.
  628. @end ifset
  629. @item -C
  630. @opindex C
  631. Do not discard comments. All comments are passed through to the output
  632. file, except for comments in processed directives, which are deleted
  633. along with the directive.
  634. You should be prepared for side effects when using @option{-C}; it
  635. causes the preprocessor to treat comments as tokens in their own right.
  636. For example, comments appearing at the start of what would be a
  637. directive line have the effect of turning that line into an ordinary
  638. source line, since the first token on the line is no longer a @samp{#}.
  639. @item -CC
  640. Do not discard comments, including during macro expansion. This is
  641. like @option{-C}, except that comments contained within macros are
  642. also passed through to the output file where the macro is expanded.
  643. In addition to the side-effects of the @option{-C} option, the
  644. @option{-CC} option causes all C++-style comments inside a macro
  645. to be converted to C-style comments. This is to prevent later use
  646. of that macro from inadvertently commenting out the remainder of
  647. the source line.
  648. The @option{-CC} option is generally used to support lint comments.
  649. @item -traditional-cpp
  650. @opindex traditional-cpp
  651. Try to imitate the behavior of old-fashioned C preprocessors, as
  652. opposed to ISO C preprocessors.
  653. @ifset cppmanual
  654. @xref{Traditional Mode}.
  655. @end ifset
  656. @item -trigraphs
  657. @opindex trigraphs
  658. Process trigraph sequences.
  659. @ifset cppmanual
  660. @xref{Initial processing}.
  661. @end ifset
  662. @ifclear cppmanual
  663. These are three-character sequences, all starting with @samp{??}, that
  664. are defined by ISO C to stand for single characters. For example,
  665. @samp{??/} stands for @samp{\}, so @samp{'??/n'} is a character
  666. constant for a newline. By default, GCC ignores trigraphs, but in
  667. standard-conforming modes it converts them. See the @option{-std} and
  668. @option{-ansi} options.
  669. The nine trigraphs and their replacements are
  670. @smallexample
  671. Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
  672. Replacement: [ ] @{ @} # \ ^ | ~
  673. @end smallexample
  674. @end ifclear
  675. @item -remap
  676. @opindex remap
  677. Enable special code to work around file systems which only permit very
  678. short file names, such as MS-DOS@.
  679. @item --help
  680. @itemx --target-help
  681. @opindex help
  682. @opindex target-help
  683. Print text describing all the command-line options instead of
  684. preprocessing anything.
  685. @item -v
  686. @opindex v
  687. Verbose mode. Print out GNU CPP's version number at the beginning of
  688. execution, and report the final form of the include path.
  689. @item -H
  690. @opindex H
  691. Print the name of each header file used, in addition to other normal
  692. activities. Each name is indented to show how deep in the
  693. @samp{#include} stack it is. Precompiled header files are also
  694. printed, even if they are found to be invalid; an invalid precompiled
  695. header file is printed with @samp{...x} and a valid one with @samp{...!} .
  696. @item -version
  697. @itemx --version
  698. @opindex version
  699. Print out GNU CPP's version number. With one dash, proceed to
  700. preprocess as normal. With two dashes, exit immediately.
  701. @end table