22.3.2 Pragmas to Control Options/Optimization
#pragma GCC target ("string" ...)
This pragma may be used to set target-specific options for all subsequent
function definitions. The arguments allowed are any options prefixed with
-m
, such that -m
will be prepended to each string
given to form the target options, i.e., #pragma
GCC target
("arch=armv7e-m")
. All function definitions following this pragma will
behave as if the attribute ((target("string"))
were applied to the
definition. The parentheses are optional.
#pragma GCC optimize ("string" ...)
#pragma GCC optimize ("string"...)
pragma sets
default optimization attributes for function declarations and definitions that do not
otherwise specify these attributes. All functions after the pragma will be optimized
accordingly. The parentheses are optional. The arguments allowed may be:- A number
n
, to be interpreted as an optimization level, i.e., the-On
option - A string beginning with
O
, which is interpreted as an optimization option, i.e.,-Ostring
- Otherwise,
string
should be an option that can be used with a-f
prefix.
#pragma GCC reset_options
pragma clears the default
optimizations, so that the optimization of subsequent functions is not controlled by
optimize
pragma.#pragma GCC push_options
#pragma GCC pop_options
These pragmas allow for maintaining a stack of target
and
optimize
options. The push_options
pragma will push
the current options onto the stack, which will be the command-line options if no
target
or optimize
pragma are in effect. The
pop_options
will restore the options in effect to those last pushed
onto the stack.
#pragma GCC reset_options
Clears any current options set via the target
or
optimize
pragmas for all subsequent function definitions.