1<html lang="en"> 2<head> 3<title>Function Specific Option Pragmas - Using the GNU Compiler Collection (GCC)</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Using the GNU Compiler Collection (GCC)"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Pragmas.html#Pragmas" title="Pragmas"> 9<link rel="prev" href="Push_002fPop-Macro-Pragmas.html#Push_002fPop-Macro-Pragmas" title="Push/Pop Macro Pragmas"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 131998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 142010 Free Software Foundation, Inc. 15 16Permission is granted to copy, distribute and/or modify this document 17under the terms of the GNU Free Documentation License, Version 1.3 or 18any later version published by the Free Software Foundation; with the 19Invariant Sections being ``Funding Free Software'', the Front-Cover 20Texts being (a) (see below), and with the Back-Cover Texts being (b) 21(see below). A copy of the license is included in the section entitled 22``GNU Free Documentation License''. 23 24(a) The FSF's Front-Cover Text is: 25 26 A GNU Manual 27 28(b) The FSF's Back-Cover Text is: 29 30 You have freedom to copy and modify this GNU Manual, like GNU 31 software. Copies published by the Free Software Foundation raise 32 funds for GNU development.--> 33<meta http-equiv="Content-Style-Type" content="text/css"> 34<style type="text/css"><!-- 35 pre.display { font-family:inherit } 36 pre.format { font-family:inherit } 37 pre.smalldisplay { font-family:inherit; font-size:smaller } 38 pre.smallformat { font-family:inherit; font-size:smaller } 39 pre.smallexample { font-size:smaller } 40 pre.smalllisp { font-size:smaller } 41 span.sc { font-variant:small-caps } 42 span.roman { font-family:serif; font-weight:normal; } 43 span.sansserif { font-family:sans-serif; font-weight:normal; } 44--></style> 45<link rel="stylesheet" type="text/css" href="../cs.css"> 46</head> 47<body> 48<div class="node"> 49<a name="Function-Specific-Option-Pragmas"></a> 50<p> 51Previous: <a rel="previous" accesskey="p" href="Push_002fPop-Macro-Pragmas.html#Push_002fPop-Macro-Pragmas">Push/Pop Macro Pragmas</a>, 52Up: <a rel="up" accesskey="u" href="Pragmas.html#Pragmas">Pragmas</a> 53<hr> 54</div> 55 56<h4 class="subsection">6.56.13 Function Specific Option Pragmas</h4> 57 58 <dl> 59<dt><code>#pragma GCC target (</code><var>"string"</var><code>...)</code><dd><a name="index-pragma-GCC-target-3240"></a> 60This pragma allows you to set target specific options for functions 61defined later in the source file. One or more strings can be 62specified. Each function that is defined after this point will be as 63if <code>attribute((target("STRING")))</code> was specified for that 64function. The parenthesis around the options is optional. 65See <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>, for more information about the 66<code>target</code> attribute and the attribute syntax. 67 68 <p>The <code>#pragma GCC target</code> attribute is not implemented in GCC versions earlier 69than 4.4 for the i386/x86_64 and 4.6 for the PowerPC backends. At 70present, it is not implemented for other backends. 71</dl> 72 73 <dl> 74<dt><code>#pragma GCC optimize (</code><var>"string"</var><code>...)</code><dd><a name="index-pragma-GCC-optimize-3241"></a> 75This pragma allows you to set global optimization options for functions 76defined later in the source file. One or more strings can be 77specified. Each function that is defined after this point will be as 78if <code>attribute((optimize("STRING")))</code> was specified for that 79function. The parenthesis around the options is optional. 80See <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>, for more information about the 81<code>optimize</code> attribute and the attribute syntax. 82 83 <p>The ‘<samp><span class="samp">#pragma GCC optimize</span></samp>’ pragma is not implemented in GCC 84versions earlier than 4.4. 85</dl> 86 87 <dl> 88<dt><code>#pragma GCC push_options</code><dt><code>#pragma GCC pop_options</code><dd><a name="index-pragma-GCC-push_005foptions-3242"></a><a name="index-pragma-GCC-pop_005foptions-3243"></a> 89These pragmas maintain a stack of the current target and optimization 90options. It is intended for include files where you temporarily want 91to switch to using a different ‘<samp><span class="samp">#pragma GCC target</span></samp>’ or 92‘<samp><span class="samp">#pragma GCC optimize</span></samp>’ and then to pop back to the previous 93options. 94 95 <p>The ‘<samp><span class="samp">#pragma GCC push_options</span></samp>’ and ‘<samp><span class="samp">#pragma GCC pop_options</span></samp>’ 96pragmas are not implemented in GCC versions earlier than 4.4. 97</dl> 98 99 <dl> 100<dt><code>#pragma GCC reset_options</code><dd><a name="index-pragma-GCC-reset_005foptions-3244"></a> 101This pragma clears the current <code>#pragma GCC target</code> and 102<code>#pragma GCC optimize</code> to use the default switches as specified 103on the command line. 104 105 <p>The ‘<samp><span class="samp">#pragma GCC reset_options</span></samp>’ pragma is not implemented in GCC 106versions earlier than 4.4. 107</dl> 108 109 </body></html> 110 111