Changes in src/driver/cfa.cc [dffaeac:157d094]
- File:
-
- 1 edited
-
src/driver/cfa.cc (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/driver/cfa.cc
rdffaeac r157d094 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 13 17:40:12201813 // Update Count : 2 5812 // Last Modified On : Mon May 14 14:16:33 2018 13 // Update Count : 244 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 } // for51 return false;52 } // suffix53 54 39 55 40 void shuffle( const char *args[], int S, int E, int N ) { 56 41 // S & E index 1 passed the end so adjust with -1 57 #ifdef __DEBUG_H__42 #ifdef __DEBUG_H__ 58 43 cerr << "shuffle:" << S << " " << E << " " << N << endl; 59 #endif // __DEBUG_H__44 #endif // __DEBUG_H__ 60 45 for ( int j = E-1 + N; j > S-1 + N; j -=1 ) { 61 #ifdef __DEBUG_H__46 #ifdef __DEBUG_H__ 62 47 cerr << "\t" << j << " " << j-N << endl; 63 #endif // __DEBUG_H__48 #endif // __DEBUG_H__ 64 49 args[j] = args[j-N]; 65 50 } // for … … 94 79 bool std_flag = false; // -std= flag 95 80 bool noincstd_flag = false; // -no-include-stdhdr= flag 96 bool xflag = false; // user supplied -x flag97 81 bool debugging __attribute(( unused )) = false; // -g flag 98 82 … … 104 88 int nlibs = 0; 105 89 106 #ifdef __DEBUG_H__90 #ifdef __DEBUG_H__ 107 91 cerr << "CFA:" << endl; 108 #endif // __DEBUG_H__92 #endif // __DEBUG_H__ 109 93 110 94 // process command-line arguments 111 95 112 96 for ( int i = 1; i < argc; i += 1 ) { 113 #ifdef __DEBUG_H__97 #ifdef __DEBUG_H__ 114 98 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 115 #endif // __DEBUG_H__99 #endif // __DEBUG_H__ 116 100 arg = argv[i]; // convert to string value 117 #ifdef __DEBUG_H__101 #ifdef __DEBUG_H__ 118 102 cerr << "arg:\"" << arg << "\"" << endl; 119 #endif // __DEBUG_H__103 #endif // __DEBUG_H__ 120 104 if ( prefix( arg, "-" ) ) { 121 105 // pass through arguments … … 178 162 args[nargs] = argv[i]; // pass the argument along 179 163 nargs += 1; 180 } else if ( arg == "-x" ) { 181 xflag = true; 164 } else if ( arg == "-x" ) { // lost so force along 182 165 args[nargs] = argv[i]; // pass the argument along 183 166 nargs += 1; … … 185 168 args[nargs] = argv[i]; // pass the argument along 186 169 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; 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; 195 177 } else if ( arg == "-w" ) { 196 178 args[nargs] = argv[i]; // pass the argument along … … 264 246 } // if 265 247 } 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 -x273 // nargs += 1;274 opt = true;275 } // if276 248 // concatenate other arguments 277 249 args[nargs] = argv[i]; 278 250 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 -x285 // nargs += 1;286 } // if287 251 nonoptarg = true; 288 xflag = false;289 252 } // if 290 253 } // for 291 254 292 #ifdef __x86_64__255 #ifdef __x86_64__ 293 256 args[nargs] = "-mcx16"; // allow double-wide CAA 294 257 nargs += 1; 295 #endif // __x86_64__296 297 #ifdef __DEBUG_H__258 #endif // __x86_64__ 259 260 #ifdef __DEBUG_H__ 298 261 cerr << "args:"; 299 262 for ( int i = 1; i < nargs; i += 1 ) { … … 301 264 } // for 302 265 cerr << endl; 303 #endif // __DEBUG_H__266 #endif // __DEBUG_H__ 304 267 305 268 if ( cpp_flag && CFA_flag ) { … … 320 283 nargs += 1; 321 284 322 #ifdef HAVE_LIBCFA285 #ifdef HAVE_LIBCFA 323 286 if ( link ) { 324 287 #if ! defined(HAVE_LIBCFA_RELEASE) 325 if ( ! debug ) {326 cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;327 exit( EXIT_FAILURE );328 } // if288 if ( ! debug ) { 289 cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl; 290 exit( EXIT_FAILURE ); 291 } // if 329 292 #endif 330 293 #if ! defined(HAVE_LIBCFA_DEBUG) 331 if ( debug ) {332 cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;333 exit( EXIT_FAILURE );334 } // if294 if ( debug ) { 295 cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl; 296 exit( EXIT_FAILURE ); 297 } // if 335 298 #endif 336 299 … … 360 323 nargs += 1; 361 324 } // if 362 #endif // HAVE_LIBCFA325 #endif // HAVE_LIBCFA 363 326 364 327 // Add exception flags (unconditionally) … … 456 419 args[nargs] = NULL; // terminate with NULL 457 420 458 #ifdef __DEBUG_H__421 #ifdef __DEBUG_H__ 459 422 cerr << "nargs: " << nargs << endl; 460 423 cerr << "args:" << endl; … … 462 425 cerr << " \"" << args[i] << "\"" << endl; 463 426 } // for 464 #endif // __DEBUG_H__427 #endif // __DEBUG_H__ 465 428 466 429 if ( ! quiet ) {
Note:
See TracChangeset
for help on using the changeset viewer.