/* * Translate options related to C++ and not to C. */ static void c_plus_plus_opts( struct XlatStatus *status, OPT_STORAGE *cmdOpts, CmdLine *compCmdLine ) /**************************************************************************/ { status = status; AppendCmdLine( compCmdLine, CL_C_CPP_OPTS_SECTION, "-xs" ); if( cmdOpts->_10x ) { AppendCmdLine( compCmdLine, CL_C_CPP_OPTS_SECTION, "-zo" ); } }
/* * Translate options related to precompiled headers. */ static void precomp_header_opts( struct XlatStatus *status, OPT_STORAGE *cmdOpts, CmdLine *compCmdLine ) /***************************************************************************/ { char * newpath; status = status; if( cmdOpts->Fp ) { newpath = PathConvert( cmdOpts->Fp_value->data, '"' ); AppendFmtCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-fhq=%s", newpath ); } else { switch( cmdOpts->precomp_headers ) { case OPT_precomp_headers_Yc: /* fall through */ case OPT_precomp_headers_Yu: /* fall through */ case OPT_precomp_headers_YX: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-fhq" ); break; case OPT_precomp_headers_default: break; default: Zoinks(); } } if( cmdOpts->Yd ) { /* done by default */ } }
/* * Link any object and library files. Returns LINK_NOACTION if there was no * file to compile, LINK_ERROR if the linker returned a bad status code or * if the compiler could not be spawned, or else LINK_SUCCESS if everything * went smoothly. */ static int link( const OPT_STORAGE *cmdOpts, CmdLine *linkCmdLine ) /*****************************************************************/ { char ** args; char * filename; int fileType; int numFiles; int rc; char * defFile; char * prevDefFile = NULL; cmdOpts = cmdOpts; /*** Process all object and library file names ***/ for( numFiles=0; ; numFiles++ ) { filename = GetNextFile( &fileType, TYPE_OBJ_FILE, TYPE_LIB_FILE, TYPE_RES_FILE, TYPE_INVALID_FILE ); if( filename == NULL ) break; AppendCmdLine( linkCmdLine, CL_L_FILENAMES_SECTION, filename ); } /*** Process .def files ***/ for( ;; ) { defFile = GetNextFile( NULL, TYPE_DEF_FILE, TYPE_INVALID_FILE ); if( defFile == NULL ) break; if( prevDefFile != NULL ) { Warning( "Overriding %s with %s", prevDefFile, defFile ); } prevDefFile = defFile; }; if( prevDefFile != NULL ) { AppendFmtCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/DEF:%s", prevDefFile ); } else { if( numFiles == 0 ) return( LINK_NOACTION ); } /*** Spawn the linker ***/ AppendCmdLine( linkCmdLine, CL_L_PROGNAME_SECTION, LINKER ); args = MergeCmdLine( linkCmdLine, INVALID_MERGE_CMDLINE ); rc = spawnvp( P_WAIT, LINKER, (const char **)args ); if( rc != 0 ) { if( rc == -1 || rc == 255 ) { FatalError( "Unable to execute '%s'", LINKER ); } else { return( LINK_ERROR ); } } return( LINK_SUCCESS ); }
/* * Spawn the Watcom wmake. Returns NMAKE_ERROR if wmake returned a bad * status code or if it could not be spawned, or else NMAKE_SUCCESS if * everything went smoothly. */ static int nmake( const OPT_STORAGE *cmdOpts, CmdLine *cmdLine ) /**************************************************************/ { char ** args; int rc; int count; char * cwd; char flagstmp[32] = {0}; /*** get value for MAKEDIR field ***/ cwd = getcwd( NULL, 0 ); /*** construct MAKEFLAGS field ***/ if( cmdOpts->a ) strcat(flagstmp, "A"); if( cmdOpts->c ) strcat(flagstmp, "C"); if( cmdOpts->d ) strcat(flagstmp, "D"); if( cmdOpts->e ) strcat(flagstmp, "E"); if( cmdOpts->nologo ) strcat(flagstmp, "L"); if( cmdOpts->n ) strcat(flagstmp, "N"); if( cmdOpts->p ) strcat(flagstmp, "P"); if( cmdOpts->r ) strcat(flagstmp, "R"); if( cmdOpts->s ) strcat(flagstmp, "S"); if( cmdOpts->u ) strcat(flagstmp, "U"); if( cmdOpts->y ) strcat(flagstmp, "Y"); /*** pass builtin macros to wmake, so nmake wrapper gets called in recursive actions ***/ AppendFmtCmdLine( cmdLine, NMAKE_OPTS_SECTION, "MAKE=\"%s\"", "nmake" ); AppendFmtCmdLine( cmdLine, NMAKE_OPTS_SECTION, "MAKEDIR=\"%s\"", cwd ); AppendFmtCmdLine( cmdLine, NMAKE_OPTS_SECTION, "MAKEFLAGS=\"%s\"", flagstmp ); /*** merge commands ***/ AppendCmdLine( cmdLine, NMAKE_PROGNAME_SECTION, MAKE ); args = MergeCmdLine( cmdLine, INVALID_MERGE_CMDLINE ); /*** Spawn the wmake ***/ if( cmdOpts->showwopts ) { for( count=0; args[count]!=NULL; count++ ) { fprintf( stderr, "%s ", args[count] ); } fprintf( stderr, "\n" ); } if( !cmdOpts->noinvoke ) { rc = spawnvp( P_WAIT, MAKE, (const char **)args ); if( rc != 0 ) { if( rc == -1 || rc == 255 ) { FatalError( "Unable to execute '%s'", MAKE ); } else { return( NMAKE_ERROR ); } } } DestroyCmdLine( cmdLine ); return( NMAKE_SUCCESS ); }
/* * Spawn the resource compiler. */ static int res_compile( const OPT_STORAGE *cmdOpts, CmdLine *cmdLine ) /********************************************************************/ { char ** args; char * filename; char * nextFilename; int rc; int count; /*** Get the name of the .rc file to compiler ***/ filename = GetNextFile( NULL, TYPE_RC_FILE, TYPE_INVALID_FILE ); if( filename == NULL ) return( RC_NOACTION ); nextFilename = GetNextFile( NULL, TYPE_RC_FILE, TYPE_INVALID_FILE ); if( nextFilename != NULL ) { FatalError( "Can only compile one file at a time" ); } /*** Prepare to spawn the resource compiler ***/ AppendCmdLine( cmdLine, RC_PROGNAME_SECTION, RESCOMPILER ); AppendCmdLine( cmdLine, RC_FILENAMES_SECTION, filename ); args = MergeCmdLine( cmdLine, RC_PROGNAME_SECTION, RC_OPTS_SECTION, RC_FILENAMES_SECTION, INVALID_MERGE_CMDLINE ); /*** Spawn the compiler ***/ if( cmdOpts->showwopts ) { for( count=0; args[count]!=NULL; count++ ) { fprintf( stderr, "%s ", args[count] ); } fprintf( stderr, "\n" ); } if( !cmdOpts->noinvoke ) { rc = spawnvp( P_WAIT, RESCOMPILER, (const char **)args ); if( rc != 0 ) { if( rc == -1 || rc == 255 ) { FatalError( "Error executing '%s'", RESCOMPILER ); } else { return( RC_ERROR ); } } } return( RC_SUCCESS ); }
/* * Activate default options. */ static void default_opts(struct XlatStatus *status, OPT_STORAGE *cmdOpts, CmdLine *compCmdLine, CmdLine *linkCmdLine ) { OPT_STRING *curr; status = status; /*** Emit default options if so desired ***/ if (!cmdOpts->nowopts) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-bt=nt" ); AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-zlf" ); #ifdef __TARGET_386__ AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-ei" ); #endif AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-zq" ); AppendCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/nologo" ); } /* if */ /*** Add any options meant for the Watcom tools ***/ if (cmdOpts->passwopts) { for (curr = cmdOpts->passwopts_value; curr; curr = curr->next) { AppendCmdLine(compCmdLine, CL_C_OPTS_SECTION, curr->data); } } } /* default_opts() */
/* * Add one more parameter to the section specified by block. Reallocates * memory if necessary, and does all necessary bookkeeping. The stored * string is generated using the printf-style format string and any * additional parmameters. */ void AppendFmtCmdLine( CmdLine *cmdLine, int section, const char *format, ... ) /*****************************************************************************/ { static char buf[BUFFER_SIZE]; va_list args; /*** Format it, then pass it though to AppendCmdLine ***/ if( section < 0 || section >= cmdLine->numSections ) Zoinks(); va_start( args, format ); vsnprintf( buf, BUFFER_SIZE, format, args ); va_end( args ); AppendCmdLine( cmdLine, section, buf ); }
/* * Make a completely separate copy of a CmdLine. */ CmdLine *CloneCmdLine( const CmdLine *oldCmdLine ) /************************************************/ { CmdLine * newCmdLine; int countSection; int countArg; newCmdLine = InitCmdLine( oldCmdLine->numSections ); for( countSection=0; countSection<oldCmdLine->numSections; countSection++ ) { for( countArg=0; countArg<oldCmdLine[countSection].curItems; countArg++ ) { AppendCmdLine( newCmdLine, countSection, oldCmdLine[countSection].args[countArg] ); } } return( newCmdLine ); }
/* * Spawn the Watcom linker. Returns LINK_NOACTION if there was no file to * link, LINK_ERROR if the linker returned a bad status code or if it could * not be spawned, or else LINK_SUCCESS if everything went smoothly. */ static int link( const OPT_STORAGE *cmdOpts, CmdLine *cmdLine ) /*************************************************************/ { char ** args; int rc; char * cmdFileName; FILE * fp; int count; CmdLine * spawnCmdLine; /*** Make the command file ***/ args = MergeCmdLine( cmdLine, INVALID_MERGE_CMDLINE ); cmdFileName = tmpnam( NULL ); if( !cmdOpts->noinvoke ) { fp = fopen( cmdFileName, "wt" ); if( fp == NULL ) { FatalError( "Cannot open temporary file '%s' -- aborting", cmdFileName ); } } for( count=0; args[count]!=NULL; count++ ) { if( !cmdOpts->noinvoke ) { fprintf( fp, "%s\n", args[count] ); } if( cmdOpts->showwopts ) { fprintf( stderr, "echo.%s%s%s\n", args[count], (count == 0 ? ">" : ">>"), cmdFileName ); } } if( !cmdOpts->noinvoke ) { fclose( fp ); } /*** Spawn the linker ***/ spawnCmdLine = InitCmdLine( LINK_NUM_SECTIONS ); AppendCmdLine( spawnCmdLine, LINK_PROGNAME_SECTION, LINKER ); AppendFmtCmdLine( spawnCmdLine, LINK_OPTS_SECTION, "@%s", cmdFileName ); args = MergeCmdLine( spawnCmdLine, INVALID_MERGE_CMDLINE ); if( cmdOpts->showwopts ) { for( count=0; args[count]!=NULL; count++ ) { fprintf( stderr, "%s ", args[count] ); } fprintf( stderr, "\n" ); } if( !cmdOpts->noinvoke ) { rc = spawnvp( P_WAIT, LINKER, (const char **)args ); } if( cmdOpts->showwopts ) { fprintf( stderr, "del %s\n", cmdFileName ); } if( !cmdOpts->noinvoke ) { remove( cmdFileName ); if( rc != 0 ) { if( rc == -1 || rc == 255 ) { FatalError( "Unable to execute '%s'", LINKER ); } else { return( LINK_ERROR ); } } } DestroyCmdLine( spawnCmdLine ); return( LINK_SUCCESS ); }
/* * Compile any C and C++ files. Returns COMPILE_NOACTION if there was no * file to compile, COMPILE_ERROR if the compiler returned a bad status code * or if the compiler could not be spawned, or else COMPILE_SUCCESS if * everything went smoothly. */ static int compile( const OPT_STORAGE *cmdOpts, CmdLine *compCmdLine ) /********************************************************************/ { CmdLine * cloneCmdLine; char ** args = NULL; char * filename; int fileType; char * compiler = NULL; int rc; int alive = 1; int numCompiled = 0; char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; char fname[_MAX_FNAME]; char ext[_MAX_EXT]; char fullPath[_MAX_PATH]; int count; /*** Process all the source files, in the order they were given ***/ while( alive ) { filename = GetNextFile( &fileType, TYPE_C_FILE, TYPE_CPP_FILE, TYPE_INVALID_FILE ); if( filename == NULL ) break; /*** Prepare to spawn the compiler ***/ cloneCmdLine = CloneCmdLine( compCmdLine ); HandleFileTranslate( filename, cloneCmdLine, NULL ); switch( fileType ) { case TYPE_C_FILE: compiler = C_COMPILER; AppendCmdLine( cloneCmdLine, CL_C_PROGNAME_SECTION, compiler ); AppendCmdLine( cloneCmdLine, CL_C_FILENAMES_SECTION, filename ); if( !cmdOpts->nowopts ) { AppendCmdLine( cloneCmdLine, CL_C_OPTS_SECTION, "-aa" ); } args = MergeCmdLine( cloneCmdLine, CL_C_PROGNAME_SECTION, CL_C_MACROS_SECTION, CL_C_OPTS_SECTION, CL_C_FILENAMES_SECTION, INVALID_MERGE_CMDLINE ); break; case TYPE_CPP_FILE: compiler = CPP_COMPILER; AppendCmdLine( cloneCmdLine, CL_C_PROGNAME_SECTION, compiler ); AppendCmdLine( cloneCmdLine, CL_C_FILENAMES_SECTION, filename ); args = MergeCmdLine( cloneCmdLine, CL_C_PROGNAME_SECTION, CL_C_MACROS_SECTION, CL_C_OPTS_SECTION, CL_C_CPP_OPTS_SECTION, CL_C_FILENAMES_SECTION, INVALID_MERGE_CMDLINE ); break; default: Zoinks(); } /*** Spawn the compiler ***/ _splitpath( filename, drive, dir, fname, ext ); fprintf( stderr, "%s%s\n", fname, ext ); /* print name of file we're compiling */ if( cmdOpts->showwopts ) { for( count=0; args[count]!=NULL; count++ ) { fprintf( stderr, "%s ", args[count] ); } fprintf( stderr, "\n" ); } if( !cmdOpts->noinvoke ) { rc = spawnvp( P_WAIT, compiler, (const char **)args ); if( rc != 0 ) { if( rc == -1 || rc == 255 ) { FatalError( "Unable to execute '%s'", compiler ); } else { return( COMPILE_ERROR ); } } } /*** Add the object file to the linker list, observe -Fo ***/ if( cmdOpts->Fo ) { AddFile( TYPE_OBJ_FILE, PathConvert( cmdOpts->Fo_value->data, '"' ) ); } else { _makepath( fullPath, NULL, NULL, fname, ".obj" ); AddFile( TYPE_OBJ_FILE, fullPath ); } /*** Prepare for the next iteration ***/ DestroyCmdLine( cloneCmdLine ); numCompiled++; } if( numCompiled > 0 ) { return( COMPILE_SUCCESS ); } else { return( COMPILE_NOACTION ); } }
/* * Activate options which have been parsed but not yet turned on. */ static void merge_opts( struct XlatStatus *status, OPT_STORAGE *cmdOpts, CmdLine *compCmdLine, CmdLine *linkCmdLine ) /**********************************************************************/ { char buf[128]; char * macro; /*** Handle /D and /U ***/ for( ;; ) { /* defines */ macro = GetNextDefineMacro(); if( macro == NULL ) break; AppendFmtCmdLine( compCmdLine, CL_C_MACROS_SECTION, "-d%s", macro ); } for( ;; ) { /* undefines */ macro = GetNextUndefineMacro(); if( macro == NULL ) break; AppendFmtCmdLine( compCmdLine, CL_C_MACROS_SECTION, "-u%s", macro ); } /*** Merge optimization options ***/ if( status->opt_od ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-od" ); } else { strcpy( buf, "-o" ); #ifdef __TARGET_386__ if( status->opt_of ) strcat( buf, "f" ); if( status->opt_or ) strcat( buf, "r" ); #endif if( status->opt_oa ) strcat( buf, "a" ); if( status->opt_oi ) strcat( buf, "i" ); if( status->opt_ol ) strcat( buf, "l" ); if( status->opt_ol_plus ) strcat( buf, "l+" ); if( status->opt_om ) strcat( buf, "m" ); if( status->opt_on ) strcat( buf, "n" ); if( status->opt_op ) strcat( buf, "p" ); if( status->opt_os ) strcat( buf, "s" ); if( status->opt_ot ) strcat( buf, "t" ); if( status->opt_ox ) strcat( buf, "x" ); if( strcmp( buf, "-o" ) != 0 ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, buf ); } } /*** Handle debugging options ***/ switch( status->debugLevel ) { case 0: /* no debugging info */ break; case 1: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-d1" ); break; case 2: if (!cmdOpts->lesswd) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-d2" ); } else { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-d1" ); } break; default: Zoinks(); } if( !status->charTypeUnsigned ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-j" ); } AppendFmtCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-w%d", status->warnLevel ); if( cmdOpts->showwopts ) { AppendCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/showwopts" ); } if( cmdOpts->noinvoke ) { AppendCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/noinvoke" ); } if( cmdOpts->nowopts ) { AppendCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/nowopts" ); } }
/* * Parse linker options. */ static void linker_opts( struct XlatStatus *status, OPT_STORAGE *cmdOpts, CmdLine *linkCmdLine ) /***********************************************************************/ { OPT_STRING * optStr; char * newpath; if( cmdOpts->F ) { AppendFmtCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/STACK:%s", cmdOpts->F_value->data ); } if( cmdOpts->Fe ) { AppendFmtCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/OUT:%s", cmdOpts->Fe_value->data ); } optStr = cmdOpts->o_value; if( cmdOpts->o_value != NULL ) { newpath = PathConvert( optStr->data, '"' ); AppendFmtCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/OUT:%s", newpath ); } if( cmdOpts->Fm ) { if( cmdOpts->Fm_value != NULL ) { AppendFmtCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/MAP:%s", cmdOpts->Fm_value->data ); } else { AppendCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/MAP" ); } } if( cmdOpts->LD ) { AppendCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/DLL" ); } if( cmdOpts->link ) { optStr = cmdOpts->link_value; while( optStr != NULL ) { AppendFmtCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "%s", optStr->data ); optStr = optStr->next; } } switch( cmdOpts->debug_info ) { case OPT_debug_info_Zd: AppendCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/DEBUG" ); status->debugLevel = 1; break; case OPT_debug_info_Z7: /* fall through */ case OPT_debug_info_Zi: AppendCmdLine( linkCmdLine, CL_L_OPTS_SECTION, "/DEBUG" ); status->debugLevel = 2; break; case OPT_debug_info_default: /* do nothing */ break; default: Zoinks(); } }
/* * Translate options related to optimization. */ static void optimization_opts( struct XlatStatus *status, OPT_STORAGE *cmdOpts, CmdLine *compCmdLine ) /*************************************************************************/ { if( cmdOpts->opt_level != OPT_opt_level_Od ) { status->opt_od = 0; switch( cmdOpts->opt_level ) { case OPT_opt_level_O1: /* minimize size */ cmdOpts->Og = 1; cmdOpts->opt_size_time = OPT_opt_size_time_Os; cmdOpts->Oy = 1; cmdOpts->Ob_value = 1; cmdOpts->stack_probes = OPT_stack_probes_Gs; cmdOpts->Gf = 1; cmdOpts->GF = 1; cmdOpts->Gy = 1; break; case OPT_opt_level_O2: /* maximize speed */ cmdOpts->Og = 1; cmdOpts->Oi = 1; cmdOpts->opt_size_time = OPT_opt_size_time_Ot; cmdOpts->Oy = 1; cmdOpts->Ob_value = 1; cmdOpts->stack_probes = OPT_stack_probes_Gs; cmdOpts->Gf = 1; cmdOpts->GF = 1; cmdOpts->Gy = 1; break; case OPT_opt_level_Ox: cmdOpts->Ob_value = 1; cmdOpts->Og = 1; cmdOpts->Oi = 1; cmdOpts->opt_size_time = OPT_opt_size_time_Ot; cmdOpts->Oy = 1; cmdOpts->stack_probes = OPT_stack_probes_Gs; status->opt_ol_plus = 1; status->opt_om = 1; status->opt_on = 1; status->opt_ox = 1; case OPT_opt_level_default: /* let the compiler use its default */ break; default: Zoinks(); } if( cmdOpts->Oa ) { status->opt_oa = 1; } if( cmdOpts->Ob_value == 0 ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-oe=0" ); } if( cmdOpts->Og ) { status->opt_ol = 1; status->opt_ot = 1; } if( cmdOpts->Oi ) { status->opt_oi = 1; } if( cmdOpts->Op ) { status->opt_op = 1; } #ifdef __TARGET_386__ if( cmdOpts->Oy ) { status->opt_of = 0; } #endif } switch( cmdOpts->opt_size_time ) { case OPT_opt_size_time_Os: status->opt_os = 1; break; case OPT_opt_size_time_Ot: status->opt_ot = 1; break; case OPT_opt_size_time_default: break; default: Zoinks(); } }
/* * Translate options related to object files. */ static void object_opts( struct XlatStatus *status, OPT_STORAGE *cmdOpts, CmdLine *compCmdLine ) /***********************************************************************/ { char * newpath; if( cmdOpts->Fo && !status->disable_Fo ) { newpath = PathConvert( cmdOpts->Fo_value->data, '"' ); AppendFmtCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-fo=%s", newpath ); } if( cmdOpts->Gh ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-ep" ); } if( cmdOpts->Gy ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-zm" ); } if( cmdOpts->LD ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-bd" ); if( cmdOpts->threads_linking==OPT_threads_linking_default ) { cmdOpts->threads_linking = OPT_threads_linking_MT; } } switch( cmdOpts->threads_linking ) { case OPT_threads_linking_MD: case OPT_threads_linking_MDd: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-bm" ); if( !cmdOpts->_10x ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-br" ); } break; case OPT_threads_linking_ML: case OPT_threads_linking_MLd: break; case OPT_threads_linking_MT: case OPT_threads_linking_MTd: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-bm" ); break; case OPT_threads_linking_default: /* let the compiler use its default */ break; default: Zoinks(); } switch( cmdOpts->debug_info ) { case OPT_debug_info_Z7: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-hd" ); status->debugLevel = 2; break; case OPT_debug_info_Zd: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-hd" ); status->debugLevel = 1; break; case OPT_debug_info_Zi: /* unsupported */ case OPT_debug_info_default: /* do nothing */ break; default: Zoinks(); } if( cmdOpts->Zl ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-zl" ); } if( cmdOpts->Zp ) { AppendFmtCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-zp%d", cmdOpts->Zp_value ); } }
/* * Parse various options which defy categorization. */ static void misc_opts( struct XlatStatus *status, OPT_STORAGE *cmdOpts, CmdLine *compCmdLine ) /*********************************************************************/ { if( cmdOpts->J ) { status->charTypeUnsigned = 1; } switch( cmdOpts->warn_level ) { case OPT_warn_level_w: status->warnLevel = 0; break; case OPT_warn_level_W: status->warnLevel = cmdOpts->W_value; break; case OPT_warn_level_default: /* use default value */ break; default: Zoinks(); } switch( cmdOpts->iso ) { case OPT_iso_Za: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-za" ); if( cmdOpts->iso_timestamp > cmdOpts->Op_timestamp ) { status->opt_op = 1; } break; case OPT_iso_Ze: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-ze" ); break; case OPT_iso_default: /* use default value */ break; default: Zoinks(); } if( cmdOpts->Zs ) { status->disable_c = 1; status->disable_FA = 1; status->disable_Fa = 1; status->disable_Fm = 1; status->disable_Fo = 1; AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-zs" ); } if( !status->disable_c ) { if( cmdOpts->FR ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-db" ); } #ifdef __TARGET_386__ switch( cmdOpts->arch_i86 ) { /* what is the CPU */ case OPT_arch_i86_G3: if( status->parmsInRegs ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-3r" ); } else { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-3s" ); } break; case OPT_arch_i86_G4: case OPT_arch_i86_GB: default: if( status->parmsInRegs ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-4r" ); } else { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-4s" ); } break; case OPT_arch_i86_G5: if( status->parmsInRegs ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-5r" ); } else { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-5s" ); } break; } #endif switch( cmdOpts->stack_probes ) { case OPT_stack_probes_Ge: AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-st" ); break; case OPT_stack_probes_Gs: #ifndef __TARGET_AXP__ AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-sg" ); #else AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-s" ); #endif break; case OPT_stack_probes_default: break; default: Zoinks(); } if( cmdOpts->WX ) { AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-we" ); } if( cmdOpts->Zg ) { status->disable_c = 1; status->disable_FA = 1; status->disable_Fa = 1; status->disable_Fm = 1; status->disable_Fo = 1; Warning( "Prototypes will be output to .def file(s), not standard output" ); AppendCmdLine( compCmdLine, CL_C_OPTS_SECTION, "-v" ); } } }