Changeset 7b937575
- Timestamp:
- May 4, 2016, 11:34:11 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 4acc87f, cb4c607
- Parents:
- 7937abf
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/driver/cc1.cc
r7937abf r7b937575 10 10 // Created On : Fri Aug 26 14:23:51 2005 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 25 16:05:15201613 // Update Count : 5612 // Last Modified On : Wed May 4 23:29:19 2016 13 // Update Count : 74 14 14 // 15 15 … … 108 108 const char *args[argc + 100]; // leave space for 100 additional cpp command line values 109 109 int nargs = 1; // number of arguments in args list; 0 => command name 110 const char * uargs[20]; // leave space for 20 additional cfa-cpp command line values111 int n uargs = 1; // 0 => command name110 const char *cargs[20]; // leave space for 20 additional cfa-cpp command line values 111 int ncargs = 1; // 0 => command name 112 112 113 113 signal( SIGINT, sigTermHandler ); 114 114 signal( SIGTERM, sigTermHandler ); 115 116 #ifdef __DEBUG_H__ 117 cerr << "Stage1" << endl; 118 #endif // __DEBUG_H__ 115 119 116 120 // process all the arguments … … 153 157 CFA_flag = true; 154 158 } else if ( prefix( arg, D__CFA_FLAGPREFIX__ ) ) { 155 uargs[nuargs] = ( *new string( arg.substr( D__CFA_FLAGPREFIX__.size() ) ) ).c_str();156 n uargs += 1;159 cargs[ncargs] = ( *new string( arg.substr( D__CFA_FLAGPREFIX__.size() ) ) ).c_str(); 160 ncargs += 1; 157 161 } else if ( arg == "-D" && prefix( argv[i + 1], D__CFA_FLAGPREFIX__.substr(2) ) ) { 158 uargs[nuargs] = ( *new string( string( argv[i + 1] ).substr( D__CFA_FLAGPREFIX__.size() - 2 ) ) ).c_str();159 n uargs += 1;162 cargs[ncargs] = ( *new string( string( argv[i + 1] ).substr( D__CFA_FLAGPREFIX__.size() - 2 ) ) ).c_str(); 163 ncargs += 1; 160 164 i += 1; // and the argument 161 165 } else if ( prefix( arg, D__GCC_BPREFIX__ ) ) { … … 317 321 318 322 if ( fork() == 0 ) { // child runs CFA 319 uargs[0] = ( *new string( bprefix + "/cfa-cpp" ) ).c_str(); 320 321 uargs[nuargs] = tmpname; 322 nuargs += 1; 323 cargs[0] = ( *new string( bprefix + "/cfa-cpp" ) ).c_str(); 324 325 // Source file-name without suffix used to generate routine names containing external initializations for TU. 326 string filename( cpp_in ); 327 string::size_type posn = filename.find_last_of( "/" ); 328 if ( posn != string::npos ) { 329 filename = filename.substr( posn + 1 ); 330 } // if 331 posn = filename.find_last_of( "." ); 332 if ( posn != string::npos ) { 333 filename = filename.substr( 0, posn ); 334 } // if 335 cargs[ncargs] = ( *new string( "-F" ) ).c_str(); 336 ncargs += 1; 337 cargs[ncargs] = ( *new string( filename ) ).c_str(); 338 ncargs += 1; 339 340 cargs[ncargs] = tmpname; 341 ncargs += 1; 323 342 if ( o_name != NULL ) { 324 uargs[nuargs] = o_name;325 n uargs += 1;343 cargs[ncargs] = o_name; 344 ncargs += 1; 326 345 } else if ( ! CFA_flag ) { // run cfa-cpp ? 327 uargs[nuargs] = cpp_out;328 n uargs += 1;329 } // if 330 uargs[nuargs] = NULL; // terminate argument list331 332 #ifdef __DEBUG_H__ 333 cerr << "cfa-cpp n uargs: " << o_name << " " << CFA_flag << " " << nuargs << endl;334 for ( i = 0; uargs[i] != NULL; i += 1 ) {335 cerr << uargs[i] << " ";346 cargs[ncargs] = cpp_out; 347 ncargs += 1; 348 } // if 349 cargs[ncargs] = NULL; // terminate argument list 350 351 #ifdef __DEBUG_H__ 352 cerr << "cfa-cpp ncargs: " << o_name << " " << CFA_flag << " " << ncargs << endl; 353 for ( i = 0; cargs[i] != NULL; i += 1 ) { 354 cerr << cargs[i] << " "; 336 355 } // for 337 356 cerr << endl; 338 357 #endif // __DEBUG_H__ 339 358 340 execvp( uargs[0], (char * const *)uargs ); // should not return359 execvp( cargs[0], (char * const *)cargs ); // should not return 341 360 perror( "CFA Translator error: cpp level, execvp" ); 342 361 exit( EXIT_FAILURE ); … … 370 389 const char *args[argc + 100]; // leave space for 100 additional cfa command line values 371 390 int nargs = 1; // number of arguments in args list; 0 => command name 391 392 #ifdef __DEBUG_H__ 393 cerr << "Stage2" << endl; 394 #endif // __DEBUG_H__ 372 395 373 396 // process all the arguments … … 467 490 468 491 if ( arg == "-E" ) { 469 #ifdef __DEBUG_H__470 cerr << "Stage1" << endl;471 #endif // __DEBUG_H__472 492 Stage1( argc, argv ); 473 493 } else if ( arg == "-fpreprocessed" ) { 474 #ifdef __DEBUG_H__475 cerr << "Stage2" << endl;476 #endif // __DEBUG_H__477 494 Stage2( argc, argv ); 478 495 } else { -
src/main.cc
r7937abf r7b937575 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 27 22:20:20201613 // Update Count : 19912 // Last Modified On : Wed May 4 23:32:59 2016 13 // Update Count : 203 14 14 // 15 15 … … 97 97 std::ostream *output = &std::cout; 98 98 int long_index; 99 std::list< Declaration* > translationUnit; 99 std::list< Declaration * > translationUnit; 100 const char *filename = NULL;; 100 101 101 102 opterr = 0; // prevent getopt from printing error messages 102 103 103 104 int c; 104 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD: ", long_opts, &long_index )) != -1 ) {105 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:F:", long_opts, &long_index )) != -1 ) { 105 106 switch ( c ) { 106 107 case Ast: … … 162 163 break; 163 164 case 'D': // ignore -Dxxx 165 break; 166 case 'F': // source file-name without suffix 167 filename = optarg; 164 168 break; 165 169 case '?':
Note: See TracChangeset
for help on using the changeset viewer.