|
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <!-- Copyright (C) 1988-2020 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.5, http://www.gnu.org/software/texinfo/ -->
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Option properties (GNU Compiler Collection (GCC) Internals)</title>
-
- <meta name="description" content="Option properties (GNU Compiler Collection (GCC) Internals)">
- <meta name="keywords" content="Option properties (GNU Compiler Collection (GCC) Internals)">
- <meta name="resource-type" content="document">
- <meta name="distribution" content="global">
- <meta name="Generator" content="makeinfo">
- <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.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="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> [<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 “no-” form. All options beginning with
- “f”, “W” or “m” are assumed to have a “no-” 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 “-” removed. This chain action will
- propagate through the <code>Negative</code> property of the option to be
- turned off. The driver will prune options, removing those that are
- turned off by some later option. This pruning is not done for options
- with <code>Joined</code> or <code>JoinedOrMissing</code> properties, unless the
- options have either <code>RejectNegative</code> property or the <code>Negative</code>
- property mentions an option other than itself.
- </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 ‘<samp>Negative(<var>b</var>)</samp>’, ‘<samp>Negative(<var>c</var>)</samp>’
- and ‘<samp>Negative(<var>a</var>)</samp>’.
- </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
- ‘<samp>%qs</samp>’ 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’s argument is a non-negative integer consisting of either
- decimal or hexadecimal digits interpreted as <code>int</code>. Hexadecimal
- integers may optionally start with the <code>0x</code> or <code>0X</code> prefix.
- The option parser validates and converts the argument before passing
- it to the relevant option handler. <code>UInteger</code> should also be used
- with 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. Positive values of the argument in
- excess of <code>INT_MAX</code> wrap around zero.
- </p>
- </dd>
- <dt><code>Host_Wide_Int</code></dt>
- <dd><p>The option’s argument is a non-negative integer consisting of either
- decimal or hexadecimal digits interpreted as the widest integer type
- on the host. As with an <code>UInteger</code> argument, hexadecimal integers
- may optionally start with the <code>0x</code> or <code>0X</code> prefix. The option
- parser validates and converts the argument before passing it to
- the relevant option handler. <code>Host_Wide_Int</code> should be used with
- options that need to accept very large values. Positive values of
- the argument in excess of <code>HOST_WIDE_INT_M1U</code> are assigned
- <code>HOST_WIDE_INT_M1U</code>.
- </p>
- </dd>
- <dt><code>IntegerRange(<var>n</var>, <var>m</var>)</code></dt>
- <dd><p>The options’s arguments are integers of type <code>int</code>. The option’s
- parser validates that the value of an option integer argument is within
- the closed range [<var>n</var>, <var>m</var>].
- </p>
- </dd>
- <dt><code>ByteSize</code></dt>
- <dd><p>A property applicable only to <code>UInteger</code> or <code>Host_Wide_Int</code>
- arguments. The option’s integer argument is interpreted as if in infinite
- precision using saturation arithmetic in the corresponding type. The argument
- may be followed by a ‘<samp>byte-size</samp>’ suffix designating a multiple of bytes
- such as <code>kB</code> and <code>KiB</code> for kilobyte and kibibyte, respectively,
- <code>MB</code> and <code>MiB</code> for megabyte and mebibyte, <code>GB</code> and <code>GiB</code>
- for gigabyte and gigibyte, and so on. <code>ByteSize</code> should be used for
- with options that take a very large argument representing a size in bytes,
- such as <samp>-Wlarger-than=</samp>.
- </p>
- </dd>
- <dt><code>ToLower</code></dt>
- <dd><p>The option’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>
- </dd>
- <dt><code>WarnRemoved</code></dt>
- <dd><p>The option is removed and every usage of such option will
- result in a warning. We use it option backward compatibility.
- </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 “no-” form is used.
- </p>
- <p><var>var</var> is declared in the same way as for the single-argument form
- described above.
- </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 “no-” 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
- ‘<samp>Enum</samp>’ 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’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>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 ‘<samp>target_flags</samp>’,
- 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’s argument is a string from the set of strings associated
- with the corresponding ‘<samp>Enum</samp>’ record. The string is checked and
- converted to the integer specified in the corresponding
- ‘<samp>EnumValue</samp>’ 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 ‘<samp>OPT_</samp>’ 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 ‘<samp>OPT_</samp>’
- 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
- ‘<samp>OPT_</samp>’ 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 ‘<samp>%qs</samp>’ format which is the option name, or not taking any
- operands, which is passed to the ‘<samp>warning</samp>’ 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>PerFunction</code></dt>
- <dd><p>This is an option that can be overridden on a per-function basis.
- <code>Optimization</code> implies <code>PerFunction</code>, but options that do not
- affect executable code generation may use this flag instead, so that the
- option is not taken into account in ways that might affect executable
- code generation.
- </p>
- </dd>
- <dt><code>Param</code></dt>
- <dd><p>This is an option that is a parameter.
- </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> && <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>&&</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> [<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>
|