You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
698 lines
31 KiB
HTML
698 lines
31 KiB
HTML
4 years ago
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html>
|
||
|
<!-- Copyright (C) 1988-2018 Free Software Foundation, Inc.
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||
|
any later version published by the Free Software Foundation; with the
|
||
|
Invariant Sections being "Funding Free Software", the Front-Cover
|
||
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
||
|
(see below). A copy of the license is included in the section entitled
|
||
|
"GNU Free Documentation License".
|
||
|
|
||
|
(a) The FSF's Front-Cover Text is:
|
||
|
|
||
|
A GNU Manual
|
||
|
|
||
|
(b) The FSF's Back-Cover Text is:
|
||
|
|
||
|
You have freedom to copy and modify this GNU Manual, like GNU
|
||
|
software. Copies published by the Free Software Foundation raise
|
||
|
funds for GNU development. -->
|
||
|
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
|
||
|
<head>
|
||
|
<title>Preprocessor Options (Using the GNU Compiler Collection (GCC))</title>
|
||
|
|
||
|
<meta name="description" content="Preprocessor Options (Using the GNU Compiler Collection (GCC))">
|
||
|
<meta name="keywords" content="Preprocessor Options (Using the GNU Compiler Collection (GCC))">
|
||
|
<meta name="resource-type" content="document">
|
||
|
<meta name="distribution" content="global">
|
||
|
<meta name="Generator" content="makeinfo">
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<link href="index.html#Top" rel="start" title="Top">
|
||
|
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
|
||
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||
|
<link href="Invoking-GCC.html#Invoking-GCC" rel="up" title="Invoking GCC">
|
||
|
<link href="Assembler-Options.html#Assembler-Options" rel="next" title="Assembler Options">
|
||
|
<link href="Instrumentation-Options.html#Instrumentation-Options" rel="prev" title="Instrumentation Options">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
a.summary-letter {text-decoration: none}
|
||
|
blockquote.indentedblock {margin-right: 0em}
|
||
|
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||
|
blockquote.smallquotation {font-size: smaller}
|
||
|
div.display {margin-left: 3.2em}
|
||
|
div.example {margin-left: 3.2em}
|
||
|
div.lisp {margin-left: 3.2em}
|
||
|
div.smalldisplay {margin-left: 3.2em}
|
||
|
div.smallexample {margin-left: 3.2em}
|
||
|
div.smalllisp {margin-left: 3.2em}
|
||
|
kbd {font-style: oblique}
|
||
|
pre.display {font-family: inherit}
|
||
|
pre.format {font-family: inherit}
|
||
|
pre.menu-comment {font-family: serif}
|
||
|
pre.menu-preformatted {font-family: serif}
|
||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||
|
pre.smallexample {font-size: smaller}
|
||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||
|
pre.smalllisp {font-size: smaller}
|
||
|
span.nolinebreak {white-space: nowrap}
|
||
|
span.roman {font-family: initial; font-weight: normal}
|
||
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||
|
ul.no-bullet {list-style: none}
|
||
|
-->
|
||
|
</style>
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body lang="en">
|
||
|
<a name="Preprocessor-Options"></a>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
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> [<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>
|
||
|
</div>
|
||
|
<hr>
|
||
|
<a name="Options-Controlling-the-Preprocessor"></a>
|
||
|
<h3 class="section">3.12 Options Controlling the Preprocessor</h3>
|
||
|
<a name="index-preprocessor-options"></a>
|
||
|
<a name="index-options_002c-preprocessor"></a>
|
||
|
|
||
|
<p>These options control the C preprocessor, which is run on each C source
|
||
|
file before actual compilation.
|
||
|
</p>
|
||
|
<p>If you use the <samp>-E</samp> option, nothing is done except preprocessing.
|
||
|
Some of these options make sense only together with <samp>-E</samp> because
|
||
|
they cause the preprocessor output to be unsuitable for actual
|
||
|
compilation.
|
||
|
</p>
|
||
|
<p>In addition to the options listed here, there are a number of options
|
||
|
to control search paths for include files documented in
|
||
|
<a href="Directory-Options.html#Directory-Options">Directory Options</a>.
|
||
|
Options to control preprocessor diagnostics are listed in
|
||
|
<a href="Warning-Options.html#Warning-Options">Warning Options</a>.
|
||
|
</p>
|
||
|
<dl compact="compact">
|
||
|
<dt><code>-D <var>name</var></code></dt>
|
||
|
<dd><a name="index-D"></a>
|
||
|
<p>Predefine <var>name</var> as a macro, with definition <code>1</code>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-D <var>name</var>=<var>definition</var></code></dt>
|
||
|
<dd><p>The contents of <var>definition</var> are tokenized and processed as if
|
||
|
they appeared during translation phase three in a ‘<samp>#define</samp>’
|
||
|
directive. In particular, the definition is truncated by
|
||
|
embedded newline characters.
|
||
|
</p>
|
||
|
<p>If you are invoking the preprocessor from a shell or shell-like
|
||
|
program you may need to use the shell’s quoting syntax to protect
|
||
|
characters such as spaces that have a meaning in the shell syntax.
|
||
|
</p>
|
||
|
<p>If you wish to define a function-like macro on the command line, write
|
||
|
its argument list with surrounding parentheses before the equals sign
|
||
|
(if any). Parentheses are meaningful to most shells, so you should
|
||
|
quote the option. With <code>sh</code> and <code>csh</code>,
|
||
|
<samp>-D'<var>name</var>(<var>args…</var>)=<var>definition</var>'</samp> works.
|
||
|
</p>
|
||
|
<p><samp>-D</samp> and <samp>-U</samp> options are processed in the order they
|
||
|
are given on the command line. All <samp>-imacros <var>file</var></samp> and
|
||
|
<samp>-include <var>file</var></samp> options are processed after all
|
||
|
<samp>-D</samp> and <samp>-U</samp> options.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-U <var>name</var></code></dt>
|
||
|
<dd><a name="index-U"></a>
|
||
|
<p>Cancel any previous definition of <var>name</var>, either built in or
|
||
|
provided with a <samp>-D</samp> option.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-include <var>file</var></code></dt>
|
||
|
<dd><a name="index-include"></a>
|
||
|
<p>Process <var>file</var> as if <code>#include "file"</code> appeared as the first
|
||
|
line of the primary source file. However, the first directory searched
|
||
|
for <var>file</var> is the preprocessor’s working directory <em>instead of</em>
|
||
|
the directory containing the main source file. If not found there, it
|
||
|
is searched for in the remainder of the <code>#include "…"</code> search
|
||
|
chain as normal.
|
||
|
</p>
|
||
|
<p>If multiple <samp>-include</samp> options are given, the files are included
|
||
|
in the order they appear on the command line.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-imacros <var>file</var></code></dt>
|
||
|
<dd><a name="index-imacros"></a>
|
||
|
<p>Exactly like <samp>-include</samp>, except that any output produced by
|
||
|
scanning <var>file</var> is thrown away. Macros it defines remain defined.
|
||
|
This allows you to acquire all the macros from a header without also
|
||
|
processing its declarations.
|
||
|
</p>
|
||
|
<p>All files specified by <samp>-imacros</samp> are processed before all files
|
||
|
specified by <samp>-include</samp>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-undef</code></dt>
|
||
|
<dd><a name="index-undef"></a>
|
||
|
<p>Do not predefine any system-specific or GCC-specific macros. The
|
||
|
standard predefined macros remain defined.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-pthread</code></dt>
|
||
|
<dd><a name="index-pthread"></a>
|
||
|
<p>Define additional macros required for using the POSIX threads library.
|
||
|
You should use this option consistently for both compilation and linking.
|
||
|
This option is supported on GNU/Linux targets, most other Unix derivatives,
|
||
|
and also on x86 Cygwin and MinGW targets.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-M</code></dt>
|
||
|
<dd><a name="index-M"></a>
|
||
|
<a name="index-make"></a>
|
||
|
<a name="index-dependencies_002c-make"></a>
|
||
|
<p>Instead of outputting the result of preprocessing, output a rule
|
||
|
suitable for <code>make</code> describing the dependencies of the main
|
||
|
source file. The preprocessor outputs one <code>make</code> rule containing
|
||
|
the object file name for that source file, a colon, and the names of all
|
||
|
the included files, including those coming from <samp>-include</samp> or
|
||
|
<samp>-imacros</samp> command-line options.
|
||
|
</p>
|
||
|
<p>Unless specified explicitly (with <samp>-MT</samp> or <samp>-MQ</samp>), the
|
||
|
object file name consists of the name of the source file with any
|
||
|
suffix replaced with object file suffix and with any leading directory
|
||
|
parts removed. If there are many included files then the rule is
|
||
|
split into several lines using ‘<samp>\</samp>’-newline. The rule has no
|
||
|
commands.
|
||
|
</p>
|
||
|
<p>This option does not suppress the preprocessor’s debug output, such as
|
||
|
<samp>-dM</samp>. To avoid mixing such debug output with the dependency
|
||
|
rules you should explicitly specify the dependency output file with
|
||
|
<samp>-MF</samp>, or use an environment variable like
|
||
|
<code>DEPENDENCIES_OUTPUT</code> (see <a href="Environment-Variables.html#Environment-Variables">Environment Variables</a>). Debug output
|
||
|
is still sent to the regular output stream as normal.
|
||
|
</p>
|
||
|
<p>Passing <samp>-M</samp> to the driver implies <samp>-E</samp>, and suppresses
|
||
|
warnings with an implicit <samp>-w</samp>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-MM</code></dt>
|
||
|
<dd><a name="index-MM"></a>
|
||
|
<p>Like <samp>-M</samp> but do not mention header files that are found in
|
||
|
system header directories, nor header files that are included,
|
||
|
directly or indirectly, from such a header.
|
||
|
</p>
|
||
|
<p>This implies that the choice of angle brackets or double quotes in an
|
||
|
‘<samp>#include</samp>’ directive does not in itself determine whether that
|
||
|
header appears in <samp>-MM</samp> dependency output.
|
||
|
</p>
|
||
|
<a name="dashMF"></a></dd>
|
||
|
<dt><code>-MF <var>file</var></code></dt>
|
||
|
<dd><a name="index-MF"></a>
|
||
|
<p>When used with <samp>-M</samp> or <samp>-MM</samp>, specifies a
|
||
|
file to write the dependencies to. If no <samp>-MF</samp> switch is given
|
||
|
the preprocessor sends the rules to the same place it would send
|
||
|
preprocessed output.
|
||
|
</p>
|
||
|
<p>When used with the driver options <samp>-MD</samp> or <samp>-MMD</samp>,
|
||
|
<samp>-MF</samp> overrides the default dependency output file.
|
||
|
</p>
|
||
|
<p>If <var>file</var> is <samp>-</samp>, then the dependencies are written to <samp>stdout</samp>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-MG</code></dt>
|
||
|
<dd><a name="index-MG"></a>
|
||
|
<p>In conjunction with an option such as <samp>-M</samp> requesting
|
||
|
dependency generation, <samp>-MG</samp> assumes missing header files are
|
||
|
generated files and adds them to the dependency list without raising
|
||
|
an error. The dependency filename is taken directly from the
|
||
|
<code>#include</code> directive without prepending any path. <samp>-MG</samp>
|
||
|
also suppresses preprocessed output, as a missing header file renders
|
||
|
this useless.
|
||
|
</p>
|
||
|
<p>This feature is used in automatic updating of makefiles.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-MP</code></dt>
|
||
|
<dd><a name="index-MP"></a>
|
||
|
<p>This option instructs CPP to add a phony target for each dependency
|
||
|
other than the main file, causing each to depend on nothing. These
|
||
|
dummy rules work around errors <code>make</code> gives if you remove header
|
||
|
files without updating the <samp>Makefile</samp> to match.
|
||
|
</p>
|
||
|
<p>This is typical output:
|
||
|
</p>
|
||
|
<div class="smallexample">
|
||
|
<pre class="smallexample">test.o: test.c test.h
|
||
|
|
||
|
test.h:
|
||
|
</pre></div>
|
||
|
|
||
|
</dd>
|
||
|
<dt><code>-MT <var>target</var></code></dt>
|
||
|
<dd><a name="index-MT"></a>
|
||
|
|
||
|
<p>Change the target of the rule emitted by dependency generation. By
|
||
|
default CPP takes the name of the main input file, deletes any
|
||
|
directory components and any file suffix such as ‘<samp>.c</samp>’, and
|
||
|
appends the platform’s usual object suffix. The result is the target.
|
||
|
</p>
|
||
|
<p>An <samp>-MT</samp> option sets the target to be exactly the string you
|
||
|
specify. If you want multiple targets, you can specify them as a single
|
||
|
argument to <samp>-MT</samp>, or use multiple <samp>-MT</samp> options.
|
||
|
</p>
|
||
|
<p>For example, <samp><span class="nolinebreak">-MT</span> '$(objpfx)foo.o'<!-- /@w --></samp> might give
|
||
|
</p>
|
||
|
<div class="smallexample">
|
||
|
<pre class="smallexample">$(objpfx)foo.o: foo.c
|
||
|
</pre></div>
|
||
|
|
||
|
</dd>
|
||
|
<dt><code>-MQ <var>target</var></code></dt>
|
||
|
<dd><a name="index-MQ"></a>
|
||
|
|
||
|
<p>Same as <samp>-MT</samp>, but it quotes any characters which are special to
|
||
|
Make. <samp><span class="nolinebreak">-MQ</span> '$(objpfx)foo.o'<!-- /@w --></samp> gives
|
||
|
</p>
|
||
|
<div class="smallexample">
|
||
|
<pre class="smallexample">$$(objpfx)foo.o: foo.c
|
||
|
</pre></div>
|
||
|
|
||
|
<p>The default target is automatically quoted, as if it were given with
|
||
|
<samp>-MQ</samp>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-MD</code></dt>
|
||
|
<dd><a name="index-MD"></a>
|
||
|
<p><samp>-MD</samp> is equivalent to <samp>-M -MF <var>file</var></samp>, except that
|
||
|
<samp>-E</samp> is not implied. The driver determines <var>file</var> based on
|
||
|
whether an <samp>-o</samp> option is given. If it is, the driver uses its
|
||
|
argument but with a suffix of <samp>.d</samp>, otherwise it takes the name
|
||
|
of the input file, removes any directory components and suffix, and
|
||
|
applies a <samp>.d</samp> suffix.
|
||
|
</p>
|
||
|
<p>If <samp>-MD</samp> is used in conjunction with <samp>-E</samp>, any
|
||
|
<samp>-o</samp> switch is understood to specify the dependency output file
|
||
|
(see <a href="#dashMF">-MF</a>), but if used without <samp>-E</samp>, each <samp>-o</samp>
|
||
|
is understood to specify a target object file.
|
||
|
</p>
|
||
|
<p>Since <samp>-E</samp> is not implied, <samp>-MD</samp> can be used to generate
|
||
|
a dependency output file as a side effect of the compilation process.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-MMD</code></dt>
|
||
|
<dd><a name="index-MMD"></a>
|
||
|
<p>Like <samp>-MD</samp> except mention only user header files, not system
|
||
|
header files.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fpreprocessed</code></dt>
|
||
|
<dd><a name="index-fpreprocessed"></a>
|
||
|
<p>Indicate to the preprocessor that the input file has already been
|
||
|
preprocessed. This suppresses things like macro expansion, trigraph
|
||
|
conversion, escaped newline splicing, and processing of most directives.
|
||
|
The preprocessor still recognizes and removes comments, so that you can
|
||
|
pass a file preprocessed with <samp>-C</samp> to the compiler without
|
||
|
problems. In this mode the integrated preprocessor is little more than
|
||
|
a tokenizer for the front ends.
|
||
|
</p>
|
||
|
<p><samp>-fpreprocessed</samp> is implicit if the input file has one of the
|
||
|
extensions ‘<samp>.i</samp>’, ‘<samp>.ii</samp>’ or ‘<samp>.mi</samp>’. These are the
|
||
|
extensions that GCC uses for preprocessed files created by
|
||
|
<samp>-save-temps</samp>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fdirectives-only</code></dt>
|
||
|
<dd><a name="index-fdirectives_002donly"></a>
|
||
|
<p>When preprocessing, handle directives, but do not expand macros.
|
||
|
</p>
|
||
|
<p>The option’s behavior depends on the <samp>-E</samp> and <samp>-fpreprocessed</samp>
|
||
|
options.
|
||
|
</p>
|
||
|
<p>With <samp>-E</samp>, preprocessing is limited to the handling of directives
|
||
|
such as <code>#define</code>, <code>#ifdef</code>, and <code>#error</code>. Other
|
||
|
preprocessor operations, such as macro expansion and trigraph
|
||
|
conversion are not performed. In addition, the <samp>-dD</samp> option is
|
||
|
implicitly enabled.
|
||
|
</p>
|
||
|
<p>With <samp>-fpreprocessed</samp>, predefinition of command line and most
|
||
|
builtin macros is disabled. Macros such as <code>__LINE__</code>, which are
|
||
|
contextually dependent, are handled normally. This enables compilation of
|
||
|
files previously preprocessed with <code>-E -fdirectives-only</code>.
|
||
|
</p>
|
||
|
<p>With both <samp>-E</samp> and <samp>-fpreprocessed</samp>, the rules for
|
||
|
<samp>-fpreprocessed</samp> take precedence. This enables full preprocessing of
|
||
|
files previously preprocessed with <code>-E -fdirectives-only</code>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fdollars-in-identifiers</code></dt>
|
||
|
<dd><a name="index-fdollars_002din_002didentifiers"></a>
|
||
|
<a name="fdollars_002din_002didentifiers"></a><p>Accept ‘<samp>$</samp>’ in identifiers.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fextended-identifiers</code></dt>
|
||
|
<dd><a name="index-fextended_002didentifiers"></a>
|
||
|
<p>Accept universal character names in identifiers. This option is
|
||
|
enabled by default for C99 (and later C standard versions) and C++.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fno-canonical-system-headers</code></dt>
|
||
|
<dd><a name="index-fno_002dcanonical_002dsystem_002dheaders"></a>
|
||
|
<p>When preprocessing, do not shorten system header paths with canonicalization.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-ftabstop=<var>width</var></code></dt>
|
||
|
<dd><a name="index-ftabstop"></a>
|
||
|
<p>Set the distance between tab stops. This helps the preprocessor report
|
||
|
correct column numbers in warnings or errors, even if tabs appear on the
|
||
|
line. If the value is less than 1 or greater than 100, the option is
|
||
|
ignored. The default is 8.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-ftrack-macro-expansion<span class="roman">[</span>=<var>level</var><span class="roman">]</span></code></dt>
|
||
|
<dd><a name="index-ftrack_002dmacro_002dexpansion"></a>
|
||
|
<p>Track locations of tokens across macro expansions. This allows the
|
||
|
compiler to emit diagnostic about the current macro expansion stack
|
||
|
when a compilation error occurs in a macro expansion. Using this
|
||
|
option makes the preprocessor and the compiler consume more
|
||
|
memory. The <var>level</var> parameter can be used to choose the level of
|
||
|
precision of token location tracking thus decreasing the memory
|
||
|
consumption if necessary. Value ‘<samp>0</samp>’ of <var>level</var> de-activates
|
||
|
this option. Value ‘<samp>1</samp>’ tracks tokens locations in a
|
||
|
degraded mode for the sake of minimal memory overhead. In this mode
|
||
|
all tokens resulting from the expansion of an argument of a
|
||
|
function-like macro have the same location. Value ‘<samp>2</samp>’ tracks
|
||
|
tokens locations completely. This value is the most memory hungry.
|
||
|
When this option is given no argument, the default parameter value is
|
||
|
‘<samp>2</samp>’.
|
||
|
</p>
|
||
|
<p>Note that <code>-ftrack-macro-expansion=2</code> is activated by default.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fmacro-prefix-map=<var>old</var>=<var>new</var></code></dt>
|
||
|
<dd><a name="index-fmacro_002dprefix_002dmap"></a>
|
||
|
<p>When preprocessing files residing in directory <samp><var>old</var></samp>,
|
||
|
expand the <code>__FILE__</code> and <code>__BASE_FILE__</code> macros as if the
|
||
|
files resided in directory <samp><var>new</var></samp> instead. This can be used
|
||
|
to change an absolute path to a relative path by using <samp>.</samp> for
|
||
|
<var>new</var> which can result in more reproducible builds that are
|
||
|
location independent. This option also affects
|
||
|
<code>__builtin_FILE()</code> during compilation. See also
|
||
|
<samp>-ffile-prefix-map</samp>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fexec-charset=<var>charset</var></code></dt>
|
||
|
<dd><a name="index-fexec_002dcharset"></a>
|
||
|
<a name="index-character-set_002c-execution"></a>
|
||
|
<p>Set the execution character set, used for string and character
|
||
|
constants. The default is UTF-8. <var>charset</var> can be any encoding
|
||
|
supported by the system’s <code>iconv</code> library routine.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fwide-exec-charset=<var>charset</var></code></dt>
|
||
|
<dd><a name="index-fwide_002dexec_002dcharset"></a>
|
||
|
<a name="index-character-set_002c-wide-execution"></a>
|
||
|
<p>Set the wide execution character set, used for wide string and
|
||
|
character constants. The default is UTF-32 or UTF-16, whichever
|
||
|
corresponds to the width of <code>wchar_t</code>. As with
|
||
|
<samp>-fexec-charset</samp>, <var>charset</var> can be any encoding supported
|
||
|
by the system’s <code>iconv</code> library routine; however, you will have
|
||
|
problems with encodings that do not fit exactly in <code>wchar_t</code>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-finput-charset=<var>charset</var></code></dt>
|
||
|
<dd><a name="index-finput_002dcharset"></a>
|
||
|
<a name="index-character-set_002c-input"></a>
|
||
|
<p>Set the input character set, used for translation from the character
|
||
|
set of the input file to the source character set used by GCC. If the
|
||
|
locale does not specify, or GCC cannot get this information from the
|
||
|
locale, the default is UTF-8. This can be overridden by either the locale
|
||
|
or this command-line option. Currently the command-line option takes
|
||
|
precedence if there’s a conflict. <var>charset</var> can be any encoding
|
||
|
supported by the system’s <code>iconv</code> library routine.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fpch-deps</code></dt>
|
||
|
<dd><a name="index-fpch_002ddeps"></a>
|
||
|
<p>When using precompiled headers (see <a href="Precompiled-Headers.html#Precompiled-Headers">Precompiled Headers</a>), this flag
|
||
|
causes the dependency-output flags to also list the files from the
|
||
|
precompiled header’s dependencies. If not specified, only the
|
||
|
precompiled header are listed and not the files that were used to
|
||
|
create it, because those files are not consulted when a precompiled
|
||
|
header is used.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fpch-preprocess</code></dt>
|
||
|
<dd><a name="index-fpch_002dpreprocess"></a>
|
||
|
<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>,
|
||
|
<code>#pragma GCC pch_preprocess "<var>filename</var>"</code> in the output to mark
|
||
|
the place where the precompiled header was found, and its <var>filename</var>.
|
||
|
When <samp>-fpreprocessed</samp> is in use, GCC recognizes this <code>#pragma</code>
|
||
|
and loads the PCH.
|
||
|
</p>
|
||
|
<p>This option is off by default, because the resulting preprocessed output
|
||
|
is only really suitable as input to GCC. It is switched on by
|
||
|
<samp>-save-temps</samp>.
|
||
|
</p>
|
||
|
<p>You should not write this <code>#pragma</code> in your own code, but it is
|
||
|
safe to edit the filename if the PCH file is available in a different
|
||
|
location. The filename may be absolute or it may be relative to GCC’s
|
||
|
current directory.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-fworking-directory</code></dt>
|
||
|
<dd><a name="index-fworking_002ddirectory"></a>
|
||
|
<a name="index-fno_002dworking_002ddirectory"></a>
|
||
|
<p>Enable generation of linemarkers in the preprocessor output that
|
||
|
let the compiler know the current working directory at the time of
|
||
|
preprocessing. When this option is enabled, the preprocessor
|
||
|
emits, after the initial linemarker, a second linemarker with the
|
||
|
current working directory followed by two slashes. GCC uses this
|
||
|
directory, when it’s present in the preprocessed input, as the
|
||
|
directory emitted as the current working directory in some debugging
|
||
|
information formats. This option is implicitly enabled if debugging
|
||
|
information is enabled, but this can be inhibited with the negated
|
||
|
form <samp>-fno-working-directory</samp>. If the <samp>-P</samp> flag is
|
||
|
present in the command line, this option has no effect, since no
|
||
|
<code>#line</code> directives are emitted whatsoever.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-A <var>predicate</var>=<var>answer</var></code></dt>
|
||
|
<dd><a name="index-A"></a>
|
||
|
<p>Make an assertion with the predicate <var>predicate</var> and answer
|
||
|
<var>answer</var>. This form is preferred to the older form <samp>-A
|
||
|
<var>predicate</var>(<var>answer</var>)</samp>, which is still supported, because
|
||
|
it does not use shell special characters.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-A -<var>predicate</var>=<var>answer</var></code></dt>
|
||
|
<dd><p>Cancel an assertion with the predicate <var>predicate</var> and answer
|
||
|
<var>answer</var>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-C</code></dt>
|
||
|
<dd><a name="index-C"></a>
|
||
|
<p>Do not discard comments. All comments are passed through to the output
|
||
|
file, except for comments in processed directives, which are deleted
|
||
|
along with the directive.
|
||
|
</p>
|
||
|
<p>You should be prepared for side effects when using <samp>-C</samp>; it
|
||
|
causes the preprocessor to treat comments as tokens in their own right.
|
||
|
For example, comments appearing at the start of what would be a
|
||
|
directive line have the effect of turning that line into an ordinary
|
||
|
source line, since the first token on the line is no longer a ‘<samp>#</samp>’.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-CC</code></dt>
|
||
|
<dd><a name="index-CC"></a>
|
||
|
<p>Do not discard comments, including during macro expansion. This is
|
||
|
like <samp>-C</samp>, except that comments contained within macros are
|
||
|
also passed through to the output file where the macro is expanded.
|
||
|
</p>
|
||
|
<p>In addition to the side effects of the <samp>-C</samp> option, the
|
||
|
<samp>-CC</samp> option causes all C++-style comments inside a macro
|
||
|
to be converted to C-style comments. This is to prevent later use
|
||
|
of that macro from inadvertently commenting out the remainder of
|
||
|
the source line.
|
||
|
</p>
|
||
|
<p>The <samp>-CC</samp> option is generally used to support lint comments.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-P</code></dt>
|
||
|
<dd><a name="index-P"></a>
|
||
|
<p>Inhibit generation of linemarkers in the output from the preprocessor.
|
||
|
This might be useful when running the preprocessor on something that is
|
||
|
not C code, and will be sent to a program which might be confused by the
|
||
|
linemarkers.
|
||
|
</p>
|
||
|
<a name="index-traditional-C-language"></a>
|
||
|
<a name="index-C-language_002c-traditional"></a>
|
||
|
</dd>
|
||
|
<dt><code>-traditional</code></dt>
|
||
|
<dt><code>-traditional-cpp</code></dt>
|
||
|
<dd><a name="index-traditional_002dcpp"></a>
|
||
|
<a name="index-traditional"></a>
|
||
|
|
||
|
<p>Try to imitate the behavior of pre-standard C preprocessors, as
|
||
|
opposed to ISO C preprocessors.
|
||
|
See the GNU CPP manual for details.
|
||
|
</p>
|
||
|
<p>Note that GCC does not otherwise attempt to emulate a pre-standard
|
||
|
C compiler, and these options are only supported with the <samp>-E</samp>
|
||
|
switch, or when invoking CPP explicitly.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-trigraphs</code></dt>
|
||
|
<dd><a name="index-trigraphs"></a>
|
||
|
<p>Support ISO C trigraphs.
|
||
|
These are three-character sequences, all starting with ‘<samp>??</samp>’, that
|
||
|
are defined by ISO C to stand for single characters. For example,
|
||
|
‘<samp>??/</samp>’ stands for ‘<samp>\</samp>’, so ‘<samp>'??/n'</samp>’ is a character
|
||
|
constant for a newline.
|
||
|
</p>
|
||
|
<p>The nine trigraphs and their replacements are
|
||
|
</p>
|
||
|
<div class="smallexample">
|
||
|
<pre class="smallexample">Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
|
||
|
Replacement: [ ] { } # \ ^ | ~
|
||
|
</pre></div>
|
||
|
|
||
|
<p>By default, GCC ignores trigraphs, but in
|
||
|
standard-conforming modes it converts them. See the <samp>-std</samp> and
|
||
|
<samp>-ansi</samp> options.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-remap</code></dt>
|
||
|
<dd><a name="index-remap"></a>
|
||
|
<p>Enable special code to work around file systems which only permit very
|
||
|
short file names, such as MS-DOS.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-H</code></dt>
|
||
|
<dd><a name="index-H"></a>
|
||
|
<p>Print the name of each header file used, in addition to other normal
|
||
|
activities. Each name is indented to show how deep in the
|
||
|
‘<samp>#include</samp>’ stack it is. Precompiled header files are also
|
||
|
printed, even if they are found to be invalid; an invalid precompiled
|
||
|
header file is printed with ‘<samp>...x</samp>’ and a valid one with ‘<samp>...!</samp>’ .
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-d<var>letters</var></code></dt>
|
||
|
<dd><a name="index-d"></a>
|
||
|
<p>Says to make debugging dumps during compilation as specified by
|
||
|
<var>letters</var>. The flags documented here are those relevant to the
|
||
|
preprocessor. Other <var>letters</var> are interpreted
|
||
|
by the compiler proper, or reserved for future versions of GCC, and so
|
||
|
are silently ignored. If you specify <var>letters</var> whose behavior
|
||
|
conflicts, the result is undefined.
|
||
|
See <a href="Developer-Options.html#Developer-Options">Developer Options</a>, for more information.
|
||
|
</p>
|
||
|
<dl compact="compact">
|
||
|
<dt><code>-dM</code></dt>
|
||
|
<dd><a name="index-dM"></a>
|
||
|
<p>Instead of the normal output, generate a list of ‘<samp>#define</samp>’
|
||
|
directives for all the macros defined during the execution of the
|
||
|
preprocessor, including predefined macros. This gives you a way of
|
||
|
finding out what is predefined in your version of the preprocessor.
|
||
|
Assuming you have no file <samp>foo.h</samp>, the command
|
||
|
</p>
|
||
|
<div class="smallexample">
|
||
|
<pre class="smallexample">touch foo.h; cpp -dM foo.h
|
||
|
</pre></div>
|
||
|
|
||
|
<p>shows all the predefined macros.
|
||
|
</p>
|
||
|
<p>If you use <samp>-dM</samp> without the <samp>-E</samp> option, <samp>-dM</samp> is
|
||
|
interpreted as a synonym for <samp>-fdump-rtl-mach</samp>.
|
||
|
See <a href="http://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html#Developer-Options">(gcc)Developer Options</a>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-dD</code></dt>
|
||
|
<dd><a name="index-dD"></a>
|
||
|
<p>Like <samp>-dM</samp> except in two respects: it does <em>not</em> include the
|
||
|
predefined macros, and it outputs <em>both</em> the ‘<samp>#define</samp>’
|
||
|
directives and the result of preprocessing. Both kinds of output go to
|
||
|
the standard output file.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-dN</code></dt>
|
||
|
<dd><a name="index-dN"></a>
|
||
|
<p>Like <samp>-dD</samp>, but emit only the macro names, not their expansions.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-dI</code></dt>
|
||
|
<dd><a name="index-dI"></a>
|
||
|
<p>Output ‘<samp>#include</samp>’ directives in addition to the result of
|
||
|
preprocessing.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-dU</code></dt>
|
||
|
<dd><a name="index-dU"></a>
|
||
|
<p>Like <samp>-dD</samp> except that only macros that are expanded, or whose
|
||
|
definedness is tested in preprocessor directives, are output; the
|
||
|
output is delayed until the use or test of the macro; and
|
||
|
‘<samp>#undef</samp>’ directives are also output for macros tested but
|
||
|
undefined at the time.
|
||
|
</p></dd>
|
||
|
</dl>
|
||
|
|
||
|
</dd>
|
||
|
<dt><code>-fdebug-cpp</code></dt>
|
||
|
<dd><a name="index-fdebug_002dcpp"></a>
|
||
|
<p>This option is only useful for debugging GCC. When used from CPP or with
|
||
|
<samp>-E</samp>, it dumps debugging information about location maps. Every
|
||
|
token in the output is preceded by the dump of the map its location
|
||
|
belongs to.
|
||
|
</p>
|
||
|
<p>When used from GCC without <samp>-E</samp>, this option has no effect.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-Wp,<var>option</var></code></dt>
|
||
|
<dd><a name="index-Wp"></a>
|
||
|
<p>You can use <samp>-Wp,<var>option</var></samp> to bypass the compiler driver
|
||
|
and pass <var>option</var> directly through to the preprocessor. If
|
||
|
<var>option</var> contains commas, it is split into multiple options at the
|
||
|
commas. However, many options are modified, translated or interpreted
|
||
|
by the compiler driver before being passed to the preprocessor, and
|
||
|
<samp>-Wp</samp> forcibly bypasses this phase. The preprocessor’s direct
|
||
|
interface is undocumented and subject to change, so whenever possible
|
||
|
you should avoid using <samp>-Wp</samp> and let the driver handle the
|
||
|
options instead.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-Xpreprocessor <var>option</var></code></dt>
|
||
|
<dd><a name="index-Xpreprocessor"></a>
|
||
|
<p>Pass <var>option</var> as an option to the preprocessor. You can use this to
|
||
|
supply system-specific preprocessor options that GCC does not
|
||
|
recognize.
|
||
|
</p>
|
||
|
<p>If you want to pass an option that takes an argument, you must use
|
||
|
<samp>-Xpreprocessor</samp> twice, once for the option and once for the argument.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-no-integrated-cpp</code></dt>
|
||
|
<dd><a name="index-no_002dintegrated_002dcpp"></a>
|
||
|
<p>Perform preprocessing as a separate pass before compilation.
|
||
|
By default, GCC performs preprocessing as an integrated part of
|
||
|
input tokenization and parsing.
|
||
|
If this option is provided, the appropriate language front end
|
||
|
(<code>cc1</code>, <code>cc1plus</code>, or <code>cc1obj</code> for C, C++,
|
||
|
and Objective-C, respectively) is instead invoked twice,
|
||
|
once for preprocessing only and once for actual compilation
|
||
|
of the preprocessed input.
|
||
|
This option may be useful in conjunction with the <samp>-B</samp> or
|
||
|
<samp>-wrapper</samp> options to specify an alternate preprocessor or
|
||
|
perform additional processing of the program source between
|
||
|
normal preprocessing and compilation.
|
||
|
</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
<hr>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
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> [<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>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|