Allows you to specify optimization options at the subprogram level that override optimization options given on the command line.
This enables finer control of program optimization, and can help debug errors that occur only under optimization.
>>-#--pragma--option_override-----------------------------------> .------------------------------------------------. V | >--(--identifier----,----"--opt--(--+-compact--+-------+-+--)--"---+--)->< | +-, yes-+ | | '-, no--' | +-level--,--+-0-+----+ | +-2-+ | | '-3-' | +-spill--,----size---+ '-strict--+-------+--' '-, yes-'
#pragma option_override value | Equivalent compiler option |
---|---|
compact | COMPACT |
compact, yes | |
compact, no | NOCOMPACT |
level, 0 | OPT(0) |
level, 1 | OPT(2) |
level, 2 | OPT(2) |
level, 3 | OPT(3) |
spill, size | SPILL(size) |
strict | STRICT |
strict, yes | |
strict, no | NOSTRICT |
See the descriptions in the z/OS XL C/C++ User's Guide for the options listed in the table above for default settings.
The pragma takes effect only if optimization is already enabled by a command-line option. You can only specify an optimization level in the pragma lower than the level applied to the rest of the program being compiled.
The #pragma option_override directive only affects functions that are defined in the same compilation unit. The pragma directive can appear anywhere in the translation unit. That is, it can appear before or after the function definition, before or after the function declaration, before or after the function has been referenced, and inside or outside the function definition.
This pragma cannot be used with overloaded member functions.
Suppose you compile the following code fragment containing the functions foo and faa using OPT(2). Since it contains the #pragma option_override(faa, "opt(level, 0)"), function faa will not be optimized.
foo(){
.
.
.
}
#pragma option_override(faa, "opt(level, 0)")
faa(){
.
.
.
}
You cannot specify the IPA compiler option for #pragma option_override.
During IPA compile processing, subprogram-specific options will be used to control IPA compile-time optimizations.
During IPA link processing, subprogram-specific options will be used to control IPA link-time optimizations, as well as program partitioning. They will be retained, even if the related IPA link command line option is specified.