Changeset bec4d24 for driver/cc1.cc


Ignore:
Timestamp:
Sep 8, 2018, 8:56:30 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
7117ac3
Parents:
245a92c
Message:

fix debug print, better handle -x language command-line flag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • driver/cc1.cc

    r245a92c rbec4d24  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 23 09:48:40 2018
    13 // Update Count     : 122
     12// Last Modified On : Mon Sep  3 16:57:05 2018
     13// Update Count     : 125
    1414//
    1515
     
    3232string compiler_name( CFA_BACKEND_CC );                                 // path/name of C compiler
    3333
    34 string D__GCC_X__( "-D__GCC_X__=" );
    3534string D__GCC_BPREFIX__( "-D__GCC_BPREFIX__=" );
    3635string D__CFA_FLAGPREFIX__( "-D__CFA_FLAG__=" );
     
    4645enum { NumSuffixes = 2 };
    4746const string suffixes[NumSuffixes] = { "cfa", "hfa", };
    48 
    4947
    5048void suffix( string arg, const char * args[], int & nargs ) {
     
    116114void Stage1( const int argc, const char * const argv[] ) {
    117115        int code;
    118         int i;
    119116
    120117        string arg;
     
    139136        cerr << "Stage1" << endl;
    140137        #endif // __DEBUG_H__
     138        checkEnv( args, nargs );                                                        // arguments passed via environment variables
     139        #ifdef __DEBUG_H__
     140        for ( int i = 1; i < argc; i += 1 ) {
     141                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
     142        } // for
     143        #endif // __DEBUG_H__
    141144
    142145        // process all the arguments
    143146
    144         checkEnv( args, nargs );                                                        // arguments passed via environment variables
    145 
    146         for ( i = 1; i < argc; i += 1 ) {
    147                 #ifdef __DEBUG_H__
    148                 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    149                 #endif // __DEBUG_H__
     147        for ( int i = 1; i < argc; i += 1 ) {
    150148                arg = argv[i];
    151                 #ifdef __DEBUG_H__
    152                 cerr << "arg:\"" << arg << "\"" << endl;
    153                 #endif // __DEBUG_H__
    154149                if ( prefix( arg, "-" ) ) {
    155150                        // strip g++ flags that are inappropriate or cause duplicates in subsequent passes
     
    185180                                ncargs += 1;
    186181                                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
    198182                        } else if ( prefix( arg, D__GCC_BPREFIX__ ) ) {
    199183                                bprefix = arg.substr( D__GCC_BPREFIX__.size() );
     
    251235        #ifdef __DEBUG_H__
    252236        cerr << "args:";
    253         for ( i = 1; i < nargs; i += 1 ) {
     237        for ( int i = 1; i < nargs; i += 1 ) {
    254238                cerr << " " << args[i];
    255239        } // for
     
    282266                #ifdef __DEBUG_H__
    283267                cerr << "nargs: " << nargs << endl;
    284                 for ( i = 0; args[i] != NULL; i += 1 ) {
     268                for ( int i = 0; args[i] != NULL; i += 1 ) {
    285269                        cerr << args[i] << " ";
    286270                } // for
     
    324308                #ifdef __DEBUG_H__
    325309                cerr << "cpp nargs: " << nargs << endl;
    326                 for ( i = 0; args[i] != NULL; i += 1 ) {
     310                for ( int i = 0; args[i] != NULL; i += 1 ) {
    327311                        cerr << args[i] << " ";
    328312                } // for
     
    377361                #ifdef __DEBUG_H__
    378362                cerr << "cfa-cpp ncargs: " << o_name << " " << CFA_flag << " " << ncargs << endl;
    379                 for ( i = 0; cargs[i] != NULL; i += 1 ) {
     363                for ( int i = 0; cargs[i] != NULL; i += 1 ) {
    380364                        cerr << cargs[i] << " ";
    381365                } // for
     
    407391
    408392void Stage2( const int argc, const char * const * argv ) {
    409         int i;
    410 
    411393        string arg;
    412394
     
    419401        cerr << "Stage2" << endl;
    420402        #endif // __DEBUG_H__
     403        checkEnv( args, nargs );                                                        // arguments passed via environment variables
     404        #ifdef __DEBUG_H__
     405        for ( int i = 1; i < argc; i += 1 ) {
     406                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
     407        } // for
     408        #endif // __DEBUG_H__
    421409
    422410        // process all the arguments
    423411
    424         checkEnv( args, nargs );                                                        // arguments passed via environment variables
    425 
    426         for ( i = 1; i < argc; i += 1 ) {
    427                 #ifdef __DEBUG_H__
    428                 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    429                 #endif // __DEBUG_H__
     412        for ( int i = 1; i < argc; i += 1 ) {
    430413                arg = argv[i];
    431                 #ifdef __DEBUG_H__
    432                 cerr << "arg:\"" << arg << "\"" << endl;
    433                 #endif // __DEBUG_H__
    434414                if ( prefix( arg, "-" ) ) {
    435415                        // strip inappropriate flags
     
    476456        #ifdef __DEBUG_H__
    477457        cerr << "args:";
    478         for ( i = 1; i < nargs; i += 1 ) {
     458        for ( int i = 1; i < nargs; i += 1 ) {
    479459                cerr << " " << args[i];
    480460        } // for
     
    492472        #ifdef __DEBUG_H__
    493473        cerr << "stage2 nargs: " << nargs << endl;
    494         for ( i = 0; args[i] != NULL; i += 1 ) {
     474        for ( int i = 0; args[i] != NULL; i += 1 ) {
    495475                cerr << args[i] << " ";
    496476        } // for
     
    506486int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
    507487        #ifdef __DEBUG_H__
    508         for ( int i = 0; env[i] != NULL; i += 1 ) {
     488        for ( int int i = 0; env[i] != NULL; i += 1 ) {
    509489                cerr << env[i] << endl;
    510490        } // for
Note: See TracChangeset for help on using the changeset viewer.