Checking Pragma Settings

The preprocessor function __option() returns the state of pragma settings at compile-time. The syntax is

  __option(setting-name)  

where setting-name is the name of a pragma that accepts the on, off, and reset options.

If setting-name is on, __option(setting-name) returns 1. If setting-name is off, __option(setting-name) returns 0. If setting-name is not the name of a pragma, __option(setting-name) returns false. If setting-name is the name of a pragma that does not accept the on, off, and reset options, the compiler issues a warning message.

The following listing shows an example.

Listing: Using the __option() Preprocessor Function
#if __option(ANSI_strict)

#include "portable.h" /* Use the portable declarations. */

#else

#include "custome.h" /* Use the specialized declarations. */

#endif
Table 1. Preprocessor Setting Names for __option()
Argument Corresponding Setting or Pragma
always_inline Pragma always_inline.
ANSI_strict ANSI Strict setting in the Language panel and pragma ANSI_strict.
auto_inline Auto-Inline setting of the Inlining menu in the Language panel and pragma auto_inline.
check_inline_sp_effects Pragma check_inline_sp_effects.
const_strings Pragma const_strings.
defer_codegen Pragma defer_codegen.
dollar_identifiers Pragma dollar_identifiers.
dont_inline Don't Inline setting in the Language panel and pragma dont_inline.
dont_reuse_strings Reuse Strings setting in the Language panel and pragma dont_reuse_strings.
enumsalwaysint Enums Always Int setting in the Language panel and pragma enumsalwaysint.
explicit_zero_data Pragma explicit_zero_data.
factor1 Pragma factor1.
factor2 Pragma factor2.
factor3 Pragma factor3.
extended_errorcheck Extended Error Checking setting in the Language panel and pragma extended_errorcheck.
fullpath_prepdump Pragma fullpath_prepdump.
initializedzerodata Pragma initializedzerodata.
inline_bottom_up Pragma inline_bottom_up.
interrupt Pragma interrupt.
line_prepdump Pragma line_prepdump.
mpwc_newline Map newlines to CR setting in the Language panel and pragma mpwc_newline.
mpwc_relax Relaxed Pointer Type Rules setting in the Language panel and pragma mpwc_relax.
nofactor1 Pragma nofactor1.
nofactor2 Pragma nofactor2.
nofactor3 Pragma nofactor3.
only_std_keywords ANSI Keywords Only setting in the Language panel and pragma only_std_keywords.
opt_common_subs Pragma opt_common_subs.
opt_dead_assignments Pragma opt_dead_assignments.
opt_dead_code Pragma opt_dead_code.
opt_lifetimes Pragma opt_lifetimes.
opt_loop_invariants Pragma opt_loop_invariants.
opt_propagation Pragma opt_propagation.
opt_strength_reduction Pragma opt_strength_reduction.
opt_strength_reduction_strict Pragma opt_strength_reduction_strict.
opt_unroll_loops Pragma opt_unroll_loops.
optimize_for_size Pragma optimize_for_size.
packstruct Pragma pactstruct.
peephole Pragma peephole.
pool_strings Pool Strings setting in the Language panel and pragma pool_strings.
profile Pragma profile.
readonly_strings Make String Read Only setting in the M56800 Processor settings panel and pragma readonly_strings.
require_prototypes Require Function Prototypes setting in the Language panel and pragma require_prototypes.
reverse_bitfields Pragma reverse_bitfields.
simple_prepdump Pragma simple_prepdump.
suppress_init_code Pragma suppress_init_code.
suppress_warnings Pragma suppress_warnings.
syspath_once Pragma syspath_once.
unsigned_char Use Unsigned Chars setting in the Language panel and pragma unsigned_char.
warn_any_ptr_int_conv Pragmawarn_any_ptr_int_conv.
warn_emptydecl Empty Declarations setting in the Language panel and pragma warn_emptydecl.
warn_extracomma Extra Commas setting in the Preprocessor panel and pragma warn_extracomma.
warn_filenamecaps Pragma warn_filenamecaps.
warn_filenamecaps_system Pragma warn_filenamecaps_system.
warn_illegal_instructions Pragma warn_illegal_instructions.
warn_illpragma Illegal Pragmas setting in the panel and pragma warn_illpragma.
warn_impl_f2i_conv Pragma warn_impl_f2i_conv.
warn_impl_i2f_conv Pragma warn_impl_i2f_conv.
warn_impl_s2u_conv Pragma warn_impl_s2u_conv.
warn_implicitconv Implicit Arithmetic Conversions setting in the processor panel and pragma warn_implicitconv.
warn_largeargs Pragma warn_largeargs.
warn_missingreturn Pragma warn_missingreturn
warn_no_side_effect Pragma warn_no_side_effect.
warn_notinlined Non-Inlined Functions setting in the processor panel and pragma warn_notinlined.
warn_padding Pragma warn_padding.
warn_possunwant Possible Errors setting in the Preprocessor panel and pragma warn_possunwant.
warn_ptr_int_conv Pragma warn_ptr_int_conv
warn_resultnotused Pragma warn_resultnotused.
warn_undefmacro Pragma warn_undefmacro.
warn_unusedarg Unused Arguments setting in the processor panel and pragma warn_unusedarg.
warn_unusedvar Unused Variables setting in the Language panel and pragma warn_unusedvar.
warning_errors Treat Warnings As Errors setting in the Preprocessor panel and pragma warning_errors.