You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
4.7 KiB
HTML

<html lang="en">
<head>
<title>Function Specific Option Pragmas - 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.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Pragmas.html#Pragmas" title="Pragmas">
<link rel="prev" href="Push_002fPop-Macro-Pragmas.html#Push_002fPop-Macro-Pragmas" title="Push/Pop Macro Pragmas">
<link rel="next" href="Loop_002dSpecific-Pragmas.html#Loop_002dSpecific-Pragmas" title="Loop-Specific Pragmas">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2015 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.-->
<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 }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Function-Specific-Option-Pragmas"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Loop_002dSpecific-Pragmas.html#Loop_002dSpecific-Pragmas">Loop-Specific Pragmas</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Push_002fPop-Macro-Pragmas.html#Push_002fPop-Macro-Pragmas">Push/Pop Macro Pragmas</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Pragmas.html#Pragmas">Pragmas</a>
<hr>
</div>
<h4 class="subsection">6.60.13 Function Specific Option Pragmas</h4>
<dl>
<dt><code>#pragma GCC target (</code><var>"string"</var><code>...)</code><dd><a name="index-pragma-GCC-target-4183"></a>
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 as
if <code>attribute((target("STRING")))</code> was specified for that
function. The parenthesis around the options is optional.
See <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>, for more information about the
<code>target</code> attribute and the attribute syntax.
<p>The <code>#pragma GCC target</code> pragma is presently implemented for
x86, PowerPC, and Nios II targets only.
</dl>
<dl>
<dt><code>#pragma GCC optimize (</code><var>"string"</var><code>...)</code><dd><a name="index-pragma-GCC-optimize-4184"></a>
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 as
if <code>attribute((optimize("STRING")))</code> was specified for that
function. The parenthesis around the options is optional.
See <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>, for more information about the
<code>optimize</code> attribute and the attribute syntax.
</dl>
<dl>
<dt><code>#pragma GCC push_options</code><dt><code>#pragma GCC pop_options</code><dd><a name="index-pragma-GCC-push_005foptions-4185"></a><a name="index-pragma-GCC-pop_005foptions-4186"></a>
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 &lsquo;<samp><span class="samp">#pragma GCC target</span></samp>&rsquo; or
&lsquo;<samp><span class="samp">#pragma GCC optimize</span></samp>&rsquo; and then to pop back to the previous
options.
</dl>
<dl>
<dt><code>#pragma GCC reset_options</code><dd><a name="index-pragma-GCC-reset_005foptions-4187"></a>
This pragma clears the current <code>#pragma GCC target</code> and
<code>#pragma GCC optimize</code> to use the default switches as specified
on the command line.
</dl>
</body></html>