Changeset cde3891 for driver/cfa.cc
- Timestamp:
- Jan 23, 2019, 4:52:16 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- a200795
- Parents:
- 9b086ca (diff), 1d832f4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
driver/cfa.cc (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
driver/cfa.cc
r9b086ca rcde3891 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 23 15:41:55 201813 // Update Count : 2 7012 // Last Modified On : Tue Jan 15 20:56:03 2019 13 // Update Count : 280 14 14 // 15 15 … … 43 43 const string suffixes[NumSuffixes] = { "cfa", "hfa", }; 44 44 45 voidsuffix( string arg, const char * args[], int & nargs ) {45 bool suffix( string arg, const char * args[], int & nargs ) { 46 46 //std::cerr << arg << std::endl; 47 47 size_t dot = arg.find_last_of( "." ); 48 48 //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl; 49 if ( dot == string::npos ) return ;49 if ( dot == string::npos ) return false; 50 50 string sx = arg.substr( dot + 1 ); 51 51 for ( int i = 0; i < NumSuffixes; i += 1 ) { … … 55 55 args[nargs] = "c"; 56 56 nargs += 1; 57 return ;57 return true; 58 58 } // if 59 59 } // for 60 return false; 60 61 } // suffix 61 62 … … 113 114 bool std_flag = false; // -std= flag 114 115 bool noincstd_flag = false; // -no-include-stdhdr= flag 115 bool xflag = false; // user supplied -x flag116 116 bool debugging __attribute(( unused )) = false; // -g flag 117 117 bool m32 = false; // -m32 flag … … 128 128 #ifdef __DEBUG_H__ 129 129 cerr << "CFA:" << endl; 130 for ( int i = 1; i < argc; i += 1 ) { 131 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 132 } // for 130 133 #endif // __DEBUG_H__ 131 134 … … 133 136 134 137 for ( int i = 1; i < argc; i += 1 ) { 135 #ifdef __DEBUG_H__136 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;137 #endif // __DEBUG_H__138 138 arg = argv[i]; // convert to string value 139 #ifdef __DEBUG_H__140 cerr << "arg:\"" << arg << "\"" << endl;141 #endif // __DEBUG_H__142 139 if ( prefix( arg, "-" ) ) { 143 140 // pass through arguments … … 202 199 args[nargs] = argv[i]; // pass the argument along 203 200 nargs += 1; 204 } else if ( arg == "-x" ) {205 xflag = true;206 args[nargs] = argv[i]; // pass the argument along207 nargs += 1;208 i += 1; // advance to argument209 args[nargs] = argv[i]; // pass the argument along210 nargs += 1;211 // args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x212 // nargs += 1;213 } else if ( prefix( arg, "-x" ) ) {214 xflag = true;215 args[nargs] = argv[i]; // pass the argument along216 nargs += 1;217 // args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x218 // nargs += 1;219 201 } else if ( arg == "-w" ) { 220 202 args[nargs] = argv[i]; // pass the argument along … … 298 280 } // if 299 281 } else { 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]; 309 nargs += 1; 310 if ( opt ) { 282 bool cfa = suffix( arg, args, nargs ); // check suffix 283 args[nargs] = argv[i]; // concatenate file 284 nargs += 1; 285 if ( cfa ) { 311 286 args[nargs] = "-x"; 312 287 nargs += 1; 313 288 args[nargs] = "none"; 314 289 nargs += 1; 315 // args[nargs] = ( *new string( string("-D__GCC_X__=none") ) ).c_str(); // add the argument for -x316 // nargs += 1;317 290 } // if 318 291 nonoptarg = true; 319 xflag = false;320 292 } // if 321 293 } // for 294 295 args[nargs] = "-x"; // turn off language 296 nargs += 1; 297 args[nargs] = "none"; 298 nargs += 1; 322 299 323 300 #ifdef __x86_64__ … … 380 357 381 358 string arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU); 382 if ( ! m32 && ! m64 && arch == "x86" ) { // no override and 32-bit architecture 383 args[nargs] = "-m32"; 384 nargs += 1; 359 if ( ! m32 && ! m64 ) { 360 if ( arch == "x86" ) { 361 args[nargs] = "-m32"; 362 nargs += 1; 363 } else if ( arch == "x64" ) { 364 args[nargs] = "-m64"; 365 nargs += 1; 366 } // if 385 367 } // if 386 368 const char * config = debug ? "debug": "nodebug"; … … 402 384 nargs += 1; 403 385 386 for ( int i = 0; i < nlibs; i += 1 ) { // copy non-user libraries after all user libraries 387 args[nargs] = libs[i]; 388 nargs += 1; 389 } // for 390 404 391 if ( link ) { 405 392 args[nargs] = "-Xlinker"; … … 421 408 422 409 // include the cfa library in case it's needed 423 args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src" : "")) ).c_str(); 410 args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src/.libs" : "")) ).c_str(); 411 nargs += 1; 412 args[nargs] = ( *new string( string("-Wl,-rpath," ) + libdir + (intree ? "/src/.libs" : "")) ).c_str(); 424 413 nargs += 1; 425 414 args[nargs] = "-lcfa"; … … 430 419 nargs += 1; 431 420 args[nargs] = "-lrt"; 421 nargs += 1; 422 args[nargs] = "-lm"; 432 423 nargs += 1; 433 424 } // if … … 514 505 args[nargs] = ( *new string( string("-B") + Bprefix ) ).c_str(); 515 506 nargs += 1; 516 args[nargs] = "-lm";517 nargs += 1;518 507 } else { 519 508 cerr << argv[0] << " error, compiler \"" << compiler_name << "\" unsupported." << endl; 520 509 exit( EXIT_FAILURE ); 521 510 } // if 522 523 for ( int i = 0; i < nlibs; i += 1 ) { // copy non-user libraries after all user libraries524 args[nargs] = libs[i];525 nargs += 1;526 } // for527 511 528 512 args[nargs] = NULL; // terminate with NULL
Note:
See TracChangeset
for help on using the changeset viewer.