Compilation Unit or until next pragma OPTION
#pragma OPTION (ADD [<Handle>]{<Option>}|DEL ({Handle}|ALL))
None
<Handle>: This identifier allows selective deletion of added options.
<Option>: A valid option string enclosed in double quote (") characters
None
This pragma allows the addition of options inside the source code during file compilation.
Use the ADD command to add additional options to the current options. A handle may be given optionally.
Use the DEL command to remove all options with a specific handle or use the ALL keyword to remove all options.
All keywords and the handle are case-sensitive.
Restrictions:
The following example illustrates compiling a single function with the additional -Or option.
#pragma OPTION ADD function_main_handle "-Or" int sum(int max) { /* compiled with -or */ int i, sum=0; for (i = 0; i < max; i++) { sum += i; } return sum; } #pragma OPTION DEL function_main_handle /* now the same options as before the #pragma */ /* OPTION ADD are active again */
The following listing shows improper uses of the OPTION pragma.
#pragma OPTION ADD -Or /* ERROR, use "-Or" */ #pragma OPTION "-Or" /* ERROR, use keyword ADD */ #pragma OPTION ADD "-Odocf=\"-Or\"" /* ERROR, "-Odocf" not allowed in this pragma */ void f(void) { #pragma OPTION ADD "-Or" /* ERROR, pragma not allowed inside of declarations */ } #pragma OPTION ADD "-Cni" #ifdef __CNI__ /* ERROR, macros are not defined for options */ /* added with the pragma */ #endif