Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • driver/cc1.cc

    rbec4d24 rd6f4488  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep  3 16:57:05 2018
    13 // Update Count     : 125
     12// Last Modified On : Thu Aug 23 09:48:40 2018
     13// Update Count     : 122
    1414//
    1515
     
    3232string compiler_name( CFA_BACKEND_CC );                                 // path/name of C compiler
    3333
     34string D__GCC_X__( "-D__GCC_X__=" );
    3435string D__GCC_BPREFIX__( "-D__GCC_BPREFIX__=" );
    3536string D__CFA_FLAGPREFIX__( "-D__CFA_FLAG__=" );
     
    4546enum { NumSuffixes = 2 };
    4647const string suffixes[NumSuffixes] = { "cfa", "hfa", };
     48
    4749
    4850void suffix( string arg, const char * args[], int & nargs ) {
     
    114116void Stage1( const int argc, const char * const argv[] ) {
    115117        int code;
     118        int i;
    116119
    117120        string arg;
     
    136139        cerr << "Stage1" << endl;
    137140        #endif // __DEBUG_H__
     141
     142        // process all the arguments
     143
    138144        checkEnv( args, nargs );                                                        // arguments passed via environment variables
    139         #ifdef __DEBUG_H__
    140         for ( int i = 1; i < argc; i += 1 ) {
     145
     146        for ( i = 1; i < argc; i += 1 ) {
     147                #ifdef __DEBUG_H__
    141148                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    142         } // for
    143         #endif // __DEBUG_H__
    144 
    145         // process all the arguments
    146 
    147         for ( int i = 1; i < argc; i += 1 ) {
     149                #endif // __DEBUG_H__
    148150                arg = argv[i];
     151                #ifdef __DEBUG_H__
     152                cerr << "arg:\"" << arg << "\"" << endl;
     153                #endif // __DEBUG_H__
    149154                if ( prefix( arg, "-" ) ) {
    150155                        // strip g++ flags that are inappropriate or cause duplicates in subsequent passes
     
    180185                                ncargs += 1;
    181186                                i += 1;                                                                 // and the argument
     187                        // } else if ( prefix( arg, D__GCC_X__ ) ) {
     188                        //      args[nargs] = "-x";
     189                        //      nargs += 1;
     190                        //      args[nargs] = ( *new string( arg.substr( D__GCC_X__.size() ) ) ).c_str(); // pass the flag along
     191                        //      nargs += 1;
     192                        // } else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_X__.substr(2) ) ) {
     193                        //      args[nargs] = "-x";
     194                        //      nargs += 1;
     195                        //      args[nargs] = ( *new string( string( argv[i + 1] ).substr( D__GCC_X__.size() - 2 ) ) ).c_str(); // pass the flag along
     196                        //      nargs += 1;
     197                        //      i += 1;                                                                 // and the argument
    182198                        } else if ( prefix( arg, D__GCC_BPREFIX__ ) ) {
    183199                                bprefix = arg.substr( D__GCC_BPREFIX__.size() );
     
    235251        #ifdef __DEBUG_H__
    236252        cerr << "args:";
    237         for ( int i = 1; i < nargs; i += 1 ) {
     253        for ( i = 1; i < nargs; i += 1 ) {
    238254                cerr << " " << args[i];
    239255        } // for
     
    266282                #ifdef __DEBUG_H__
    267283                cerr << "nargs: " << nargs << endl;
    268                 for ( int i = 0; args[i] != NULL; i += 1 ) {
     284                for ( i = 0; args[i] != NULL; i += 1 ) {
    269285                        cerr << args[i] << " ";
    270286                } // for
     
    308324                #ifdef __DEBUG_H__
    309325                cerr << "cpp nargs: " << nargs << endl;
    310                 for ( int i = 0; args[i] != NULL; i += 1 ) {
     326                for ( i = 0; args[i] != NULL; i += 1 ) {
    311327                        cerr << args[i] << " ";
    312328                } // for
     
    361377                #ifdef __DEBUG_H__
    362378                cerr << "cfa-cpp ncargs: " << o_name << " " << CFA_flag << " " << ncargs << endl;
    363                 for ( int i = 0; cargs[i] != NULL; i += 1 ) {
     379                for ( i = 0; cargs[i] != NULL; i += 1 ) {
    364380                        cerr << cargs[i] << " ";
    365381                } // for
     
    391407
    392408void Stage2( const int argc, const char * const * argv ) {
     409        int i;
     410
    393411        string arg;
    394412
     
    401419        cerr << "Stage2" << endl;
    402420        #endif // __DEBUG_H__
     421
     422        // process all the arguments
     423
    403424        checkEnv( args, nargs );                                                        // arguments passed via environment variables
    404         #ifdef __DEBUG_H__
    405         for ( int i = 1; i < argc; i += 1 ) {
     425
     426        for ( i = 1; i < argc; i += 1 ) {
     427                #ifdef __DEBUG_H__
    406428                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    407         } // for
    408         #endif // __DEBUG_H__
    409 
    410         // process all the arguments
    411 
    412         for ( int i = 1; i < argc; i += 1 ) {
     429                #endif // __DEBUG_H__
    413430                arg = argv[i];
     431                #ifdef __DEBUG_H__
     432                cerr << "arg:\"" << arg << "\"" << endl;
     433                #endif // __DEBUG_H__
    414434                if ( prefix( arg, "-" ) ) {
    415435                        // strip inappropriate flags
     
    456476        #ifdef __DEBUG_H__
    457477        cerr << "args:";
    458         for ( int i = 1; i < nargs; i += 1 ) {
     478        for ( i = 1; i < nargs; i += 1 ) {
    459479                cerr << " " << args[i];
    460480        } // for
     
    472492        #ifdef __DEBUG_H__
    473493        cerr << "stage2 nargs: " << nargs << endl;
    474         for ( int i = 0; args[i] != NULL; i += 1 ) {
     494        for ( i = 0; args[i] != NULL; i += 1 ) {
    475495                cerr << args[i] << " ";
    476496        } // for
     
    486506int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
    487507        #ifdef __DEBUG_H__
    488         for ( int int i = 0; env[i] != NULL; i += 1 ) {
     508        for ( int i = 0; env[i] != NULL; i += 1 ) {
    489509                cerr << env[i] << endl;
    490510        } // for
Note: See TracChangeset for help on using the changeset viewer.