void InitModInfo( // INITIALIZE MODULE INFORMATION void ) { PackAmount = TARGET_PACKING; GblPackAmount = PackAmount; SrcFileSetTab( DEF_TAB_WIDTH ); RingNameInit( &undef_names ); PragToggle.check_stack = true; PragToggle.unreferenced = true; DataThreshold = 32767; OptSize = 50; WholeFName = NULL; ObjectFileName = NULL; ModuleName = NULL; ErrorFileName = strsave( "*" ); ErrLimit = 20; WngLevel = WLEVEL_DEFAULT; /* set CompFlags defaults */ CompFlags.extensions_enabled = true; CompFlags.oldmacros_enabled = true; CompFlags.emit_library_names = true; CompFlags.emit_dependencies = true; CompFlags.emit_targimp_symbols = true; CompFlags.check_truncated_fnames = true; CompFlags.inline_functions = true; SetAuxWatcallInfo(); HeadPacks = NULL; HeadEnums = NULL; FreePrags = NULL; CgBackSetInlineDepth( DEFAULT_INLINE_DEPTH ); CgBackSetOeSize( 0 ); CgBackSetInlineRecursion( false ); }
// #pragma inline_recursion on // #pragma inline_recursion off // #pragma inline_recursion(on) -- MS compatible // #pragma inline_recursion(off) -- MS compatible // // Used to indicate whether recursive inlining is permitted or not // static void pragInlineRecursion( // PROCESS #pragma inline_recusrion void ) { if( PragRecog( "on" ) ) { CgBackSetInlineRecursion( true ); } else if( PragRecog( "off" ) ) { CgBackSetInlineRecursion( false ); } else { if( CurToken == T_LEFT_PAREN ) { NextToken(); if( PragRecog( "on" ) ) { CgBackSetInlineRecursion( true ); } else if( PragRecog( "off" ) ) { CgBackSetInlineRecursion( false ); } else { MustRecog( T_ID ); } MustRecog( T_RIGHT_PAREN ); } } }
pch_status PCHReadPragmaData( void ) { unsigned depth; unsigned value; PCHReadVar( PragToggle ); CgInfoLibPCHRead(); readPacks(); readEnums(); readExtrefs(); PCHReadVar( CompInfo.init_priority ); PCHReadVar( CompInfo.dt_method_speced ); depth = PCHReadUInt(); CgBackSetInlineDepth( depth ); value = PCHReadUInt(); CgBackSetInlineRecursion( value ); return( PCHCB_OK ); }
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(); }