Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • driver/cfa.cc

    rbec4d24 rdfb7c96  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep  3 16:47:59 2018
    13 // Update Count     : 275
     12// Last Modified On : Thu Aug 23 15:41:55 2018
     13// Update Count     : 270
    1414//
    1515
     
    4343const string suffixes[NumSuffixes] = { "cfa", "hfa", };
    4444
    45 bool suffix( string arg, const char * args[], int & nargs ) {
     45void suffix( string arg, const char * args[], int & nargs ) {
    4646        //std::cerr << arg << std::endl;
    4747        size_t dot = arg.find_last_of( "." );
    4848        //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
    49         if ( dot == string::npos ) return false;
     49        if ( dot == string::npos ) return;
    5050        string sx = arg.substr( dot + 1 );
    5151        for ( int i = 0; i < NumSuffixes; i += 1 ) {
     
    5555                        args[nargs] = "c";
    5656                        nargs += 1;
    57                         return true;
     57                        return;
    5858                } // if
    5959        } // for
    60         return false;
    6160} // suffix
    6261
     
    129128        #ifdef __DEBUG_H__
    130129        cerr << "CFA:" << endl;
     130        #endif // __DEBUG_H__
     131
     132        // process command-line arguments
     133
    131134        for ( int i = 1; i < argc; i += 1 ) {
    132             cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    133         } // for
    134         #endif // __DEBUG_H__
    135 
    136         // process command-line arguments
    137 
    138         for ( int i = 1; i < argc; i += 1 ) {
     135                #ifdef __DEBUG_H__
     136                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
     137                #endif // __DEBUG_H__
    139138                arg = argv[i];                                                                  // convert to string value
     139                #ifdef __DEBUG_H__
     140                cerr << "arg:\"" << arg << "\"" << endl;
     141                #endif // __DEBUG_H__
    140142                if ( prefix( arg, "-" ) ) {
    141143                        // pass through arguments
     
    200202                                args[nargs] = argv[i];                                  // pass the argument along
    201203                                nargs += 1;
     204                        } else if ( arg == "-x" ) {
     205                                xflag = true;
     206                                args[nargs] = argv[i];                                  // pass the argument along
     207                                nargs += 1;
     208                                i += 1;                                                                 // advance to argument
     209                                args[nargs] = argv[i];                                  // pass the argument along
     210                                nargs += 1;
     211                                // args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x
     212                                // nargs += 1;
     213                        } else if ( prefix( arg, "-x" ) ) {
     214                                xflag = true;
     215                                args[nargs] = argv[i];                                  // pass the argument along
     216                                nargs += 1;
     217                                // args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x
     218                                // nargs += 1;
    202219                        } else if ( arg == "-w" ) {
    203220                                args[nargs] = argv[i];                                  // pass the argument along
     
    281298                        } // if
    282299                } else {
    283                         bool cfa = suffix( arg, args, nargs );          // check suffix
    284                         args[nargs] = argv[i];                                          // concatenate file
     300                        bool opt = false;
     301                        if ( ! xflag ) {
     302                                suffix( arg, args, nargs );                             // check suffix
     303                                // args[nargs] = ( *new string( string("-D__GCC_X__=c") ) ).c_str(); // add the argument for -x
     304                                // nargs += 1;
     305                                opt = true;
     306                        } // if
     307                        // concatenate other arguments
     308                        args[nargs] = argv[i];
    285309                        nargs += 1;
    286                         if ( cfa ) {
     310                        if ( opt ) {
    287311                                args[nargs] = "-x";
    288312                                nargs += 1;
    289313                                args[nargs] = "none";
    290314                                nargs += 1;
     315                                // args[nargs] = ( *new string( string("-D__GCC_X__=none") ) ).c_str(); // add the argument for -x
     316                                // nargs += 1;
    291317                        } // if
    292318                        nonoptarg = true;
     
    294320                } // if
    295321        } // for
    296 
    297     args[nargs] = "-x";                                 // turn off language
    298     nargs += 1;
    299     args[nargs] = "none";
    300     nargs += 1;
    301322
    302323        #ifdef __x86_64__
Note: See TracChangeset for help on using the changeset viewer.