Changeset 794db28 for driver/cc1.cc


Ignore:
Timestamp:
Aug 18, 2020, 11:35:50 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
93526ef
Parents:
d2b5d2d (diff), 36de20d (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • driver/cc1.cc

    rd2b5d2d r794db28  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 13 21:03:15 2020
    13 // Update Count     : 407
     12// Last Modified On : Sun Aug 16 21:03:02 2020
     13// Update Count     : 413
    1414//
    1515
     
    2424#include <unistd.h>                                                                             // execvp, fork, unlink
    2525#include <sys/wait.h>                                                                   // wait
    26 #include <fcntl.h>
     26#include <fcntl.h>                                                                              // creat
    2727
    2828
     
    5959
    6060
    61 static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );               // "N__=" suffix
     61static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );               // "__CFA_FLAG__=" suffix
    6262
    6363static void checkEnv1( const char * args[], int & nargs ) { // stage 1
     
    111111} // checkEnv2
    112112
    113 
    114 static char tmpname[] = P_tmpdir "/CFAXXXXXX.ifa";
     113#define CFA_SUFFIX ".ifa"
     114
     115static char tmpname[] = P_tmpdir "/CFAXXXXXX" CFA_SUFFIX;
    115116static int tmpfilefd = -1;
    116117static bool startrm = false;
     
    321322
    322323        if ( WIFSIGNALED(code) ) {                                                      // child failed ?
     324                rmtmpfile();                                                                    // remove tmpname
    323325                cerr << "CC1 Translator error: stage 1, child failed " << WTERMSIG(code) << endl;
    324326                exit( EXIT_FAILURE );
    325327        } // if
    326328
    327         exit( WEXITSTATUS(code) );                                                      // bad cpp result stops top-level gcc
     329        exit( WEXITSTATUS( code ) );                                            // bad cpp result stops top-level gcc
    328330} // Stage1
    329331
     
    373375                        } else if ( arg == "-fno-diagnostics-color" ) {
    374376                                color_arg = Color_Auto;
    375                         }
     377                        } // if
    376378
    377379                        if ( arg == "-quiet" || arg == "-version" || arg == "-fpreprocessed" ||
    378                                 // Currently CFA does not suppose precompiled .h files.
    379                                 prefix( arg, "--output-pch" ) ) {
     380                                 // Currently CFA does not suppose precompiled .h files.
     381                                 prefix( arg, "--output-pch" ) ) {
    380382
    381383                                // strip inappropriate flags with an argument
     
    441443                        } // if
    442444
    443                         cfa_cpp_out = cfa_cpp_out.substr( 0, dot ) + ".ifa";
     445                        cfa_cpp_out = cfa_cpp_out.substr( 0, dot ) + CFA_SUFFIX;
    444446                        if ( creat( cfa_cpp_out.c_str(), 0666 ) == -1 ) {
    445447                                perror( "CC1 Translator error: stage 2, creat" );
     
    462464        // output.  Otherwise, run the cfa-cpp preprocessor on the temporary file and save the result into the output file.
    463465
    464         if ( fork() == 0 ) {                                                            // child runs CFA
     466        if ( fork() == 0 ) {                                                            // child runs CFA preprocessor
    465467                cargs[0] = ( *new string( bprefix + "cfa-cpp" ) ).c_str();
    466468                cargs[ncargs++] = cpp_in;
     
    520522        #endif // __DEBUG_H__
    521523
    522         if ( fork() == 0 ) {                                                            // child runs CFA
     524        if ( fork() == 0 ) {                                                            // child runs gcc
    523525                args[0] = compiler_path.c_str();
    524526                args[nargs++] = "-S";                                                   // only compile and put assembler output in specified file
Note: See TracChangeset for help on using the changeset viewer.