Changeset bbb1b35 for driver/cfa.cc
- Timestamp:
- Aug 23, 2019, 5:39:48 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 330d933
- Parents:
- ef22ad6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
driver/cfa.cc
ref22ad6 rbbb1b35 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 22 22:29:50201913 // Update Count : 4 0312 // Last Modified On : Fri Aug 23 16:27:07 2019 13 // Update Count : 411 14 14 // 15 15 … … 39 39 static int flags = 0; // environment variables must have unique names 40 40 41 if ( putenv( (char *)( *new string( string( "__CFA_FLAG" + to_string( flags++ ) + "__=" ) + arg ) ).c_str() ) != 0) {41 if ( putenv( (char *)( *new string( string( "__CFA_FLAG" + to_string( flags++ ) + "__=" ) + arg ) ).c_str() ) ) { 42 42 cerr << argv[0] << " error, cannot set environment variable." << endl; 43 43 exit( EXIT_FAILURE ); … … 89 89 90 90 bool x_flag = false; // -x flag 91 bool nonoptarg = false; // indicates non-option argument specified92 bool link = true; // link ing as well as compiling91 bool nonoptarg = false; // no non-option arguments specified, i.e., no file names 92 bool link = true; // link stage occurring 93 93 bool verbose = false; // -v flag 94 94 bool quiet = false; // -quiet flag … … 103 103 bool m32 = false; // -m32 flag 104 104 bool m64 = false; // -m64 flag 105 bool intree = false; 105 bool intree = false; // build in tree 106 106 int o_file = 0; // -o filename position 107 107 … … 176 176 debugging = true; // symbolic debugging required 177 177 args[nargs++] = argv[i]; // pass argument along 178 } else if ( arg == "-save-temps" ) { 179 args[nargs++] = argv[i]; // pass argument along 180 Putenv( argv, arg ); // save cfa-cpp output 178 181 } else if ( prefix( arg, "-x" ) ) { // file suffix ? 179 182 string lang; … … 258 261 #endif // __DEBUG_H__ 259 262 260 // if ( cpp_flag && CFA_flag ) { 261 // cerr << argv[0] << " error, cannot use -E and -CFA flags together." << endl; 262 // exit( EXIT_FAILURE ); 263 // } // if 263 // -E flag stops at cc1 stage 1, so cfa-cpp in cc1 stage 2 is never executed. 264 if ( cpp_flag && CFA_flag ) { 265 cerr << argv[0] << " error, cannot use -E and -CFA flags together." << endl; 266 exit( EXIT_FAILURE ); 267 } // if 264 268 265 269 // add the CFA include-library paths, which allow direct access to header files without directory qualification … … 292 296 } // if 293 297 294 string arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);298 string arch( m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU) ); 295 299 if ( ! m32 && ! m64 ) { 296 300 if ( arch == "x86" ) { … … 301 305 } // if 302 306 303 string libdir = libbase + arch + "-" + (nolib ? "nolib" : (debug ? "debug": "nodebug"));307 string libdir( libbase + arch + "-" + (nolib ? "nolib" : (debug ? "debug": "nodebug")) ); 304 308 if ( ! dirExists( libdir ) ) { 305 309 cerr << argv[0] << " internal error, cannot find prelude directory " << libdir << endl; … … 350 354 Putenv( argv, "-N" ); 351 355 Putenv( argv, "-CFA" ); 356 // -CFA implies cc1 stage 2, but gcc does not pass the -o file to this stage because it believe the file is for 357 // the linker. Hence, the -o file is explicit passed to cc1 stage 2 and used as cfa-cpp's output file. 352 358 if ( o_file ) Putenv( argv, string( "-o=" ) + argv[o_file] ); 353 359 } else { … … 401 407 } // if 402 408 403 args[nargs] = NULL;// terminate409 args[nargs] = nullptr; // terminate 404 410 405 411 #ifdef __DEBUG_H__ 406 412 cerr << "nargs: " << nargs << endl; 407 413 cerr << "args:" << endl; 408 for ( int i = 0; args[i] != NULL; i += 1 ) {414 for ( int i = 0; args[i] != nullptr; i += 1 ) { 409 415 cerr << " \"" << args[i] << "\"" << endl; 410 416 } // for … … 428 434 if ( argc == 2 ) exit( EXIT_SUCCESS ); // if only the -v flag is specified, do not invoke gcc 429 435 430 for ( int i = 0; args[i] != NULL; i += 1 ) {436 for ( int i = 0; args[i] != nullptr; i += 1 ) { 431 437 cerr << args[i] << " "; 432 438 } // for
Note: See TracChangeset
for help on using the changeset viewer.