toolchain/gcc-linaro-6.3.1-2017.02-x8.../share/doc/gccint/Option-properties.html

446 lines
21 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2016 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 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU Compiler Collection (GCC) Internals: Option properties</title>
<meta name="description" content="GNU Compiler Collection (GCC) Internals: Option properties">
<meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Option properties">
<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="Options.html#Options" rel="up" title="Options">
<link href="Passes.html#Passes" rel="next" title="Passes">
<link href="Option-file-format.html#Option-file-format" rel="prev" title="Option file format">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
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.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Option-properties"></a>
<div class="header">
<p>
Previous: <a href="Option-file-format.html#Option-file-format" accesskey="p" rel="prev">Option file format</a>, Up: <a href="Options.html#Options" accesskey="u" rel="up">Options</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Option-properties-1"></a>
<h3 class="section">8.2 Option properties</h3>
<p>The second field of an option record can specify any of the following
properties. When an option takes an argument, it is enclosed in parentheses
following the option property name. The parser that handles option files
is quite simplistic, and will be tricked by any nested parentheses within
the argument text itself; in this case, the entire option argument can
be wrapped in curly braces within the parentheses to demarcate it, e.g.:
</p>
<div class="smallexample">
<pre class="smallexample">Condition({defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)})
</pre></div>
<dl compact="compact">
<dt><code>Common</code></dt>
<dd><p>The option is available for all languages and targets.
</p>
</dd>
<dt><code>Target</code></dt>
<dd><p>The option is available for all languages but is target-specific.
</p>
</dd>
<dt><code>Driver</code></dt>
<dd><p>The option is handled by the compiler driver using code not shared
with the compilers proper (<samp>cc1</samp> etc.).
</p>
</dd>
<dt><code><var>language</var></code></dt>
<dd><p>The option is available when compiling for the given language.
</p>
<p>It is possible to specify several different languages for the same
option. Each <var>language</var> must have been declared by an earlier
<code>Language</code> record. See <a href="Option-file-format.html#Option-file-format">Option file format</a>.
</p>
</dd>
<dt><code>RejectDriver</code></dt>
<dd><p>The option is only handled by the compilers proper (<samp>cc1</samp> etc.)
and should not be accepted by the driver.
</p>
</dd>
<dt><code>RejectNegative</code></dt>
<dd><p>The option does not have a &ldquo;no-&rdquo; form. All options beginning with
&ldquo;f&rdquo;, &ldquo;W&rdquo; or &ldquo;m&rdquo; are assumed to have a &ldquo;no-&rdquo; form unless this
property is used.
</p>
</dd>
<dt><code>Negative(<var>othername</var>)</code></dt>
<dd><p>The option will turn off another option <var>othername</var>, which is
the option name with the leading &ldquo;-&rdquo; removed. This chain action will
propagate through the <code>Negative</code> property of the option to be
turned off.
</p>
<p>As a consequence, if you have a group of mutually-exclusive
options, their <code>Negative</code> properties should form a circular chain.
For example, if options <samp>-<var>a</var></samp>, <samp>-<var>b</var></samp> and
<samp>-<var>c</var></samp> are mutually exclusive, their respective <code>Negative</code>
properties should be &lsquo;<samp>Negative(<var>b</var>)</samp>&rsquo;, &lsquo;<samp>Negative(<var>c</var>)</samp>&rsquo;
and &lsquo;<samp>Negative(<var>a</var>)</samp>&rsquo;.
</p>
</dd>
<dt><code>Joined</code></dt>
<dt><code>Separate</code></dt>
<dd><p>The option takes a mandatory argument. <code>Joined</code> indicates
that the option and argument can be included in the same <code>argv</code>
entry (as with <code>-mflush-func=<var>name</var></code>, for example).
<code>Separate</code> indicates that the option and argument can be
separate <code>argv</code> entries (as with <code>-o</code>). An option is
allowed to have both of these properties.
</p>
</dd>
<dt><code>JoinedOrMissing</code></dt>
<dd><p>The option takes an optional argument. If the argument is given,
it will be part of the same <code>argv</code> entry as the option itself.
</p>
<p>This property cannot be used alongside <code>Joined</code> or <code>Separate</code>.
</p>
</dd>
<dt><code>MissingArgError(<var>message</var>)</code></dt>
<dd><p>For an option marked <code>Joined</code> or <code>Separate</code>, the message
<var>message</var> will be used as an error message if the mandatory
argument is missing; for options without <code>MissingArgError</code>, a
generic error message is used. <var>message</var> should contain a single
&lsquo;<samp>%qs</samp>&rsquo; format, which will be used to format the name of the option
passed.
</p>
</dd>
<dt><code>Args(<var>n</var>)</code></dt>
<dd><p>For an option marked <code>Separate</code>, indicate that it takes <var>n</var>
arguments. The default is 1.
</p>
</dd>
<dt><code>UInteger</code></dt>
<dd><p>The option&rsquo;s argument is a non-negative integer. The option parser
will check and convert the argument before passing it to the relevant
option handler. <code>UInteger</code> should also be used on options like
<code>-falign-loops</code> where both <code>-falign-loops</code> and
<code>-falign-loops</code>=<var>n</var> are supported to make sure the saved
options are given a full integer.
</p>
</dd>
<dt><code>ToLower</code></dt>
<dd><p>The option&rsquo;s argument should be converted to lowercase as part of
putting it in canonical form, and before comparing with the strings
indicated by any <code>Enum</code> property.
</p>
</dd>
<dt><code>NoDriverArg</code></dt>
<dd><p>For an option marked <code>Separate</code>, the option only takes an
argument in the compiler proper, not in the driver. This is for
compatibility with existing options that are used both directly and
via <samp>-Wp,</samp>; new options should not have this property.
</p>
</dd>
<dt><code>Var(<var>var</var>)</code></dt>
<dd><p>The state of this option should be stored in variable <var>var</var>
(actually a macro for <code>global_options.x_<var>var</var></code>).
The way that the state is stored depends on the type of option:
</p>
<ul>
<li> If the option uses the <code>Mask</code> or <code>InverseMask</code> properties,
<var>var</var> is the integer variable that contains the mask.
</li><li> If the option is a normal on/off switch, <var>var</var> is an integer
variable that is nonzero when the option is enabled. The options
parser will set the variable to 1 when the positive form of the
option is used and 0 when the &ldquo;no-&rdquo; form is used.
</li><li> If the option takes an argument and has the <code>UInteger</code> property,
<var>var</var> is an integer variable that stores the value of the argument.
</li><li> If the option takes an argument and has the <code>Enum</code> property,
<var>var</var> is a variable (type given in the <code>Type</code> property of the
&lsquo;<samp>Enum</samp>&rsquo; record whose <code>Name</code> property has the same argument as
the <code>Enum</code> property of this option) that stores the value of the
argument.
</li><li> If the option has the <code>Defer</code> property, <var>var</var> is a pointer to
a <code>VEC(cl_deferred_option,heap)</code> that stores the option for later
processing. (<var>var</var> is declared with type <code>void *</code> and needs
to be cast to <code>VEC(cl_deferred_option,heap)</code> before use.)
</li><li> Otherwise, if the option takes an argument, <var>var</var> is a pointer to
the argument string. The pointer will be null if the argument is optional
and wasn&rsquo;t given.
</li></ul>
<p>The option-processing script will usually zero-initialize <var>var</var>.
You can modify this behavior using <code>Init</code>.
</p>
</dd>
<dt><code>Var(<var>var</var>, <var>set</var>)</code></dt>
<dd><p>The option controls an integer variable <var>var</var> and is active when
<var>var</var> equals <var>set</var>. The option parser will set <var>var</var> to
<var>set</var> when the positive form of the option is used and <code>!<var>set</var></code>
when the &ldquo;no-&rdquo; form is used.
</p>
<p><var>var</var> is declared in the same way as for the single-argument form
described above.
</p>
</dd>
<dt><code>Init(<var>value</var>)</code></dt>
<dd><p>The variable specified by the <code>Var</code> property should be statically
initialized to <var>value</var>. If more than one option using the same
variable specifies <code>Init</code>, all must specify the same initializer.
</p>
</dd>
<dt><code>Mask(<var>name</var>)</code></dt>
<dd><p>The option is associated with a bit in the <code>target_flags</code>
variable (see <a href="Run_002dtime-Target.html#Run_002dtime-Target">Run-time Target</a>) and is active when that bit is set.
You may also specify <code>Var</code> to select a variable other than
<code>target_flags</code>.
</p>
<p>The options-processing script will automatically allocate a unique bit
for the option. If the option is attached to &lsquo;<samp>target_flags</samp>&rsquo;,
the script will set the macro <code>MASK_<var>name</var></code> to the appropriate
bitmask. It will also declare a <code>TARGET_<var>name</var></code> macro that has
the value 1 when the option is active and 0 otherwise. If you use <code>Var</code>
to attach the option to a different variable, the bitmask macro with be
called <code>OPTION_MASK_<var>name</var></code>.
</p>
</dd>
<dt><code>InverseMask(<var>othername</var>)</code></dt>
<dt><code>InverseMask(<var>othername</var>, <var>thisname</var>)</code></dt>
<dd><p>The option is the inverse of another option that has the
<code>Mask(<var>othername</var>)</code> property. If <var>thisname</var> is given,
the options-processing script will declare a <code>TARGET_<var>thisname</var></code>
macro that is 1 when the option is active and 0 otherwise.
</p>
</dd>
<dt><code>Enum(<var>name</var>)</code></dt>
<dd><p>The option&rsquo;s argument is a string from the set of strings associated
with the corresponding &lsquo;<samp>Enum</samp>&rsquo; record. The string is checked and
converted to the integer specified in the corresponding
&lsquo;<samp>EnumValue</samp>&rsquo; record before being passed to option handlers.
</p>
</dd>
<dt><code>Defer</code></dt>
<dd><p>The option should be stored in a vector, specified with <code>Var</code>,
for later processing.
</p>
</dd>
<dt><code>Alias(<var>opt</var>)</code></dt>
<dt><code>Alias(<var>opt</var>, <var>arg</var>)</code></dt>
<dt><code>Alias(<var>opt</var>, <var>posarg</var>, <var>negarg</var>)</code></dt>
<dd><p>The option is an alias for <samp>-<var>opt</var></samp> (or the negative form
of that option, depending on <code>NegativeAlias</code>). In the first form,
any argument passed to the alias is considered to be passed to
<samp>-<var>opt</var></samp>, and <samp>-<var>opt</var></samp> is considered to be
negated if the alias is used in negated form. In the second form, the
alias may not be negated or have an argument, and <var>posarg</var> is
considered to be passed as an argument to <samp>-<var>opt</var></samp>. In the
third form, the alias may not have an argument, if the alias is used
in the positive form then <var>posarg</var> is considered to be passed to
<samp>-<var>opt</var></samp>, and if the alias is used in the negative form
then <var>negarg</var> is considered to be passed to <samp>-<var>opt</var></samp>.
</p>
<p>Aliases should not specify <code>Var</code> or <code>Mask</code> or
<code>UInteger</code>. Aliases should normally specify the same languages
as the target of the alias; the flags on the target will be used to
determine any diagnostic for use of an option for the wrong language,
while those on the alias will be used to identify what command-line
text is the option and what text is any argument to that option.
</p>
<p>When an <code>Alias</code> definition is used for an option, driver specs do
not need to handle it and no &lsquo;<samp>OPT_</samp>&rsquo; enumeration value is defined
for it; only the canonical form of the option will be seen in those
places.
</p>
</dd>
<dt><code>NegativeAlias</code></dt>
<dd><p>For an option marked with <code>Alias(<var>opt</var>)</code>, the option is
considered to be an alias for the positive form of <samp>-<var>opt</var></samp>
if negated and for the negative form of <samp>-<var>opt</var></samp> if not
negated. <code>NegativeAlias</code> may not be used with the forms of
<code>Alias</code> taking more than one argument.
</p>
</dd>
<dt><code>Ignore</code></dt>
<dd><p>This option is ignored apart from printing any warning specified using
<code>Warn</code>. The option will not be seen by specs and no &lsquo;<samp>OPT_</samp>&rsquo;
enumeration value is defined for it.
</p>
</dd>
<dt><code>SeparateAlias</code></dt>
<dd><p>For an option marked with <code>Joined</code>, <code>Separate</code> and
<code>Alias</code>, the option only acts as an alias when passed a separate
argument; with a joined argument it acts as a normal option, with an
&lsquo;<samp>OPT_</samp>&rsquo; enumeration value. This is for compatibility with the
Java <samp>-d</samp> option and should not be used for new options.
</p>
</dd>
<dt><code>Warn(<var>message</var>)</code></dt>
<dd><p>If this option is used, output the warning <var>message</var>.
<var>message</var> is a format string, either taking a single operand with
a &lsquo;<samp>%qs</samp>&rsquo; format which is the option name, or not taking any
operands, which is passed to the &lsquo;<samp>warning</samp>&rsquo; function. If an alias
is marked <code>Warn</code>, the target of the alias must not also be marked
<code>Warn</code>.
</p>
</dd>
<dt><code>Report</code></dt>
<dd><p>The state of the option should be printed by <samp>-fverbose-asm</samp>.
</p>
</dd>
<dt><code>Warning</code></dt>
<dd><p>This is a warning option and should be shown as such in
<samp>--help</samp> output. This flag does not currently affect anything
other than <samp>--help</samp>.
</p>
</dd>
<dt><code>Optimization</code></dt>
<dd><p>This is an optimization option. It should be shown as such in
<samp>--help</samp> output, and any associated variable named using
<code>Var</code> should be saved and restored when the optimization level is
changed with <code>optimize</code> attributes.
</p>
</dd>
<dt><code>Undocumented</code></dt>
<dd><p>The option is deliberately missing documentation and should not
be included in the <samp>--help</samp> output.
</p>
</dd>
<dt><code>Condition(<var>cond</var>)</code></dt>
<dd><p>The option should only be accepted if preprocessor condition
<var>cond</var> is true. Note that any C declarations associated with the
option will be present even if <var>cond</var> is false; <var>cond</var> simply
controls whether the option is accepted and whether it is printed in
the <samp>--help</samp> output.
</p>
</dd>
<dt><code>Save</code></dt>
<dd><p>Build the <code>cl_target_option</code> structure to hold a copy of the
option, add the functions <code>cl_target_option_save</code> and
<code>cl_target_option_restore</code> to save and restore the options.
</p>
</dd>
<dt><code>SetByCombined</code></dt>
<dd><p>The option may also be set by a combined option such as
<samp>-ffast-math</samp>. This causes the <code>gcc_options</code> struct to
have a field <code>frontend_set_<var>name</var></code>, where <code><var>name</var></code>
is the name of the field holding the value of this option (without the
leading <code>x_</code>). This gives the front end a way to indicate that
the value has been set explicitly and should not be changed by the
combined option. For example, some front ends use this to prevent
<samp>-ffast-math</samp> and <samp>-fno-fast-math</samp> from changing the
value of <samp>-fmath-errno</samp> for languages that do not use
<code>errno</code>.
</p>
</dd>
<dt><code>EnabledBy(<var>opt</var>)</code></dt>
<dt><code>EnabledBy(<var>opt</var> || <var>opt2</var>)</code></dt>
<dt><code>EnabledBy(<var>opt</var> &amp;&amp; <var>opt2</var>)</code></dt>
<dd><p>If not explicitly set, the option is set to the value of
<samp>-<var>opt</var></samp>; multiple options can be given, separated by
<code>||</code>. The third form using <code>&amp;&amp;</code> specifies that the option is
only set if both <var>opt</var> and <var>opt2</var> are set. The options <var>opt</var>
and <var>opt2</var> must have the <code>Common</code> property; otherwise, use
<code>LangEnabledBy</code>.
</p>
</dd>
<dt><code>LangEnabledBy(<var>language</var>, <var>opt</var>)</code></dt>
<dt><code>LangEnabledBy(<var>language</var>, <var>opt</var>, <var>posarg</var>, <var>negarg</var>)</code></dt>
<dd><p>When compiling for the given language, the option is set to the value
of <samp>-<var>opt</var></samp>, if not explicitly set. <var>opt</var> can be also a list
of <code>||</code> separated options. In the second form, if
<var>opt</var> is used in the positive form then <var>posarg</var> is considered
to be passed to the option, and if <var>opt</var> is used in the negative
form then <var>negarg</var> is considered to be passed to the option. It
is possible to specify several different languages. Each
<var>language</var> must have been declared by an earlier <code>Language</code>
record. See <a href="Option-file-format.html#Option-file-format">Option file format</a>.
</p>
</dd>
<dt><code>NoDWARFRecord</code></dt>
<dd><p>The option is omitted from the producer string written by
<samp>-grecord-gcc-switches</samp>.
</p>
</dd>
<dt><code>PchIgnore</code></dt>
<dd><p>Even if this is a target option, this option will not be recorded / compared
to determine if a precompiled header file matches.
</p>
</dd>
<dt><code>CPP(<var>var</var>)</code></dt>
<dd><p>The state of this option should be kept in sync with the preprocessor
option <var>var</var>. If this property is set, then properties <code>Var</code>
and <code>Init</code> must be set as well.
</p>
</dd>
<dt><code>CppReason(<var>CPP_W_Enum</var>)</code></dt>
<dd><p>This warning option corresponds to <code>cpplib.h</code> warning reason code
<var>CPP_W_Enum</var>. This should only be used for warning options of the
C-family front-ends.
</p>
</dd>
</dl>
<hr>
<div class="header">
<p>
Previous: <a href="Option-file-format.html#Option-file-format" accesskey="p" rel="prev">Option file format</a>, Up: <a href="Options.html#Options" accesskey="u" rel="up">Options</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>