[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Checking Options

The preprocessor function __option() lets you test the setting of many pragmas and options that control the C/C++ compiler and code generation. You typically modify these settings using various panels in the Project Settings dialog box.

The syntax for this preprocessor function is:


  __option(option-name)

If the specified option is on, __option() returns 1; otherwise, it returns 0. If option-name is unrecognized, __option() returns false.

This function is useful when you want one source file to contain code that uses different option settings. The example below shows how to compile one series of lines if you're compiling for machines with the MC68881 floating-point unit and another series if you're compiling for machines without out:


#if __option (code68881)  // Code for 68K chip with FPU
#else
  // Code for any 68K processor
#endif

The table below lists all the option names you can use in the preprocessor function __option().  

This argument...
Corresponds to the
a6frames  
Generate A6 Stack Frames option in the 68K Linker settings panel and pragma a6frames.  
align_array_members  
Pragma align_array_members.  
always_inline  
Pragma always_inline.  
altivec_codegen  
Pragma altivec_codegen  
altivec_model  
Pragma altivec_model  
altivec_vrsave  
Pragma altivec_vrsave  
ANSI_strict  
ANSI Strict option in the C/C++ Language Panel and pragma ANSI_strict.  
arg_dep_lookup  
Pragma arg_dep_lookup.  
ARM_conform  
ARM Conformance option in the C/C++ Language Panel and pragma ARM_conform.  
auto_inline  
Auto-Inline option of the Inlining menu in the C/C++ Language Panel and pragma auto_inline.  
bool  
Enable C++ bool/true/false option in the C/C++ Language Panel and pragma bool.  
check_header_flags  
Pragma check_header_flags.  
code68020  
68020 Codegen option in the 68K Processor settings panel and pragma code68020.  
code68881  
68881 Codegen option in the 68K Processor settings panel and pragma code68881.  
cplusplus  
Whether the compiler is compiling this file as a C++ file. Related to the Activate C++ Compiler option in the C/C++ Language Panel, the pragma cplusplus, and the macro cplusplus  
cpp_extensions  
Pragma cpp_extensions  
d0_pointers  
Pragmas pointers_in_D0 and pointers_in_A0.  
def_inherited  
Pragma def_inherited.  
defer_codegen  
Pragma defer_codegen.  
direct_destruction  
Enable Exception Handling option in the C/C++ Language Panel and pragma direct_destruction.  
direct_to_SOM  
Direct to SOM menu in the C/C++ Language Panel and pragma direct_to_SOM  
disable_registers  
Pragma disable_registers.  
dollar_identifiers  
Pragma dollar_identifiers.  
dont_inline  
Don't Inline option in the C/C++ Language Panel and pragma dont_inline.  
dont_reuse_strings  
Don't Reuse Strings option in the C/C++ Language Panel and pragma dont_reuse_strings.  
ecplusplus  
Pragma ecplusplus  
EIPC_EIPSW  
Pragma EIPC_EIPSW  
enumsalwaysint  
Enums Always Int option in the C/C++ Language Panel and pragma enumsalwaysint  
exceptions  
Enable C++ Exceptions option in the C/C++ Language Panel and pragma exceptions  
export  
Pragma export.  
extended_errorcheck  
Extended Error Checking option in the C/C++ Warnings settings panel and pragma extended_errorcheck.  
far_data  
Far Data option in the 68K Processor settings panel and pragma far_data.  
far_strings  
Far String Constants option in the 68K Processor settings panel and pragma far_strings.  
far_vtables  
Far Method Tables in the 68K Processor settings panel and pragma far_vtables.  
faster_pch_gen  
Pragma faster_pch_gen.  
float_constants  
Pragma float_constants  
force_active  
Pragma force_active.  
fourbyteints  
4-Byte Ints option in the 68K Processor settings panel and pragma fourbyteints.  
fp_contract  
Use FMADD & FMSUB option in the PPC Processor settings panel and pragma fp_contract.  
fullpath_prepdump  
Pragma fullpath_prepdump.  
function_align  
Pragma function_align.  
gcc_extensions  
Pragma gcc_extensions.  
IEEEdoubles  
8-Byte Doubles option in the 68K Processor settings panel and pragma IEEEdoubles.  
ignore_oldstyle  
Pragma ignore_oldstyle.  
import  
Pragma import.  
inline_bottom_up  
Pragma inline_bottom_up.  
inline_intrinsics  
Pragma inline_intrinsics.  
internal  
Pragma internal.  
interrupt  
Pragma interrupt.  
k63d  
K6 3D Favored option in the Extended Instruction Set menu of the x86 CodeGen settings panel and pragma k63d.  
k63d_calls  
MMX + K6 3D option in the Extended Instruction Set menu of the x86 CodeGen settings panel and pragma k63d_calls.  
lib_export  
Pragma lib_export.  
line_prepdump  
Pragma line_prepdump.  
little_endian  
No option. It is 1 if you're compiling for a little endian target (such as x86) and 0 if you're compiling for a big endian target (such as Mac OS).  
longlong  
Pragma longlong.  
longlong_enums  
Pragma longlong_enums.  
longlong_prepval  
Pragma longlong_enums.  
no_static_dtors  
Pragma no_static_dtors.  
macsbug  
MacsBug Symbols option in the 68K Linker settings panel and pragma macsbug.  
microsoft_exceptions  
Pragma microsoft_exceptions.  
microsoft_RTTI  
Pragma microsoft_RTTI.  
mmx  
MMX option in the Extended Instruction Set menu of the x86 CodeGen settings panel and pragma mmx.  
mmx_call  
Pragma mmx_call.  
mpwc  
MPW C Calling Conventions option in the 68K Processor settings panel and pragma mpwc.  
mpwc_newline  
Map Newlines to CR option in the C/C++ Language Panel and pragma mpwc_newline.  
mpwc_relax  
Relaxed Pointer Type Rules option in the C/C++ Language Panel and pragma mpwc_relax.  
no_register_coloring  
Global Register Allocation option in the 68K Processor settings panel and pragma no_register_coloring.  
oldstyle_symbols  
MacsBug Symbols option in the 68K Linker settings panel and pragma oldstyle_symbols  
only_std_keywords  
ANSI Keywords Only option in the C/C++ 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.  
opt_vectorize_loops  
Pragma opt_vectorize_loops.  
pool_data  
Pool Data option in the PPC Processor (for embedded PowerPC programming only) and pragma pool_data  
pool_strings  
Pool Strings option in the C/C++ Language Panel and pragma pool_strings  
ppc_unroll_speculative  
Pragma ppc_unroll_speculative.  
precompile  
Whether the file is being pre-compiled.  
preprocess  
Whether the file is being pre-processed  
profile  
Generate Profiler Calls option in the 68K Processor settings panel, Emit Profiler Calls option in the PPC Processor settings panel, and pragma profile.  
readonly_strings  
Make String Literals Readonly option in the PPC Processor settings panel and pragma readonly_strings.  
register_coloring  
Pragma register_coloring.  
require_prototypes  
Require Function Prototypes option in the C/C++ Language Panel and pragma require_prototypes.  
RTTI  
Enable RTTI option in the C/C++ Language Panel and pragma RTTI.  
side_effects  
Pragma side_effects.  
simple_prepdump  
Pragma simple_prepdump  
SOM-Call-Optimization  
Pragma SOM-Call-Optimization  
SOMCheckEnvironment  
Direct to SOM menu in the C/C++ Language Panel and pragma SOMCheckEnvironment  
static_inlines  
Pragma static_inlines  
stack_cleanup  
Pragma stack_cleanup.  
suppress_init_code  
Pragma suppress_init_code.  
suppress_warnings  
Pragma suppress_warnings.  
sym  
Marker in the project window debug column and pragma sym  
syspath_once  
Pragma syspath_once.  
toc_data  
Store Static Data in TOC option in the PPC Processor settings panel and pragma toc_data  
traceback  
Pragma traceback.  
trigraphs  
Expand Trigraphs option in the C/C++ Language Panel and pragma trigraphs.  
unsigned_char  
Use Unsigned Chars option in the C/C++ Language Panel and pragma unsigned_char.  
use_fp_instructions  
Use V810 Floating-Point Instructions, which is part of the NEC V800 Processor and pragma use_fp_instructions.  
use_frame  
Pragma use_frame.  
use_mask_registers  
Use r20 and r21 as Mask Registers, which is part of the NEC V800 Processor and pragma use_mask_registers.  
warn_emptydecl  
Empty Declarations option in the C/C++ Warnings settings panel and pragma warn_emptydecl.  
warn_extracomma  
Extra Commas option in the C/C++ Warnings settings panel and pragma warn_extracomma.  
warn_hidevirtual  
Hidden virtual functions option in the C/++ Warnings settings panel and pragma warn_hidevirtual.  
warn_illegal_instructions  
Pragma warn_illegal_instructions.  
warn_illpragma  
Illegal Pragmas option in the C/C++ Warnings settings panel and pragma warn_illpragma.  
warn_implicitconv  
Implicit Arithmetic Conversions option in the C/C++ Warnings settings panel and pragma warn_implicitconv.  
warn_no_side_effect  
pragma warn_no_side_effect  
warn_notinlined  
Non-Inlined Functions option in the C/C++ Warnings settings panel and pragma warn_notinlined.  
warn_padding  
pragma warn_padding  
warn_possunwant  
Possible Errors option in the C/C++ Warnings settings panel and pragma warn_possunwant.  
warn_resultnotused  
pragma warn_resultnotused  
warn_structclass  
Inconsistent Use of `class' and `struct' Keywords option in the C/C++ Warnings settings panel and pragma warn_structclass.  
warn_unusedarg  
Unused Arguments option in the C/C++ Warnings settings panel and pragma warn_unusedarg.  
warn_unusedvar  
Unused Variables option in the C/C++ Warnings settings panel and pragma warn_unusedvar.  
warning_errors  
Treat Warnings As Errors option in the C/C++ Warnings settings panel and pragma warning_errors.  
wchar_type  
Enable wchar_t Support option in the C/C++ Language settings panel and pragma wchar_type.  


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000