Changeset 0163d3e for driver


Ignore:
Timestamp:
May 30, 2020, 6:30:39 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
cb95634
Parents:
a491a3c
Message:

make -x flag work for one input file

Location:
driver
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • driver/cc1.cc

    ra491a3c r0163d3e  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Oct 20 08:14:33 2019
    13 // Update Count     : 385
     12// Last Modified On : Sat May 30 18:09:05 2020
     13// Update Count     : 404
    1414//
    1515
     
    3838static string o_file;
    3939static string bprefix;
     40static string lang;                                                                             // -x flag
    4041
    4142
     
    7374                        if ( prefix( val, "-compiler=" ) ) {
    7475                                compiler_path = val.substr( 10 );
     76                        } else if ( prefix( val, "-x=" ) ) {
     77                                lang = val.substr( 3 );
    7578                        } // if
    7679                } // if
     
    100103                        } else if ( prefix( val, "-B=" ) ) {            // location of cfa-cpp
    101104                                bprefix = val.substr( 3 );
     105                        } else if ( prefix( val, "-x=" ) ) {            // ignore
    102106                        } else {                                                                        // normal flag for cfa-cpp
    103107                                args[nargs++] = ( *new string( arg.substr( arg.find_first_of( "=" ) + 1 ) ) ).c_str();
     
    247251
    248252                args[0] = compiler_path.c_str();
    249                 suffix( cpp_in, args, nargs );                                  // check suffix
     253                if ( lang.size() == 0 ) {
     254                        suffix( cpp_in, args, nargs );                          // check suffix
     255                } else {
     256                        args[nargs++] = "-x";
     257                        args[nargs++] = ( *new string( lang.c_str() ) ).c_str();
     258                } // if
    250259                args[nargs++] = cpp_in;
    251260                if ( o_flag ) {                                                                 // location for output
     
    280289
    281290                args[0] = compiler_path.c_str();
    282                 suffix( cpp_in, args, nargs );                                  // check suffix
     291                if ( lang.size() == 0 ) {
     292                        suffix( cpp_in, args, nargs );                          // check suffix
     293                } else {
     294                        args[nargs++] = "-x";
     295                        args[nargs++] = ( *new string( lang.c_str() ) ).c_str();
     296                } // if
    283297                args[nargs++] = cpp_in;                                                 // input to cpp
    284298                args[nargs] = nullptr;                                                  // terminate argument list
  • driver/cfa.cc

    ra491a3c r0163d3e  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 21:50:54 2020
    13 // Update Count     : 425
     12// Last Modified On : Sat May 30 18:28:23 2020
     13// Update Count     : 433
    1414//
    1515
     
    243243                                        lang = arg.substr( 2 );
    244244                                } // if
    245                                 x_flag = lang != "none";
     245                                if ( x_flag ) {
     246                                        cerr << argv[0] << " warning, only one -x flag per compile, ignoring subsequent flag." << endl;
     247                                } else {
     248                                        x_flag = true;
     249                                        Putenv( argv, string( "-x=" ) + lang );
     250                                } // if
    246251                        } else if ( prefix( arg, "-std=" ) || prefix( arg, "--std=" ) ) {
    247252                                std_flag = true;                                                // -std=XX provided
Note: See TracChangeset for help on using the changeset viewer.