Changeset cdbab55 for driver/cfa.cc
- Timestamp:
- Aug 21, 2018, 2:24:29 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 2a6292d
- Parents:
- 2b79a70 (diff), efa8b6af (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 moved
-
driver/cfa.cc (moved) (moved from src/driver/cfa.cc ) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
driver/cfa.cc
r2b79a70 rcdbab55 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 : 25 812 // Last Modified On : Fri Aug 10 18:17:58 2018 13 // Update Count : 259 14 14 // 15 15 … … 20 20 #include <string> // STL version 21 21 #include <string.h> // strcmp 22 23 #include <sys/types.h> 24 #include <sys/stat.h> 22 25 23 26 #include "Common/SemanticError.h" … … 66 69 } // shuffle 67 70 71 static inline bool dirExists(const string & path) { 72 struct stat info; 73 if(stat( path.c_str(), &info ) != 0) 74 return false; 75 else if(info.st_mode & S_IFDIR) 76 return true; 77 else 78 return false; 79 } //dirExists 80 68 81 69 82 #define str(s) #s … … 73 86 string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) ); 74 87 75 string installincdir( CFA_INCDIR ); // fixed location of include files 76 string installlibdir( CFA_LIBDIR ); // fixed location of cc1 and cfa-cpp commands 88 string installincdir( CFA_INCDIR ); // fixed location of include files 89 string installlibdir( CFA_LIBDIR ); // fixed location of cc1 and cfa-cpp commands when installed 90 string srcdriverdir ( TOP_BUILDDIR "driver"); // fixed location of cc1 and cfa-cpp commands when in tree 77 91 78 92 string heading; // banner printed at start of cfa compilation … … 96 110 bool xflag = false; // user supplied -x flag 97 111 bool debugging __attribute(( unused )) = false; // -g flag 112 bool m32 = false; // -m32 flag 113 bool m64 = false; // -m64 flag 114 bool intree = false; 98 115 99 116 const char *args[argc + 100]; // cfa command line values, plus some space for additional flags … … 154 171 } else if ( arg == "-no-include-stdhdr" ) { 155 172 noincstd_flag = true; // strip the no-include-stdhdr flag 173 } else if ( arg == "-in-tree" ) { 174 intree = true; 156 175 } else if ( arg == "-compiler" ) { 157 176 // use the user specified compiler … … 258 277 libs[nlibs] = argv[i]; 259 278 nlibs += 1; 279 } else if ( arg == "-m32" ) { 280 m32 = true; 281 m64 = false; 282 args[nargs] = argv[i]; 283 nargs += 1; 284 } else if ( arg == "-m64" ) { 285 m64 = true; 286 m32 = false; 287 args[nargs] = argv[i]; 288 nargs += 1; 260 289 } else { 261 290 // concatenate any other arguments … … 309 338 310 339 // add the CFA include-library paths, which allow direct access to header files without directory qualification 311 args[nargs] = "-I" CFA_INCDIR; 312 nargs += 1; 313 if ( ! noincstd_flag ) { // do not use during build 314 args[nargs] = "-I" CFA_INCDIR "/stdhdr"; 315 nargs += 1; 316 } // if 317 args[nargs] = "-I" CFA_INCDIR "/concurrency"; 318 nargs += 1; 319 args[nargs] = "-I" CFA_INCDIR "/containers"; 320 nargs += 1; 321 322 #ifdef HAVE_LIBCFA 340 if( !intree ) { 341 args[nargs] = "-I" CFA_INCDIR; 342 nargs += 1; 343 if ( ! noincstd_flag ) { // do not use during build 344 args[nargs] = "-I" CFA_INCDIR "/stdhdr"; 345 nargs += 1; 346 } // if 347 args[nargs] = "-I" CFA_INCDIR "/concurrency"; 348 nargs += 1; 349 args[nargs] = "-I" CFA_INCDIR "/containers"; 350 nargs += 1; 351 } else { 352 args[nargs] = "-I" TOP_SRCDIR "libcfa/src"; 353 nargs += 1; 354 if ( ! noincstd_flag ) { // do not use during build 355 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr"; 356 nargs += 1; 357 } // if 358 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency"; 359 nargs += 1; 360 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/containers"; 361 nargs += 1; 362 } 363 364 // add stdbool to get defines for bool/true/false 365 args[nargs] = "-imacros"; 366 nargs += 1; 367 args[nargs] = "stdbool.h"; 368 nargs += 1; 369 370 string libbase; 371 if( !intree ) { 372 libbase = CFA_LIBDIR; 373 } else { 374 libbase = TOP_BUILDDIR "libcfa/"; 375 args[nargs] = "-D__CFA_FLAG__=-t"; 376 nargs += 1; 377 } 378 379 const char * const arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU); 380 const char * config = debug ? "debug": "nodebug"; 381 string libdir = libbase + arch + "-" + config; 382 if( !dirExists(libdir) ) { 383 cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl; 384 cerr << "Was looking for " << libdir << endl; 385 libdir = libbase + arch + "-" + "nolib"; 386 } 387 388 if( !dirExists(libdir) ) { 389 cerr << argv[0] << " internal error, cannot find prelude directory." << endl; 390 cerr << "Was looking for " << libdir << endl; 391 exit( EXIT_FAILURE ); 392 } 393 394 args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir + (intree ? "/prelude" : "")) ).c_str(); 395 nargs += 1; 396 323 397 if ( link ) { 324 #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 } // if329 #endif330 #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 } // if335 #endif336 337 398 args[nargs] = "-Xlinker"; 338 399 nargs += 1; … … 347 408 args[nargs] = "--undefined=__cfaabi_appready_startup"; 348 409 nargs += 1; 410 args[nargs] = "-Xlinker"; 411 nargs += 1; 412 args[nargs] = "--undefined=__cfaabi_dbg_record"; 413 nargs += 1; 349 414 350 415 // include the cfa library in case it's needed 351 args[nargs] = "-L" CFA_LIBDIR; 352 nargs += 1; 353 if ( debug ) { 354 args[nargs] = "-lcfa-d"; 355 } else { 356 args[nargs] = "-lcfa"; 357 } // if 416 args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src" : "")) ).c_str(); 417 nargs += 1; 418 args[nargs] = "-lcfa"; 358 419 nargs += 1; 359 420 args[nargs] = "-lpthread"; … … 364 425 nargs += 1; 365 426 } // if 366 #endif // HAVE_LIBCFA367 427 368 428 // Add exception flags (unconditionally) … … 410 470 411 471 if ( Bprefix.length() == 0 ) { 412 Bprefix = installlibdir;472 Bprefix = !intree ? installlibdir : srcdriverdir; 413 473 args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str(); 414 474 nargs += 1; 415 475 } // if 416 476 417 args[nargs] = "-Xlinker"; // used by backtrace418 nargs += 1;419 args[nargs] = "-export-dynamic";420 nargs += 1;477 args[nargs] = "-Xlinker"; // used by backtrace 478 nargs += 1; 479 args[nargs] = "-export-dynamic"; 480 nargs += 1; 421 481 422 482 // execute the compilation command
Note:
See TracChangeset
for help on using the changeset viewer.