⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preprocessor-options.html

📁 gcc手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
whether an <code>-o</code> option is given.  If it is, the driver uses its

argument but with a suffix of <code>.d</code>, otherwise it take the

basename of the input file and applies a <code>.d</code> suffix.



     <p>If <code>-MD</code> is used in conjunction with <code>-E</code>, any

<code>-o</code> switch is understood to specify the dependency output file

(but see <a href="-MF.html#-MF">-MF</a>), but if used without <code>-E</code>, each <code>-o</code>

is understood to specify a target object file.



     <p>Since <code>-E</code> is not implied, <code>-MD</code> can be used to generate

a dependency output file as a side-effect of the compilation process.



     <br><dt><code>-MMD</code>

     <dd>Like <code>-MD</code> except mention only user header files, not system

-header files.



     <br><dt><code>-x c</code>

     <dd><dt><code>-x c++</code>

     <dd><dt><code>-x objective-c</code>

     <dd><dt><code>-x assembler-with-cpp</code>

     <dd>Specify the source language: C, C++, Objective-C, or assembly.  This has

nothing to do with standards conformance or extensions; it merely

selects which base syntax to expect.  If you give none of these options,

cpp will deduce the language from the extension of the source file:

<code>.c</code>, <code>.cc</code>, <code>.m</code>, or <code>.S</code>.  Some other common

extensions for C++ and assembly are also recognized.  If cpp does not

recognize the extension, it will treat the file as C; this is the most

generic mode.



     <p><strong>Note:</strong> Previous versions of cpp accepted a <code>-lang</code> option

which selected both the language and the standards conformance level. 

This option has been removed, because it conflicts with the <code>-l</code>

option.



     <br><dt><code>-std=</code><var>standard</var><code></code>

     <dd><dt><code>-ansi</code>

     <dd>Specify the standard to which the code should conform.  Currently CPP

knows about C and C++ standards; others may be added in the future.



     <p><var>standard</var>

may be one of:

          <dl>

<dt><code>iso9899:1990</code>

          <dd><dt><code>c89</code>

          <dd>The ISO C standard from 1990.  <code>c89</code> is the customary shorthand for

this version of the standard.



          <p>The <code>-ansi</code> option is equivalent to <code>-std=c89</code>.



          <br><dt><code>iso9899:199409</code>

          <dd>The 1990 C standard, as amended in 1994.



          <br><dt><code>iso9899:1999</code>

          <dd><dt><code>c99</code>

          <dd><dt><code>iso9899:199x</code>

          <dd><dt><code>c9x</code>

          <dd>The revised ISO C standard, published in December 1999.  Before

publication, this was known as C9X.



          <br><dt><code>gnu89</code>

          <dd>The 1990 C standard plus GNU extensions.  This is the default.



          <br><dt><code>gnu99</code>

          <dd><dt><code>gnu9x</code>

          <dd>The 1999 C standard plus GNU extensions.



          <br><dt><code>c++98</code>

          <dd>The 1998 ISO C++ standard plus amendments.



          <br><dt><code>gnu++98</code>

          <dd>The same as <code>-std=c++98</code> plus GNU extensions.  This is the

default for C++ code. 

</dl>



     <br><dt><code>-I-</code>

     <dd>Split the include path.  Any directories specified with <code>-I</code>

options before <code>-I-</code> are searched only for headers requested with

<code>#include&nbsp;"</code><var>file</var><code>"</code>; they are not searched for

<code>#include&nbsp;&lt;</code><var>file</var><code>&gt;</code>.  If additional directories are

specified with <code>-I</code> options after the <code>-I-</code>, those

directories are searched for all <code>#include</code> directives.



     <p>In addition, <code>-I-</code> inhibits the use of the directory of the current

file directory as the first search directory for <code>#include&nbsp;"</code><var>file</var><code>"</code>.



     <br><dt><code>-nostdinc</code>

     <dd>Do not search the standard system directories for header files. 

Only the directories you have specified with <code>-I</code> options

(and the directory of the current file, if appropriate) are searched.



     <br><dt><code>-nostdinc++</code>

     <dd>Do not search for header files in the C++-specific standard directories,

but do still search the other standard directories.  (This option is

used when building the C++ library.)



     <br><dt><code>-include </code><var>file</var><code></code>

     <dd>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>If multiple <code>-include</code> options are given, the files are included

in the order they appear on the command line.



     <br><dt><code>-imacros </code><var>file</var><code></code>

     <dd>Exactly like <code>-include</code>, 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>All files specified by <code>-imacros</code> are processed before all files

specified by <code>-include</code>.



     <br><dt><code>-idirafter </code><var>dir</var><code></code>

     <dd>Search <var>dir</var> for header files, but do it <em>after</em> all

directories specified with <code>-I</code> and the standard system directories

have been exhausted.  <var>dir</var> is treated as a system include directory.



     <br><dt><code>-iprefix </code><var>prefix</var><code></code>

     <dd>Specify <var>prefix</var> as the prefix for subsequent <code>-iwithprefix</code>

options.  If the prefix represents a directory, you should include the

final <code>/</code>.



     <br><dt><code>-iwithprefix </code><var>dir</var><code></code>

     <dd><dt><code>-iwithprefixbefore </code><var>dir</var><code></code>

     <dd>Append <var>dir</var> to the prefix specified previously with

<code>-iprefix</code>, and add the resulting directory to the include search

path.  <code>-iwithprefixbefore</code> puts it in the same place <code>-I</code>

would; <code>-iwithprefix</code> puts it where <code>-idirafter</code> would.



     <p>Use of these options is discouraged.



     <br><dt><code>-isystem </code><var>dir</var><code></code>

     <dd>Search <var>dir</var> for header files, after all directories specified by

<code>-I</code> but before the standard system directories.  Mark it

as a system directory, so that it gets the same special treatment as

is applied to the standard system directories.



     <br><dt><code>-fpreprocessed</code>

     <dd>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 <code>-C</code> to the compiler without

problems.  In this mode the integrated preprocessor is little more than

a tokenizer for the front ends.



     <p><code>-fpreprocessed</code> is implicit if the input file has one of the

extensions <code>.i</code>, <code>.ii</code> or <code>.mi</code>.  These are the

extensions that GCC uses for preprocessed files created by

<code>-save-temps</code>.



     <br><dt><code>-ftabstop=</code><var>width</var><code></code>

     <dd>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.



     <br><dt><code>-fno-show-column</code>

     <dd>Do not print column numbers in diagnostics.  This may be necessary if

diagnostics are being scanned by a program that does not understand the

column numbers, such as <code>dejagnu</code>.



     <br><dt><code>-A </code><var>predicate</var><code>=</code><var>answer</var><code></code>

     <dd>Make an assertion with the predicate <var>predicate</var> and answer

<var>answer</var>.  This form is preferred to the older form <code>-A

</code><var>predicate</var><code>(</code><var>answer</var><code>)</code>, which is still supported, because

it does not use shell special characters.



     <br><dt><code>-A -</code><var>predicate</var><code>=</code><var>answer</var><code></code>

     <dd>Cancel an assertion with the predicate <var>predicate</var> and answer

<var>answer</var>.



     <br><dt><code>-dCHARS</code>

     <dd><var>CHARS</var> is a sequence of one or more of the following characters,

and must not be preceded by a space.  Other characters are interpreted

by the compiler proper, or reserved for future versions of GCC, and so

are silently ignored.  If you specify characters whose behavior

conflicts, the result is undefined.



          <dl>

<dt><code>M</code>

          <dd>Instead of the normal output, generate a list of <code>#define</code>

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 <code>foo.h</code>, the command



          <pre class="example">               touch foo.h; cpp -dM foo.h

               </pre>



          <p>will show all the predefined macros.



          <br><dt><code>D</code>

          <dd>Like <code>M</code> except in two respects: it does <em>not</em> include the

predefined macros, and it outputs <em>both</em> the <code>#define</code>

directives and the result of preprocessing.  Both kinds of output go to

the standard output file.



          <br><dt><code>N</code>

          <dd>Like <code>D</code>, but emit only the macro names, not their expansions.



          <br><dt><code>I</code>

          <dd>Output <code>#include</code> directives in addition to the result of

preprocessing. 

</dl>



     <br><dt><code>-P</code>

     <dd>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.



     <br><dt><code>-C</code>

     <dd>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>You should be prepared for side effects when using <code>-C</code>; 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 <code>#</code>.



     <br><dt><code>-CC</code>

     <dd>Do not discard comments, including during macro expansion.  This is

like <code>-C</code>, except that comments contained within macros are

also passed through to the output file where the macro is expanded.



     <p>In addition to the side-effects of the <code>-C</code> option, the

<code>-CC</code> 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>The <code>-CC</code> option is generally used to support lint comments.



     <br><dt><code>-gcc</code>

     <dd>Define the macros <small>__GNUC__</small>, <small>__GNUC_MINOR__</small> and

<small>__GNUC_PATCHLEVEL__</small>.  These are defined automatically when you use

<code>gcc -E</code>; you can turn them off in that case with

<code>-no-gcc</code>.



     <br><dt><code>-traditional-cpp</code>

     <dd>Try to imitate the behavior of old-fashioned C preprocessors, as

opposed to ISO C preprocessors.



     <br><dt><code>-trigraphs</code>

     <dd>Process trigraph sequences. 

These are three-character sequences, all starting with <code>??</code>, that

are defined by ISO C to stand for single characters.  For example,

<code>??/</code> stands for <code>\</code>, so <code>'??/n'</code> is a character

constant for a newline.  By default, GCC ignores trigraphs, but in

standard-conforming modes it converts them.  See the <code>-std</code> and

<code>-ansi</code> options.



     <p>The nine trigraphs and their replacements are



     <pre class="smallexample">          Trigraph:       ??(  ??)  ??&lt;  ??&gt;  ??=  ??/  ??'  ??!  ??-

          Replacement:      [    ]    {    }    #    \    ^    |    ~

          </pre>



     <br><dt><code>-remap</code>

     <dd>Enable special code to work around file systems which only permit very

short file names, such as MS-DOS.



     <dt><code>--help</code>

     <dd><dt><code>--target-help</code>

     <dd>Print text describing all the command line options instead of

preprocessing anything.



     <br><dt><code>-v</code>

     <dd>Verbose mode.  Print out GNU CPP's version number at the beginning of

execution, and report the final form of the include path.



     <br><dt><code>-H</code>

     <dd>Print the name of each header file used, in addition to other normal

activities.  Each name is indented to show how deep in the

<code>#include</code> stack it is.



     <br><dt><code>-version</code>

     <dd><dt><code>--version</code>

     <dd>Print out GNU CPP's version number.  With one dash, proceed to

preprocess as normal.  With two dashes, exit immediately. 

</dl>



   </body></html>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -