Changes in src/driver/cfa.cc [157d094:dffaeac]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/driver/cfa.cc
r157d094 rdffaeac 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 14 14:16:33201813 // Update Count : 2 4412 // Last Modified On : Fri Jul 13 17:40:12 2018 13 // Update Count : 258 14 14 // 15 15 … … 37 37 } // prefix 38 38 39 enum { NumSuffixes = 2 }; 40 const string suffixes[NumSuffixes] = { "cfa", "hfa", }; 41 42 bool suffix( string arg ) { 43 //std::cerr << arg << std::endl; 44 size_t dot = arg.find_last_of( "." ); 45 //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl; 46 if ( dot == string::npos ) return false; 47 string sx = arg.substr( dot + 1 ); 48 for ( int i = 0; i < NumSuffixes; i += 1 ) { 49 if ( sx == suffixes[i] ) return true; 50 } // for 51 return false; 52 } // suffix 53 39 54 40 55 void shuffle( const char *args[], int S, int E, int N ) { 41 56 // S & E index 1 passed the end so adjust with -1 42 #ifdef __DEBUG_H__57 #ifdef __DEBUG_H__ 43 58 cerr << "shuffle:" << S << " " << E << " " << N << endl; 44 #endif // __DEBUG_H__59 #endif // __DEBUG_H__ 45 60 for ( int j = E-1 + N; j > S-1 + N; j -=1 ) { 46 #ifdef __DEBUG_H__61 #ifdef __DEBUG_H__ 47 62 cerr << "\t" << j << " " << j-N << endl; 48 #endif // __DEBUG_H__63 #endif // __DEBUG_H__ 49 64 args[j] = args[j-N]; 50 65 } // for … … 79 94 bool std_flag = false; // -std= flag 80 95 bool noincstd_flag = false; // -no-include-stdhdr= flag 96 bool xflag = false; // user supplied -x flag 81 97 bool debugging __attribute(( unused )) = false; // -g flag 82 98 … … 88 104 int nlibs = 0; 89 105 90 #ifdef __DEBUG_H__106 #ifdef __DEBUG_H__ 91 107 cerr << "CFA:" << endl; 92 #endif // __DEBUG_H__108 #endif // __DEBUG_H__ 93 109 94 110 // process command-line arguments 95 111 96 112 for ( int i = 1; i < argc; i += 1 ) { 97 #ifdef __DEBUG_H__113 #ifdef __DEBUG_H__ 98 114 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 99 #endif // __DEBUG_H__115 #endif // __DEBUG_H__ 100 116 arg = argv[i]; // convert to string value 101 #ifdef __DEBUG_H__117 #ifdef __DEBUG_H__ 102 118 cerr << "arg:\"" << arg << "\"" << endl; 103 #endif // __DEBUG_H__119 #endif // __DEBUG_H__ 104 120 if ( prefix( arg, "-" ) ) { 105 121 // pass through arguments … … 162 178 args[nargs] = argv[i]; // pass the argument along 163 179 nargs += 1; 164 } else if ( arg == "-x" ) { // lost so force along 180 } else if ( arg == "-x" ) { 181 xflag = true; 165 182 args[nargs] = argv[i]; // pass the argument along 166 183 nargs += 1; … … 168 185 args[nargs] = argv[i]; // pass the argument along 169 186 nargs += 1; 170 args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x 171 nargs += 1; 172 } else if ( prefix( arg, "-x" ) ) { // lost so force along 173 args[nargs] = argv[i]; // pass the argument along 174 nargs += 1; 175 args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x 176 nargs += 1; 187 // args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x 188 // nargs += 1; 189 } else if ( prefix( arg, "-x" ) ) { 190 xflag = true; 191 args[nargs] = argv[i]; // pass the argument along 192 nargs += 1; 193 // args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x 194 // nargs += 1; 177 195 } else if ( arg == "-w" ) { 178 196 args[nargs] = argv[i]; // pass the argument along … … 246 264 } // if 247 265 } else { 266 bool opt = false; 267 if ( ! xflag && suffix( arg ) ) { 268 args[nargs] = "-x"; 269 nargs += 1; 270 args[nargs] = "c"; 271 nargs += 1; 272 // args[nargs] = ( *new string( string("-D__GCC_X__=c") ) ).c_str(); // add the argument for -x 273 // nargs += 1; 274 opt = true; 275 } // if 248 276 // concatenate other arguments 249 277 args[nargs] = argv[i]; 250 278 nargs += 1; 279 if ( opt ) { 280 args[nargs] = "-x"; 281 nargs += 1; 282 args[nargs] = "none"; 283 nargs += 1; 284 // args[nargs] = ( *new string( string("-D__GCC_X__=none") ) ).c_str(); // add the argument for -x 285 // nargs += 1; 286 } // if 251 287 nonoptarg = true; 288 xflag = false; 252 289 } // if 253 290 } // for 254 291 255 #ifdef __x86_64__292 #ifdef __x86_64__ 256 293 args[nargs] = "-mcx16"; // allow double-wide CAA 257 294 nargs += 1; 258 #endif // __x86_64__259 260 #ifdef __DEBUG_H__295 #endif // __x86_64__ 296 297 #ifdef __DEBUG_H__ 261 298 cerr << "args:"; 262 299 for ( int i = 1; i < nargs; i += 1 ) { … … 264 301 } // for 265 302 cerr << endl; 266 #endif // __DEBUG_H__303 #endif // __DEBUG_H__ 267 304 268 305 if ( cpp_flag && CFA_flag ) { … … 283 320 nargs += 1; 284 321 285 #ifdef HAVE_LIBCFA322 #ifdef HAVE_LIBCFA 286 323 if ( link ) { 287 324 #if ! defined(HAVE_LIBCFA_RELEASE) 288 289 290 291 325 if ( ! debug ) { 326 cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl; 327 exit( EXIT_FAILURE ); 328 } // if 292 329 #endif 293 330 #if ! defined(HAVE_LIBCFA_DEBUG) 294 295 296 297 331 if ( debug ) { 332 cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl; 333 exit( EXIT_FAILURE ); 334 } // if 298 335 #endif 299 336 … … 323 360 nargs += 1; 324 361 } // if 325 #endif // HAVE_LIBCFA362 #endif // HAVE_LIBCFA 326 363 327 364 // Add exception flags (unconditionally) … … 419 456 args[nargs] = NULL; // terminate with NULL 420 457 421 #ifdef __DEBUG_H__458 #ifdef __DEBUG_H__ 422 459 cerr << "nargs: " << nargs << endl; 423 460 cerr << "args:" << endl; … … 425 462 cerr << " \"" << args[i] << "\"" << endl; 426 463 } // for 427 #endif // __DEBUG_H__464 #endif // __DEBUG_H__ 428 465 429 466 if ( ! quiet ) {
Note: See TracChangeset
for help on using the changeset viewer.