static void defEmu( void ) { if( GET_FPU_EMU( CpuSwitches ) ) { DefSwitchMacro( "FPI" ); } else { DefSwitchMacro( "FPI87" ); } }
void MacroDefsSysind // SYSTEM-INDEPENDENT MACRO DEFINITIONS ( void ) { #ifdef OPT_BR if( BrinfActive() ) { DefSwitchMacro( "FBI" ); } else { BrinfMacroRelease(); } #endif }
void MiscMacroDefs( // PREDEFINE MISCELLANEOUS MACROS void ) { if( CompFlags.inline_intrinsics ) { // this is the only place 'inline_intrinsics' is checked // the mechanism works as follows: // (1) user sets -ox or -oi // (2) macro __INLINE_FUNCTIONS__ is defined // (3) user includes <header.h> // (4) various prototypes are marked as "intrinsic" // (5) fns marked 'intrinsic' will be looked up in code burst tables // (6) code for fn will be generated inline defineStringMacro( "__INLINE_FUNCTIONS__" ); } if( !CompFlags.extensions_enabled ) { defineStringMacro( "NO_EXT_KEYS" ); } if( CompFlags.oldmacros_enabled ) { defineKeywordMacros(); } defineStringMacro( "_WCHAR_T_DEFINED" ); defineStringMacro( "_STDWCHAR_T_DEFINED" ); if( CompFlags.signed_char ) { defineStringMacro( "__CHAR_SIGNED__" ); /* 20-apr-90 */ } if( CompFlags.excs_enabled ) { defineStringMacro( "_CPPUNWIND" ); } if( CompFlags.rtti_enabled ) { defineStringMacro( "_CPPRTTI" ); } defineFeatureMacros(); if( !CompFlags.no_alternative_tokens ) { DefineAlternativeTokens(); } PreDefineStringMacro( "__WATCOMC__=" _MACROSTR( _BLDVER ) ); PreDefineStringMacro( "__WATCOM_CPLUSPLUS__=" _MACROSTR( _BLDVER ) ); // #if __WATCOM_REVISION__ >= 8 PreDefineStringMacro( "__WATCOM_REVISION__=8" ); if( !PragToggle.check_stack ) { DefSwitchMacro( "S" ); } RingNameFree( &undef_names ); }
static void macroDefs( void ) { if( TargetSwitches & I_MATH_INLINE ) { DefSwitchMacro( "OM" ); } switch( TargetSwitches & (BIG_DATA|BIG_CODE|CHEAP_POINTER|FLAT_MODEL) ) { case CHEAP_POINTER: DefSwitchMacro( "MS" ); break; case BIG_CODE|CHEAP_POINTER: DefSwitchMacro( "MM" ); break; case BIG_DATA|CHEAP_POINTER: DefSwitchMacro( "MC" ); break; case BIG_CODE|BIG_DATA|CHEAP_POINTER: DefSwitchMacro( "ML" ); break; case BIG_CODE|BIG_DATA: DefSwitchMacro( "MH" ); break; case FLAT_MODEL|CHEAP_POINTER: DefSwitchMacro( "MF" ); break; } if( TargetSwitches & FLOATING_FS ) { DefSwitchMacro( "ZFF" ); } else { DefSwitchMacro( "ZFP" ); } if( TargetSwitches & FLOATING_GS ) { DefSwitchMacro( "ZGF" ); } else { DefSwitchMacro( "ZGP" ); } if( TargetSwitches & FLOATING_DS ) { DefSwitchMacro( "ZDF" ); } else { DefSwitchMacro( "ZDP" ); } if( TargetSwitches & FLOATING_SS ) { DefSwitchMacro( "ZU" ); } if( TargetSwitches & INDEXED_GLOBALS ) { DefSwitchMacro( "XGV" ); } if( TargetSwitches & WINDOWS ) { DefSwitchMacro( "ZW" ); } if( TargetSwitches & SMART_WINDOWS ) { DefSwitchMacro( "ZWS" ); } if( TargetSwitches & NO_CALL_RET_TRANSFORM ) { DefSwitchMacro( "OC" ); } if( TargetSwitches & NEED_STACK_FRAME ) { DefSwitchMacro( "OF" ); } if( GenSwitches & NO_OPTIMIZATION ) { DefSwitchMacro( "OD" ); } if( GenSwitches & RELAX_ALIAS ) { DefSwitchMacro( "OA" ); } if( GenSwitches & BRANCH_PREDICTION ) { DefSwitchMacro( "OB" ); } if( GenSwitches & LOOP_OPTIMIZATION ) { DefSwitchMacro( "OL" ); } if( GenSwitches & INS_SCHEDULING ) { DefSwitchMacro( "OR" ); } if( GenSwitches & FPU_ROUNDING_INLINE ) { DefSwitchMacro( "ZRI" ); } if( GenSwitches & FPU_ROUNDING_OMIT ) { DefSwitchMacro( "ZRO" ); } if( TargetSwitches & GEN_FWAIT_386 ) { DefSwitchMacro( "ZFW" ); } if( CompFlags.signed_char ) { DefSwitchMacro( "J" ); } if( CompFlags.use_pcheaders ) { DefSwitchMacro( "FH" ); } if( CompFlags.no_pch_warnings ) { DefSwitchMacro( "FHQ" ); } if( CompFlags.inline_intrinsics ) { DefSwitchMacro( "OI" ); } if( CompFlags.zu_switch_used ) { DefSwitchMacro( "ZU" ); } if( CompFlags.unique_functions ) { DefSwitchMacro( "OU" ); } #if _CPU == 386 if( CompFlags.register_conventions ) { DefSwitchMacro( "3R" ); } else { DefSwitchMacro( "3S" ); } #endif if( CompFlags.emit_names ) { DefSwitchMacro( "EN" ); } if( CompFlags.save_restore_segregs ) { DefSwitchMacro( "R" ); } if( CompFlags.zc_switch_used ) { DefSwitchMacro( "ZC" ); } if( CompFlags.use_unicode ) { DefSwitchMacro( "ZK" ); } if( CompFlags.sg_switch_used ) { DefSwitchMacro( "SG" ); } if( CompFlags.st_switch_used ) { DefSwitchMacro( "ST" ); } if( CompFlags.bm_switch_used ) { PreDefineStringMacro( "_MT" ); DefSwitchMacro( "BM" ); } if( CompFlags.bd_switch_used ) { DefSwitchMacro( "BD" ); } if( CompFlags.br_switch_used ) { PreDefineStringMacro( "_DLL" ); DefSwitchMacro( "BR" ); } if( CompFlags.bw_switch_used ) { DefSwitchMacro( "BW" ); } if( CompFlags.zm_switch_used ) { DefSwitchMacro( "ZM" ); } if( CompFlags.ep_switch_used ) { DefSwitchMacro( "EP" ); } if( CompFlags.ee_switch_used ) { DefSwitchMacro( "EE" ); } switch( CompInfo.dt_method_speced ) { case DTM_DIRECT : DefSwitchMacro( "XDT" ); DefSwitchMacro( "XD" ); break; case DTM_DIRECT_SMALL : DefSwitchMacro( "XDS" ); break; case DTM_TABLE : DefSwitchMacro( "XS" ); break; case DTM_DIRECT_TABLE : DefSwitchMacro( "XST" ); break; case DTM_TABLE_SMALL : DefSwitchMacro( "XSS" ); break; DbgDefault( "macroDefs -- invalid exception switch" ); } switch( GET_CPU( CpuSwitches ) ) { case CPU_86: DefSwitchMacro( "0" ); break; case CPU_186: DefSwitchMacro( "1" ); break; case CPU_286: DefSwitchMacro( "2" ); break; case CPU_386: DefSwitchMacro( "3" ); break; case CPU_486: DefSwitchMacro( "4" ); break; case CPU_586: DefSwitchMacro( "5" ); break; case CPU_686: DefSwitchMacro( "6" ); break; } switch( GET_FPU_LEVEL( CpuSwitches ) ) { case FPU_NONE: CompFlags.op_switch_used = 0; DefSwitchMacro( "FPC" ); break; case FPU_87: DefSwitchMacro( "FP287" ); defEmu(); break; case FPU_387: DefSwitchMacro( "FP387" ); defEmu(); break; case FPU_586: DefSwitchMacro( "FP5" ); defEmu(); break; case FPU_686: DefSwitchMacro( "FP6" ); defEmu(); break; } if( CompFlags.op_switch_used ) { DefSwitchMacro( "OP" ); } PreDefineStringMacro( "_INTEGRAL_MAX_BITS=64" ); #if _CPU == 386 PreDefineStringMacro( "_STDCALL_SUPPORTED" ); #endif if( CompFlags.oldmacros_enabled ) { #if _CPU == 8086 if( TargetSwitches & WINDOWS ) { PreDefineStringMacro( "SOMLINK=__cdecl" ); PreDefineStringMacro( "SOMDLINK=__far" ); } #else PreDefineStringMacro( "SOMLINK=_Syscall" ); PreDefineStringMacro( "SOMDLINK=_Syscall" ); #endif } }
static void analyseAnyTargetOptions( OPT_STORAGE *data ) { // quickly do the quiet option so the banner can be printed if( data->q || data->zq ) { CompFlags.quiet_mode = 1; } switch( data->char_set ) { case OPT_char_set_zku: CompFlags.use_unicode = 1; loadUnicodeTable( data->zku_value ); break; case OPT_char_set_zk0u: CompFlags.jis_to_unicode = 1; /* fall through */ case OPT_char_set_zk0: SetDBChar( 0 ); break; case OPT_char_set_zk1: SetDBChar( 1 ); break; case OPT_char_set_zk2: SetDBChar( 2 ); break; case OPT_char_set_zkl: SetDBChar( -1 ); break; } switch( data->exc_level ) { case OPT_exc_level_xs: CompFlags.excs_enabled = TRUE; CompInfo.dt_method_speced = DTM_TABLE; break; case OPT_exc_level_xst: CompFlags.excs_enabled = TRUE; CompInfo.dt_method_speced = DTM_DIRECT_TABLE; break; case OPT_exc_level_xss: CompFlags.excs_enabled = TRUE; CompInfo.dt_method_speced = DTM_TABLE_SMALL; break; case OPT_exc_level_xds: CompFlags.excs_enabled = FALSE; CompInfo.dt_method_speced = DTM_DIRECT_SMALL; break; case OPT_exc_level_xd: case OPT_exc_level_xdt: default: CompFlags.excs_enabled = FALSE; CompInfo.dt_method_speced = DTM_DIRECT; break; } switch( data->warn_level ) { case OPT_warn_level_w: WngLevel = data->w_value; break; case OPT_warn_level_wx: WngLevel = WLEVEL_WX; break; default: WngLevel = WLEVEL_DEFAULT; break; } switch( data->file_83 ) { case OPT_file_83_fx: CompFlags.check_truncated_fnames = 0; break; case OPT_file_83_ft: default: CompFlags.check_truncated_fnames = 1; break; } switch( data->opt_level ) { case OPT_opt_level_ox: /* -ox => -obmiler -s */ GenSwitches &= ~ NO_OPTIMIZATION; GenSwitches |= BRANCH_PREDICTION; // -ob GenSwitches |= LOOP_OPTIMIZATION; // -ol GenSwitches |= INS_SCHEDULING; // -or CmdSysSetMaxOptimization(); // -om CompFlags.inline_intrinsics = 1; // -oi #if 0 // Disabled - introduces too many problems which no one is ready to fix if( ! data->oe ) { data->oe = 1; // -oe // keep in sync with options.gml data->oe_value = 100; } #endif PragToggle.check_stack = 0; // -s break; case OPT_opt_level_od: GenSwitches |= NO_OPTIMIZATION; break; } switch( data->opt_size_time ) { case OPT_opt_size_time_ot: OptSize = 0; GenSwitches &= ~ NO_OPTIMIZATION; break; case OPT_opt_size_time_os: OptSize = 100; GenSwitches &= ~ NO_OPTIMIZATION; break; default: OptSize = 50; break; } switch( data->iso ) { case OPT_iso_za: CompFlags.extensions_enabled = 0; CompFlags.oldmacros_enabled = 0; CompFlags.unique_functions = 1; break; case OPT_iso_ze: default: CompFlags.extensions_enabled = 1; CompFlags.oldmacros_enabled = 1; break; } if( data->zam ) { CompFlags.oldmacros_enabled = 0; } // following must precede processing of data->oe switch( data->debug_info ) { case OPT_debug_info_d3s: CompFlags.static_inline_fns = 1; /* fall through */ case OPT_debug_info_d3i: CompFlags.inline_functions = 0; /* fall through */ case OPT_debug_info_d3: // this flag may be turned on when PCHs are written if we will be // optimizing the writing of the debugging info by referring back // to the info in another module CompFlags.all_debug_type_names = 1; GenSwitches |= NUMBERS | DBG_TYPES | DBG_LOCALS; if( debugOptionAfterOptOption( data ) ) { GenSwitches |= NO_OPTIMIZATION; } data->oe = 0; break; case OPT_debug_info_d2s: CompFlags.static_inline_fns = 1; /* fall through */ case OPT_debug_info_d2i: CompFlags.inline_functions = 0; /* fall through */ case OPT_debug_info_d2: GenSwitches |= NUMBERS | DBG_TYPES | DBG_LOCALS; if( debugOptionAfterOptOption( data ) ) { GenSwitches |= NO_OPTIMIZATION; } data->oe = 0; break; case OPT_debug_info_d2t: CompFlags.no_debug_type_names = 1; GenSwitches |= NUMBERS | DBG_TYPES | DBG_LOCALS; if( debugOptionAfterOptOption( data ) ) { GenSwitches |= NO_OPTIMIZATION; } data->oe = 0; break; case OPT_debug_info_d1: GenSwitches |= NUMBERS; break; case OPT_debug_info_d0: break; } switch( data->enum_size ) { case OPT_enum_size_ei: CompFlags.make_enums_an_int = 1; CompFlags.original_enum_setting = 1; break; case OPT_enum_size_em: CompFlags.make_enums_an_int = 0; CompFlags.original_enum_setting = 0; break; /* default set in CmdSysInit() */ } if( data->bd ) { CompFlags.bd_switch_used = 1; GenSwitches |= DLL_RESIDENT_CODE; } if( data->bm ) { CompFlags.bm_switch_used = 1; } if( data->bw ) { CompFlags.bw_switch_used = 1; } if( data->bc ) { CompFlags.bc_switch_used = 1; } if( data->bg ) { CompFlags.bg_switch_used = 1; } if( data->db ) { CompFlags.emit_browser_info = 1; #if 0 if( data->fhd ) { CompFlags.pch_debug_info_opt = 1; } #endif } if( data->ee ) { CompFlags.ee_switch_used = 1; } if( data->ef ) { CompFlags.error_use_full = 1; } if( data->ep ) { CompFlags.ep_switch_used = 1; ProEpiDataSize = data->ep_value; } if( data->en ) { CompFlags.emit_names = 1; } if( data->er ) { CompFlags.no_error_sym_injection = 1; } if( data->ew ) { CompFlags.ew_switch_used = 1; } if( data->e ) { ErrLimit = data->e_value; } else { ErrLimit = 20; } if( data->fhd ) { CompFlags.use_pcheaders = TRUE; } if( data->fhr_exclamation ) { CompFlags.pch_min_check = TRUE; data->fhr = TRUE; } if( data->fhr ) { CompFlags.use_pcheaders = TRUE; CompFlags.fhr_switch_used = TRUE; } if( data->fhw ) { CompFlags.use_pcheaders = TRUE; CompFlags.fhw_switch_used = TRUE; } if( data->fhwe ) { CompFlags.use_pcheaders = TRUE; CompFlags.fhwe_switch_used = TRUE; } if( data->fh || data->fhq ) { char *fh_name; char *fhq_name; char *p; if( data->fhq ) { CompFlags.no_pch_warnings = TRUE; } CompFlags.use_pcheaders = TRUE; fh_name = reduceToOneString( &(data->fh_value) ); fhq_name = reduceToOneString( &(data->fhq_value) ); if( fh_name != NULL ) { p = fh_name; if( fhq_name != NULL ) { /* use the latest file-name specified */ if( data->fh_timestamp > data->fhq_timestamp ) { CMemFree( fhq_name ); } else { CMemFree( fh_name ); p = fhq_name; } } } else { p = fhq_name; } PCHSetFileName( p ); } if( data->fi ) { SetStringOption( &ForceInclude, &(data->fi_value) ); } if( data->ad ) { SetStringOption( &DependFileName, &(data->ad_value) ); CompFlags.generate_auto_depend = 1; } if( data->adt ) { SetStringOption( &TargetFileName, &(data->adt_value) ); CompFlags.generate_auto_depend = 1; } if( data->add ) { SetStringOption( &SrcDepFileName, &(data->add_value) ); CompFlags.generate_auto_depend = 1; } if( data->adhp ) { SetStringOption( &DependHeaderPath, &(data->adhp_value) ); CompFlags.generate_auto_depend = 1; } if( data->adfs ) { ForceSlash = '/'; } if( data->adbs ) { ForceSlash = '\\'; } if( data->fo ) { SetStringOption( &ObjectFileName, &(data->fo_value) ); CompFlags.cpp_output_to_file = 1; /* in case '-p' option */ } if( data->fr ) { SetStringOption( &ErrorFileName, &(data->fr_value) ); } if( data->i ) { OPT_STRING *s; reverseList( &(data->i_value) ); for( s = data->i_value; s != NULL; s = s->next ) { HFileAppend( s->data ); } } if( data->jw ) { data->j = TRUE; CompFlags.plain_char_promotion = 1; } if( data->j ) { PTypeSignedChar(); CompFlags.signed_char = 1; } if( data->k ) { CompFlags.batch_file_continue = 1; } if( data->oa ) { GenSwitches |= RELAX_ALIAS; } if( data->ob ) { GenSwitches |= BRANCH_PREDICTION; } // following must follow processing of debug options if( data->oe ) { CgBackSetOeSize( data->oe_value ); } if( data->oh ) { GenSwitches |= SUPER_OPTIMAL; } if( data->oi ) { CompFlags.inline_intrinsics = 1; } if( data->oi_plus ) { CgBackSetInlineDepth( MAX_INLINE_DEPTH ); #if 0 // 98/01/08 -- this is disabled because it blows the code up too much // and slows compiles down over much (jww) CgBackSetInlineRecursion( TRUE ); #endif } if( data->ok ) { GenSwitches |= FLOW_REG_SAVES; } if( data->ol ) { GenSwitches |= LOOP_OPTIMIZATION; } if( data->ol_plus ) { GenSwitches |= LOOP_UNROLLING; } if( data->on ) { GenSwitches |= FP_UNSTABLE_OPTIMIZATION; } if( data->oo ) { GenSwitches &= ~ MEMORY_LOW_FAILS; } if( data->op ) { CompFlags.op_switch_used = 1; } if( data->or ) { GenSwitches |= INS_SCHEDULING; } if( data->ou ) { CompFlags.unique_functions = 1; } if( data->oz ) { GenSwitches |= NULL_DEREF_OK; } if( data->pil ) { CompFlags.cpp_ignore_line = 1; } if( data->p ) { CompFlags.cpp_output_requested = 1; } if( data->pc ) { CompFlags.cpp_output_requested = 1; CompFlags.keep_comments = 1; CompFlags.comments_wanted = 1; } if( data->pe ) { CompFlags.cpp_output_requested = 1; CompFlags.encrypt_preproc_output = 1; } if( data->pj ) { data->pl = TRUE; CompFlags.line_comments = 1; } if( data->pl ) { CompFlags.cpp_output_requested = 1; CompFlags.cpp_line_wanted = 1; } if( data->pw ) { CompFlags.cpp_output_requested = 1; PpSetWidth( data->pw_value ); } else { // #line directives get screwed by wrapped lines but we don't want // to interfere with a user's setting of the width if( data->pl ) { PpSetWidth( 0 ); } } if( CompFlags.cpp_output_requested ) { CompFlags.cpp_output = 1; CompFlags.quiet_mode = 1; } if( data->p_sharp ) { PreProcChar = (char)data->p_sharp_value; } if( data->rod ) { OPT_STRING *s; for( s = data->rod_value; s != NULL; s = s->next ) { SrcFileReadOnlyDir( s->data ); } } if( data->s ) { PragToggle.check_stack = 0; } if( data->t ) { SrcFileSetTab( data->t_value ); } if( data->v ) { CompFlags.dump_prototypes = 1; } if( data->wcd ) { OPT_NUMBER *n; for( n = data->wcd_value; n != NULL; n = n->next ) { WarnChangeLevel( WLEVEL_DISABLE, n->number ); } } if( data->wce ) { OPT_NUMBER *n; for( n = data->wce_value; n != NULL; n = n->next ) { WarnChangeLevel( WLEVEL_ENABLE, n->number ); } } if( data->we ) { CompFlags.warnings_cause_bad_exit = 1; } if( data->x ) { CompFlags.cpp_ignore_env = 1; } if( data->xbnm ) { CompFlags.fixed_name_mangling = 1; } if( data->xbsa ) { CompFlags.dont_align_segs = 1; } if( data->xbov1 ) { CompFlags.overload_13332 = 1; } if( data->xcmb ) { CompFlags.modifier_bind_compatibility = 1; } if( data->xcpi ) { CompFlags.prototype_instantiate = 1; } if( data->xr ) { CompFlags.rtti_enabled = 1; } if( data->xto ) { CompFlags.obfuscate_typesig_names = 1; } if( data->xx ) { CompFlags.ignore_default_dirs = 1; } if( data->zat ) { CompFlags.no_alternative_tokens = 1; } if( data->za0x ) { CompFlags.enable_std0x = 1; } if( data->zf ) { CompFlags.use_old_for_scope = 1; } if( data->zg ) { CompFlags.use_base_types = 1; } if( data->zld ) { CompFlags.emit_dependencies = 0; } if( data->zlf ) { CompFlags.emit_all_default_libs = 1; } if( data->zls ) { CompFlags.emit_targimp_symbols = 0; } if( data->fzh ) { /* Define the switch macros for STLPort */ CompFlags.dont_autogen_ext_inc = 1; DefSwitchMacro( "FZH" ); } if( data->fzs ) { /* Define the switch macros for STLPort */ CompFlags.dont_autogen_ext_src = 1; DefSwitchMacro( "FZS" ); } if( data->zl ) { CompFlags.emit_library_names = 0; } if( data->zp ) { PackAmount = data->zp_value; GblPackAmount = PackAmount; } if( data->zpw ) { CompFlags.warn_about_padding = 1; } if( data->zs ) { CompFlags.check_syntax = 1; } if( data->zv ) { #if COMP_CFG_COFF == 0 CompFlags.virtual_stripping = TRUE; #endif } if( data->na ) { CompFlags.disable_ialias = 1; } #ifndef NDEBUG if( data->tp ) { for(;;) { OPT_STRING* str = data->tp_value; if( NULL == str ) break; data->tp_value = str->next; strcpy( Buffer, str->data ); CMemFree( str ); PragmaSetToggle( TRUE ); } } if( data->zi ) { CompFlags.extra_stats_wanted = 1; // try to prevent distortions caused by debug stuff PragDbgToggle.no_mem_cleanup = 1; } #endif CBanner(); }