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

📄 preprocessor-options.html

📁 自己收集的linux入门到学懂高级编程书集 包括linux程序设计第三版
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html lang="en"><head><title>Using the GNU Compiler Collection (GCC)</title><meta http-equiv="Content-Type" content="text/html"><meta name="description" content="Using the GNU Compiler Collection (GCC)"><meta name="generator" content="makeinfo 4.6"><!--Copyright &copy; 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.   <p>Permission is granted to copy, distribute and/or modify this documentunder the terms of the GNU Free Documentation License, Version 1.2 orany later version published by the Free Software Foundation; with theInvariant Sections being "GNU General Public License" and "FundingFree Software", the Front-Cover texts being (a) (see below), and withthe Back-Cover Texts being (b) (see below).  A copy of the license isincluded in the section entitled "GNU Free Documentation License".   <p>(a) The FSF's Front-Cover Text is:   <p>A GNU Manual   <p>(b) The FSF's Back-Cover Text is:   <p>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.--><meta http-equiv="Content-Style-Type" content="text/css"><style type="text/css"><!--  pre.display { font-family:inherit }  pre.format  { font-family:inherit }  pre.smalldisplay { font-family:inherit; font-size:smaller }  pre.smallformat  { font-family:inherit; font-size:smaller }  pre.smallexample { font-size:smaller }  pre.smalllisp    { font-size:smaller }--></style></head><body><div class="node"><p>Node:&nbsp;<a name="Preprocessor%20Options">Preprocessor Options</a>,Next:&nbsp;<a rel="next" accesskey="n" href="Assembler-Options.html#Assembler%20Options">Assembler Options</a>,Previous:&nbsp;<a rel="previous" accesskey="p" href="Optimize-Options.html#Optimize%20Options">Optimize Options</a>,Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking%20GCC">Invoking GCC</a><hr><br></div><h3 class="section">Options Controlling the Preprocessor</h3><p>These options control the C preprocessor, which is run on each C sourcefile before actual compilation.   <p>If you use the <code>-E</code> option, nothing is done except preprocessing. Some of these options make sense only together with <code>-E</code> becausethey cause the preprocessor output to be unsuitable for actualcompilation.     <dl>You can use <code>-Wp,</code><var>option</var><code></code> to bypass the compiler driverand pass <var>option</var> directly through to the preprocessor.  If<var>option</var> contains commas, it is split into multiple options at thecommas.  However, many options are modified, translated or interpretedby the compiler driver before being passed to the preprocessor, and<code>-Wp</code> forcibly bypasses this phase.  The preprocessor's directinterface is undocumented and subject to change, so whenever possibleyou should avoid using <code>-Wp</code> and let the driver handle theoptions instead.     <br><dt><code>-Xpreprocessor </code><var>option</var><code></code>     <dd>Pass <var>option</var> as an option to the preprocessor.  You can use this tosupply system-specific preprocessor options which GCC does not know how torecognize.     <p>If you want to pass an option that takes an argument, you must use<code>-Xpreprocessor</code> twice, once for the option and once for the argument. </dl>     <dl><dt><code>-D </code><var>name</var><code></code>     <dd>Predefine <var>name</var> as a macro, with definition <code>1</code>.     <br><dt><code>-D </code><var>name</var><code>=</code><var>definition</var><code></code>     <dd>Predefine <var>name</var> as a macro, with definition <var>definition</var>. There are no restrictions on the contents of <var>definition</var>, but ifyou are invoking the preprocessor from a shell or shell-like program youmay need to use the shell's quoting syntax to protect characters such asspaces that have a meaning in the shell syntax.     <p>If you wish to define a function-like macro on the command line, writeits argument list with surrounding parentheses before the equals sign(if any).  Parentheses are meaningful to most shells, so you will needto quote the option.  With <code>sh</code> and <code>csh</code>,<code>-D'</code><var>name</var><code>(</code><var>args<small class="dots">...</small></var><code>)=</code><var>definition</var><code>'</code> works.     <p><code>-D</code> and <code>-U</code> options are processed in the order theyare given on the command line.  All <code>-imacros </code><var>file</var><code></code> and<code>-include </code><var>file</var><code></code> options are processed after all<code>-D</code> and <code>-U</code> options.     <br><dt><code>-U </code><var>name</var><code></code>     <dd>Cancel any previous definition of <var>name</var>, either built in orprovided with a <code>-D</code> option.     <br><dt><code>-undef</code>     <dd>Do not predefine any system-specific or GCC-specific macros.  Thestandard predefined macros remain defined.     <br><dt><code>-I </code><var>dir</var><code></code>     <dd>Add the directory <var>dir</var> to the list of directories to be searchedfor header files. Directories named by <code>-I</code> are searched before the standardsystem include directories.  If the directory <var>dir</var> is a standardsystem include directory, the option is ignored to ensure that thedefault search order for system directories and the special treatmentof system headers are not defeated.     <br><dt><code>-o </code><var>file</var><code></code>     <dd>Write output to <var>file</var>.  This is the same as specifying <var>file</var>as the second non-option argument to <code>cpp</code>.  <code>gcc</code> has adifferent interpretation of a second non-option argument, so you mustuse <code>-o</code> to specify the output file.     <br><dt><code>-Wall</code>     <dd>Turns on all optional warnings which are desirable for normal code. At present this is <code>-Wcomment</code>, <code>-Wtrigraphs</code>,<code>-Wmultichar</code> and a warning about integer promotion causing achange of sign in <code>#if</code> expressions.  Note that many of thepreprocessor's warnings are on by default and have no options tocontrol them.     <br><dt><code>-Wcomment</code>     <dd><dt><code>-Wcomments</code>     <dd>Warn whenever a comment-start sequence <code>/*</code> appears in a <code>/*</code>comment, or whenever a backslash-newline appears in a <code>//</code> comment. (Both forms have the same effect.)     <br><dt><code>-Wtrigraphs</code>     <dd><a name="Wtrigraphs"></a>Most trigraphs in comments cannot affect the meaning of the program. However, a trigraph that would form an escaped newline (<code>??/</code> atthe end of a line) can, by changing where the comment begins or ends. Therefore, only trigraphs that would form escaped newlines producewarnings inside a comment.     <p>This option is implied by <code>-Wall</code>.  If <code>-Wall</code> is notgiven, this option is still enabled unless trigraphs are enabled.  Toget trigraph conversion without warnings, but get the other<code>-Wall</code> warnings, use <code>-trigraphs -Wall -Wno-trigraphs</code>.     <br><dt><code>-Wtraditional</code>     <dd>Warn about certain constructs that behave differently in traditional andISO C.  Also warn about ISO C constructs that have no traditional Cequivalent, and problematic constructs which should be avoided.     <br><dt><code>-Wimport</code>     <dd>Warn the first time <code>#import</code> is used.     <br><dt><code>-Wundef</code>     <dd>Warn whenever an identifier which is not a macro is encountered in an<code>#if</code> directive, outside of <code>defined</code>.  Such identifiers arereplaced with zero.     <br><dt><code>-Wunused-macros</code>     <dd>Warn about macros defined in the main file that are unused.  A macrois <dfn>used</dfn> if it is expanded or tested for existence at least once. The preprocessor will also warn if the macro has not been used at thetime it is redefined or undefined.     <p>Built-in macros, macros defined on the command line, and macrosdefined in include files are not warned about.     <p><strong>Note:</strong> If a macro is actually used, but only used in skippedconditional blocks, then CPP will report it as unused.  To avoid thewarning in such a case, you might improve the scope of the macro'sdefinition by, for example, moving it into the first skipped block. Alternatively, you could provide a dummy use with something like:     <pre class="smallexample">          #if defined the_macro_causing_the_warning          #endif          </pre>     <br><dt><code>-Wendif-labels</code>     <dd>Warn whenever an <code>#else</code> or an <code>#endif</code> are followed by text. This usually happens in code of the form     <pre class="smallexample">          #if FOO          ...          #else FOO          ...          #endif FOO          </pre>     <p>The second and third <code>FOO</code> should be in comments, but often are notin older programs.  This warning is on by default.     <br><dt><code>-Werror</code>     <dd>Make all warnings into hard errors.  Source code which triggers warningswill be rejected.     <br><dt><code>-Wsystem-headers</code>     <dd>Issue warnings for code in system headers.  These are normally unhelpfulin finding bugs in your own code, therefore suppressed.  If you areresponsible for the system library, you may want to see them.     <br><dt><code>-w</code>     <dd>Suppress all warnings, including those which GNU CPP issues by default.     <br><dt><code>-pedantic</code>     <dd>Issue all the mandatory diagnostics listed in the C standard.  Some ofthem are left out by default, since they trigger frequently on harmlesscode.     <br><dt><code>-pedantic-errors</code>     <dd>Issue all the mandatory diagnostics, and make all mandatory diagnosticsinto errors.  This includes mandatory diagnostics that GCC issueswithout <code>-pedantic</code> but treats as warnings.

⌨️ 快捷键说明

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