summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/function-specific-option-pragmas.html
blob: 7cf35405e01f7ca6f130a6b8a35dcf1cc9ff3dd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div class="subsection-level-extent" id="Function-Specific-Option-Pragmas"> <div class="nav-panel"> <p> Next: <a href="loop-specific-pragmas" accesskey="n" rel="next">Loop-Specific Pragmas</a>, Previous: <a href="push_002fpop-macro-pragmas" accesskey="p" rel="prev">Push/Pop Macro Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div>  <h1 class="subsection" id="Function-Specific-Option-Pragmas-1"><span>6.62.15 Function Specific Option Pragmas<a class="copiable-link" href="#Function-Specific-Option-Pragmas-1"> ¶</a></span></h1> <dl class="table"> <dt>
<span><code class="code">#pragma GCC target (<var class="var">string</var>, …)</code><a class="copiable-link" href="#index-pragma-GCC-target"> ¶</a></span>
</dt> <dd> <p>This pragma allows you to set target-specific options for functions defined later in the source file. One or more strings can be specified. Each function that is defined after this point is treated as if it had been declared with one <code class="code">target(</code><var class="var">string</var><code class="code">)</code> attribute for each <var class="var">string</var> argument. The parentheses around the strings in the pragma are optional. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for more information about the <code class="code">target</code> attribute and the attribute syntax. </p> <p>The <code class="code">#pragma GCC target</code> pragma is presently implemented for x86, ARM, AArch64, PowerPC, S/390, and Nios II targets only. </p> </dd> <dt>
<span><code class="code">#pragma GCC optimize (<var class="var">string</var>, …)</code><a class="copiable-link" href="#index-pragma-GCC-optimize"> ¶</a></span>
</dt> <dd> <p>This pragma allows you to set global optimization options for functions defined later in the source file. One or more strings can be specified. Each function that is defined after this point is treated as if it had been declared with one <code class="code">optimize(</code><var class="var">string</var><code class="code">)</code> attribute for each <var class="var">string</var> argument. The parentheses around the strings in the pragma are optional. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for more information about the <code class="code">optimize</code> attribute and the attribute syntax. </p> </dd> <dt>
 <span><code class="code">#pragma GCC push_options</code><a class="copiable-link" href="#index-pragma-GCC-push_005foptions"> ¶</a></span>
</dt> <dt><code class="code">#pragma GCC pop_options</code></dt> <dd> <p>These pragmas maintain a stack of the current target and optimization options. It is intended for include files where you temporarily want to switch to using a different ‘<samp class="samp">#pragma GCC target</samp>’ or ‘<samp class="samp">#pragma GCC optimize</samp>’ and then to pop back to the previous options. </p> </dd> <dt>
<span><code class="code">#pragma GCC reset_options</code><a class="copiable-link" href="#index-pragma-GCC-reset_005foptions"> ¶</a></span>
</dt> <dd> <p>This pragma clears the current <code class="code">#pragma GCC target</code> and <code class="code">#pragma GCC optimize</code> to use the default switches as specified on the command line. </p> </dd> </dl> </div>  <div class="nav-panel"> <p> Next: <a href="loop-specific-pragmas">Loop-Specific Pragmas</a>, Previous: <a href="push_002fpop-macro-pragmas">Push/Pop Macro Pragmas</a>, Up: <a href="pragmas">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution">
  <p class="_attribution-p">
    &copy; Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
    <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Specific-Option-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Specific-Option-Pragmas.html</a>
  </p>
</div>