#pragma OPTION: Additional Options

Scope

Compilation Unit or until the nextOPTIONpragma

Syntax
#pragma OPTION ADD [<Handle>] "<Option>" 
#pragma OPTION DEL <Handle> 
#pragma OPTION DEL ALL 
Synonym

None

Arguments

<Handle>: An identifier - added options can selectively be deleted.

<Option>: A valid option string

Default

None

Description

Options are added inside of the source code while compiling a file.

The options given on the command line or in a configuration file cannot be changed in any way.

Additional options are added to the current ones with the ADD command. A handle may be given optionally.

The DEL command either removes all options with a specific handle. It also uses the ALL keyword to remove all added options regardless if they have a handle or not. Note that you only can remove options which were added previously with the OPTION ADD pragma.

All keywords and the handle are case-sensitive.

Restrictions :

Example

The example in the following listing shows how to compile only a single function with the additional -Or option.

Listing: Using the OPTION Pragma


#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 #pragma OPTION ADD */ 
/* are active again. */ 

The examples in the following listing show improper uses of the OPTION pragma.

Listing: Improper uses of the OPTION pragma


#pragma OPTION ADD -Or /* ERROR, quotes missing; use "-Or"  */ #pragma OPTION "-Or"   /* ERROR, needs also the ADD keyword */ 
#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