source: driver/cfa.cc@ 9fce933a

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr no_list persistent-indexer pthread-emulation qualifiedEnum
Last change on this file since 9fce933a was bec4d24, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

fix debug print, better handle -x language command-line flag

  • Property mode set to 100644
File size: 17.6 KB
RevLine 
[b87a5ed]1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
[76c7f65e]7// cfa.cc --
[b87a5ed]8//
[51b73452]9// Author : Peter A. Buhr
10// Created On : Tue Aug 20 13:44:49 2002
[201aeb9]11// Last Modified By : Peter A. Buhr
[bec4d24]12// Last Modified On : Mon Sep 3 16:47:59 2018
13// Update Count : 275
[b87a5ed]14//
[51b73452]15
16#include <iostream>
[b87a5ed]17#include <cstdio> // perror
18#include <cstdlib> // putenv, exit
19#include <unistd.h> // execvp
20#include <string> // STL version
[44bca7f]21#include <string.h> // strcmp
[51b73452]22
[37fe352]23#include <sys/types.h>
24#include <sys/stat.h>
25
[44bca7f]26#include "Common/SemanticError.h"
[b87a5ed]27#include "config.h" // configure info
[51b73452]28
29using std::cerr;
30using std::endl;
31using std::string;
[47a8d17]32using std::to_string;
[51b73452]33
34
35//#define __DEBUG_H__
36
37
38bool prefix( string arg, string pre ) {
[b87a5ed]39 return arg.substr( 0, pre.size() ) == pre;
[51b73452]40} // prefix
41
[dffaeac]42enum { NumSuffixes = 2 };
43const string suffixes[NumSuffixes] = { "cfa", "hfa", };
44
[bec4d24]45bool suffix( string arg, const char * args[], int & nargs ) {
[dffaeac]46 //std::cerr << arg << std::endl;
47 size_t dot = arg.find_last_of( "." );
48 //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
[bec4d24]49 if ( dot == string::npos ) return false;
[dffaeac]50 string sx = arg.substr( dot + 1 );
51 for ( int i = 0; i < NumSuffixes; i += 1 ) {
[b740f0b]52 if ( sx == suffixes[i] ) {
53 args[nargs] = "-x";
54 nargs += 1;
55 args[nargs] = "c";
56 nargs += 1;
[bec4d24]57 return true;
[b740f0b]58 } // if
[dffaeac]59 } // for
[bec4d24]60 return false;
[dffaeac]61} // suffix
62
[51b73452]63
64void shuffle( const char *args[], int S, int E, int N ) {
[b87a5ed]65 // S & E index 1 passed the end so adjust with -1
[dffaeac]66 #ifdef __DEBUG_H__
[b87a5ed]67 cerr << "shuffle:" << S << " " << E << " " << N << endl;
[dffaeac]68 #endif // __DEBUG_H__
[b87a5ed]69 for ( int j = E-1 + N; j > S-1 + N; j -=1 ) {
[dffaeac]70 #ifdef __DEBUG_H__
[b87a5ed]71 cerr << "\t" << j << " " << j-N << endl;
[dffaeac]72 #endif // __DEBUG_H__
[b87a5ed]73 args[j] = args[j-N];
74 } // for
[51b73452]75} // shuffle
76
[37fe352]77static inline bool dirExists(const string & path) {
78 struct stat info;
79 if(stat( path.c_str(), &info ) != 0)
80 return false;
81 else if(info.st_mode & S_IFDIR)
82 return true;
83 else
84 return false;
85} //dirExists
86
[51b73452]87
[4b1afb6]88#define str(s) #s
89
[51b73452]90int main( int argc, char *argv[] ) {
[4b1afb6]91 string Version( CFA_VERSION_LONG ); // current version number from CONFIG
92 string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) );
[51b73452]93
[d6f4488]94 string installincdir( CFA_INCDIR ); // fixed location of include files
95 string installlibdir( CFA_LIBDIR ); // fixed location of cc1 and cfa-cpp commands when installed
96 string srcdriverdir ( TOP_BUILDDIR "driver"); // fixed location of cc1 and cfa-cpp commands when in tree
[51b73452]97
[b87a5ed]98 string heading; // banner printed at start of cfa compilation
99 string arg; // current command-line argument during command-line parsing
100 string Bprefix; // path where gcc looks for compiler command steps
101 string langstd; // language standard
[51b73452]102
[e24f13a]103 string compiler_path( CFA_BACKEND_CC ); // path/name of C compiler
[b87a5ed]104 string compiler_name; // name of C compiler
[51b73452]105
[b87a5ed]106 bool nonoptarg = false; // indicates non-option argument specified
107 bool link = true; // linking as well as compiling
108 bool verbose = false; // -v flag
109 bool quiet = false; // -quiet flag
110 bool debug = true; // -debug flag
111 bool help = false; // -help flag
112 bool CFA_flag = false; // -CFA flag
113 bool cpp_flag = false; // -E or -M flag, preprocessor only
[de62360d]114 bool std_flag = false; // -std= flag
[d746bc8]115 bool noincstd_flag = false; // -no-include-stdhdr= flag
[dffaeac]116 bool xflag = false; // user supplied -x flag
[6e4b913]117 bool debugging __attribute(( unused )) = false; // -g flag
[37fe352]118 bool m32 = false; // -m32 flag
119 bool m64 = false; // -m64 flag
120 bool intree = false;
[51b73452]121
[b87a5ed]122 const char *args[argc + 100]; // cfa command line values, plus some space for additional flags
123 int sargs = 1; // starting location for arguments in args list
124 int nargs = sargs; // number of arguments in args list; 0 => command name
[51b73452]125
[b87a5ed]126 const char *libs[argc + 20]; // non-user libraries must come separately, plus some added libraries and flags
127 int nlibs = 0;
[51b73452]128
[dffaeac]129 #ifdef __DEBUG_H__
[b87a5ed]130 cerr << "CFA:" << endl;
[bec4d24]131 for ( int i = 1; i < argc; i += 1 ) {
132 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
133 } // for
[dffaeac]134 #endif // __DEBUG_H__
[51b73452]135
[b87a5ed]136 // process command-line arguments
[51b73452]137
[b87a5ed]138 for ( int i = 1; i < argc; i += 1 ) {
139 arg = argv[i]; // convert to string value
140 if ( prefix( arg, "-" ) ) {
141 // pass through arguments
142
143 if ( arg == "-Xlinker" || arg == "-o" ) {
144 args[nargs] = argv[i]; // pass the argument along
145 nargs += 1;
146 i += 1;
147 if ( i == argc ) continue; // next argument available ?
148 args[nargs] = argv[i]; // pass the argument along
149 nargs += 1;
150 } else if ( arg == "-XCFA" ) { // CFA pass through
151 i += 1;
152 args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + argv[i] ) ).c_str();
153 nargs += 1;
154
155 // CFA specific arguments
156
157 } else if ( arg == "-CFA" ) {
158 CFA_flag = true; // strip the -CFA flag
159 link = false;
160 args[nargs] = "-E"; // replace the argument with -E
161 nargs += 1;
162 } else if ( arg == "-debug" ) {
163 debug = true; // strip the debug flag
164 } else if ( arg == "-nodebug" ) {
165 debug = false; // strip the nodebug flag
166 } else if ( arg == "-quiet" ) {
167 quiet = true; // strip the quiet flag
168 } else if ( arg == "-noquiet" ) {
169 quiet = false; // strip the noquiet flag
170 } else if ( arg == "-help" ) {
171 help = true; // strip the help flag
172 } else if ( arg == "-nohelp" ) {
173 help = false; // strip the nohelp flag
[d746bc8]174 } else if ( arg == "-no-include-stdhdr" ) {
175 noincstd_flag = true; // strip the no-include-stdhdr flag
[37fe352]176 } else if ( arg == "-in-tree" ) {
177 intree = true;
[b87a5ed]178 } else if ( arg == "-compiler" ) {
179 // use the user specified compiler
180 i += 1;
181 if ( i == argc ) continue; // next argument available ?
182 compiler_path = argv[i];
[d6f4488]183 if ( putenv( (char *)( *new string( string( "__CFA_COMPILER__=" ) + argv[i]) ).c_str() ) != 0 ) {
[b87a5ed]184 cerr << argv[0] << " error, cannot set environment variable." << endl;
185 exit( EXIT_FAILURE );
186 } // if
187
[de62360d]188 // C specific arguments
[b87a5ed]189
190 } else if ( arg == "-v" ) {
191 verbose = true; // verbosity required
192 args[nargs] = argv[i]; // pass the argument along
193 nargs += 1;
194 } else if ( arg == "-g" ) {
195 debugging = true; // symbolic debugging required
196 args[nargs] = argv[i]; // pass the argument along
197 nargs += 1;
[e3215c5]198 } else if ( prefix( arg, "-std=" ) || prefix( arg, "--std=" ) ) {
[53ba273]199 std_flag = true; // -std=XX provided
[de62360d]200 args[nargs] = argv[i]; // pass the argument along
201 nargs += 1;
[44bca7f]202 } else if ( arg == "-w" ) {
203 args[nargs] = argv[i]; // pass the argument along
204 nargs += 1;
205 args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
206 nargs += 1;
207 } else if ( prefix( arg, "-W" ) ) { // check before next tests
208 if ( arg == "-Werror" || arg == "-Wall" ) {
209 args[nargs] = argv[i]; // pass the argument along
210 nargs += 1;
211 args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
212 nargs += 1;
213 } else {
214 unsigned int adv = prefix( arg, "-Wno-" ) ? 5 : 2;
215 args[nargs] = argv[i]; // conditionally pass the argument along
[af39199d]216 const char * warning = argv[i] + adv; // extract warning
217 if ( SemanticWarning_Exist( warning ) ) { // replace the argument for cfa-cpp
218 args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str();
219 } // if
[44bca7f]220 nargs += 1;
221 } // if
[b87a5ed]222 } else if ( prefix( arg, "-B" ) ) {
223 Bprefix = arg.substr(2); // strip the -B flag
224 args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
225 nargs += 1;
226 } else if ( prefix( arg, "-b" ) ) {
227 if ( arg.length() == 2 ) { // separate argument ?
228 i += 1;
229 if ( i == argc ) continue; // next argument available ?
230 arg += argv[i]; // concatenate argument
231 } // if
232 // later versions of gcc require the -b option to appear at the start of the command line
233 shuffle( args, sargs, nargs, 1 ); // make room at front of argument list
234 args[sargs] = ( *new string( arg ) ).c_str(); // pass the argument along
235 if ( putenv( (char *)( *new string( string( "__GCC_MACHINE__=" ) + arg ) ).c_str() ) != 0 ) {
236 cerr << argv[0] << " error, cannot set environment variable." << endl;
237 exit( EXIT_FAILURE );
238 } // if
239 sargs += 1;
240 nargs += 1;
241 } else if ( prefix( arg, "-V" ) ) {
242 if ( arg.length() == 2 ) { // separate argument ?
243 i += 1;
244 if ( i == argc ) continue; // next argument available ?
245 arg += argv[i]; // concatenate argument
246 } // if
247 // later versions of gcc require the -V option to appear at the start of the command line
248 shuffle( args, sargs, nargs, 1 ); // make room at front of argument list
249 args[sargs] = ( *new string( arg ) ).c_str(); // pass the argument along
250 if ( putenv( (char *)( *new string( string( "__GCC_VERSION__=" ) + arg ) ).c_str() ) != 0 ) {
251 cerr << argv[0] << " error, cannot set environment variable." << endl;
252 exit( EXIT_FAILURE );
253 } // if
254 sargs += 1;
255 nargs += 1;
256 } else if ( arg == "-c" || arg == "-S" || arg == "-E" || arg == "-M" || arg == "-MM" ) {
257 args[nargs] = argv[i]; // pass the argument along
258 nargs += 1;
259 if ( arg == "-E" || arg == "-M" || arg == "-MM" ) {
260 cpp_flag = true; // cpp only
261 } // if
262 link = false; // no linkage required
263 } else if ( arg[1] == 'l' ) {
264 // if the user specifies a library, load it after user code
265 libs[nlibs] = argv[i];
266 nlibs += 1;
[37fe352]267 } else if ( arg == "-m32" ) {
268 m32 = true;
269 m64 = false;
270 args[nargs] = argv[i];
271 nargs += 1;
272 } else if ( arg == "-m64" ) {
273 m64 = true;
274 m32 = false;
275 args[nargs] = argv[i];
276 nargs += 1;
[b87a5ed]277 } else {
278 // concatenate any other arguments
279 args[nargs] = argv[i];
280 nargs += 1;
281 } // if
282 } else {
[bec4d24]283 bool cfa = suffix( arg, args, nargs ); // check suffix
284 args[nargs] = argv[i]; // concatenate file
[b87a5ed]285 nargs += 1;
[bec4d24]286 if ( cfa ) {
[dffaeac]287 args[nargs] = "-x";
288 nargs += 1;
289 args[nargs] = "none";
290 nargs += 1;
291 } // if
[b87a5ed]292 nonoptarg = true;
[dffaeac]293 xflag = false;
[b87a5ed]294 } // if
295 } // for
[51b73452]296
[bec4d24]297 args[nargs] = "-x"; // turn off language
298 nargs += 1;
299 args[nargs] = "none";
300 nargs += 1;
301
[dffaeac]302 #ifdef __x86_64__
[a83d08b]303 args[nargs] = "-mcx16"; // allow double-wide CAA
304 nargs += 1;
[dffaeac]305 #endif // __x86_64__
[e3215c5]306
[dffaeac]307 #ifdef __DEBUG_H__
[b87a5ed]308 cerr << "args:";
309 for ( int i = 1; i < nargs; i += 1 ) {
310 cerr << " " << args[i];
311 } // for
312 cerr << endl;
[dffaeac]313 #endif // __DEBUG_H__
[51b73452]314
[b87a5ed]315 if ( cpp_flag && CFA_flag ) {
316 cerr << argv[0] << " error, cannot use -E and -CFA flags together." << endl;
317 exit( EXIT_FAILURE );
318 } // if
[51b73452]319
[6e4b913]320 // add the CFA include-library paths, which allow direct access to header files without directory qualification
[a5121bf]321 if( !intree ) {
322 args[nargs] = "-I" CFA_INCDIR;
[d746bc8]323 nargs += 1;
[dfb7c96]324 if ( ! noincstd_flag ) { // do not use during build
[b740f0b]325 args[nargs] = "-I" CFA_INCDIR "stdhdr";
[a5121bf]326 nargs += 1;
327 } // if
[b740f0b]328 args[nargs] = "-I" CFA_INCDIR "concurrency";
[a5121bf]329 nargs += 1;
[b740f0b]330 args[nargs] = "-I" CFA_INCDIR "containers";
[a5121bf]331 nargs += 1;
332 } else {
333 args[nargs] = "-I" TOP_SRCDIR "libcfa/src";
334 nargs += 1;
[dfb7c96]335 if ( ! noincstd_flag ) { // do not use during build
[a5121bf]336 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
337 nargs += 1;
338 } // if
339 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
340 nargs += 1;
341 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
342 nargs += 1;
343 }
[76c7f65e]344
[a37133c]345 // add stdbool to get defines for bool/true/false
346 args[nargs] = "-imacros";
347 nargs += 1;
348 args[nargs] = "stdbool.h";
349 nargs += 1;
350
[a5121bf]351 string libbase;
[37fe352]352 if( !intree ) {
[a5121bf]353 libbase = CFA_LIBDIR;
[37fe352]354 } else {
[a5121bf]355 libbase = TOP_BUILDDIR "libcfa/";
[37fe352]356 args[nargs] = "-D__CFA_FLAG__=-t";
357 nargs += 1;
358 }
359
[dfb7c96]360 string arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
361 if ( ! m32 && ! m64 && arch == "x86" ) { // no override and 32-bit architecture
362 args[nargs] = "-m32";
363 nargs += 1;
364 } // if
[a5121bf]365 const char * config = debug ? "debug": "nodebug";
366 string libdir = libbase + arch + "-" + config;
[dfb7c96]367
368 if ( ! dirExists( libdir ) ) {
[a5121bf]369 cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
370 cerr << "Was looking for " << libdir << endl;
371 libdir = libbase + arch + "-" + "nolib";
[dfb7c96]372 } // if
[a5121bf]373
[dfb7c96]374 if ( ! dirExists( libdir ) ) {
[a5121bf]375 cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
376 cerr << "Was looking for " << libdir << endl;
377 exit( EXIT_FAILURE );
[dfb7c96]378 } // if
[a5121bf]379
380 args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir + (intree ? "/prelude" : "")) ).c_str();
381 nargs += 1;
382
[b87a5ed]383 if ( link ) {
[6bfe5cc]384 args[nargs] = "-Xlinker";
385 nargs += 1;
386 args[nargs] = "--undefined=__cfaabi_dbg_bits_write";
387 nargs += 1;
388 args[nargs] = "-Xlinker";
389 nargs += 1;
390 args[nargs] = "--undefined=__cfaabi_interpose_startup";
391 nargs += 1;
[c2ea058]392 args[nargs] = "-Xlinker";
393 nargs += 1;
394 args[nargs] = "--undefined=__cfaabi_appready_startup";
395 nargs += 1;
[1997b4e]396 args[nargs] = "-Xlinker";
397 nargs += 1;
398 args[nargs] = "--undefined=__cfaabi_dbg_record";
399 nargs += 1;
[6bfe5cc]400
[b87a5ed]401 // include the cfa library in case it's needed
[a5121bf]402 args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src" : "")) ).c_str();
403 nargs += 1;
[37fe352]404 args[nargs] = "-lcfa";
[51b73452]405 nargs += 1;
[63f78f0]406 args[nargs] = "-lpthread";
407 nargs += 1;
[9d944b2]408 args[nargs] = "-ldl";
409 nargs += 1;
[c5ac6d5]410 args[nargs] = "-lrt";
411 nargs += 1;
[51b73452]412 } // if
413
[e9145a3]414 // Add exception flags (unconditionally)
415 args[nargs] = "-fexceptions";
416 nargs += 1;
417
[b87a5ed]418 // add the correct set of flags based on the type of compile this is
[8c17ab0]419
[ec129c4]420 args[nargs] = ( *new string( string("-D__CFA_MAJOR__=") + Major ) ).c_str();
[51b73452]421 nargs += 1;
[b87a5ed]422 args[nargs] = ( *new string( string("-D__CFA_MINOR__=") + Minor ) ).c_str();
[51b73452]423 nargs += 1;
[ec129c4]424 args[nargs] = ( *new string( string("-D__CFA_PATCH__=") + Patch ) ).c_str();
[1db21619]425 nargs += 1;
[4c82a3c]426 args[nargs] = "-D__CFA__";
427 nargs += 1;
428 args[nargs] = "-D__CFORALL__";
[02e5ab6]429 nargs += 1;
[6acb935]430 args[nargs] = "-D__cforall";
431 nargs += 1;
[51b73452]432
[b87a5ed]433 if ( cpp_flag ) {
434 args[nargs] = "-D__CPP__";
435 nargs += 1;
436 } // if
[51b73452]437
[fa477f7]438 shuffle( args, sargs, nargs, 1 ); // make room at front of argument list
439 nargs += 1;
[b87a5ed]440 if ( CFA_flag ) {
[fa477f7]441 args[sargs] = "-D__CFA_FLAG__=-N";
[4c82a3c]442 args[nargs] = "-D__CFA_PREPROCESS_";
[b87a5ed]443 nargs += 1;
[fa477f7]444 } else {
445 args[sargs] = "-D__CFA_FLAG__=-L";
[b87a5ed]446 } // if
[fa477f7]447 sargs += 1;
[51b73452]448
[b87a5ed]449 if ( debug ) {
450 heading += " (debug)";
451 args[nargs] = "-D__CFA_DEBUG__";
452 nargs += 1;
453 } else {
454 heading += " (no debug)";
455 } // if
[51b73452]456
[b87a5ed]457 if ( Bprefix.length() == 0 ) {
[b740f0b]458 Bprefix = ! intree ? installlibdir : srcdriverdir;
459 if ( Bprefix[Bprefix.length() - 1] != '/' ) Bprefix += '/';
[b87a5ed]460 args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
461 nargs += 1;
462 } // if
[51b73452]463
[37fe352]464 args[nargs] = "-Xlinker"; // used by backtrace
465 nargs += 1;
466 args[nargs] = "-export-dynamic";
467 nargs += 1;
[6bfe5cc]468
[b87a5ed]469 // execute the compilation command
[51b73452]470
[b87a5ed]471 args[0] = compiler_path.c_str(); // set compiler command for exec
472 // find actual name of the compiler independent of the path to it
473 int p = compiler_path.find_last_of( '/' ); // scan r -> l for first '/'
474 if ( p == -1 ) {
475 compiler_name = compiler_path;
476 } else {
477 compiler_name = *new string( compiler_path.substr( p + 1 ) );
478 } // if
[51b73452]479
[b87a5ed]480 if ( prefix( compiler_name, "gcc" ) ) { // allow suffix on gcc name
481 args[nargs] = "-no-integrated-cpp";
482 nargs += 1;
[76c7f65e]483 args[nargs] = "-Wno-deprecated";
[b87a5ed]484 nargs += 1;
[157d094]485 if ( ! std_flag ) { // default c11, if none specified
486 args[nargs] = "-std=gnu11";
[de62360d]487 nargs += 1;
488 } // if
[76c7f65e]489 args[nargs] = "-fgnu89-inline";
[6e991d6]490 nargs += 1;
[201aeb9]491 args[nargs] = "-D__int8_t_defined"; // prevent gcc type-size attributes
492 nargs += 1;
[b740f0b]493 args[nargs] = ( *new string( string("-B") + Bprefix ) ).c_str();
[b87a5ed]494 nargs += 1;
[d3b7937]495 args[nargs] = "-lm";
496 nargs += 1;
[b87a5ed]497 } else {
[e24f13a]498 cerr << argv[0] << " error, compiler \"" << compiler_name << "\" unsupported." << endl;
[b87a5ed]499 exit( EXIT_FAILURE );
500 } // if
[51b73452]501
[b87a5ed]502 for ( int i = 0; i < nlibs; i += 1 ) { // copy non-user libraries after all user libraries
503 args[nargs] = libs[i];
504 nargs += 1;
505 } // for
[51b73452]506
[b87a5ed]507 args[nargs] = NULL; // terminate with NULL
[51b73452]508
[dffaeac]509 #ifdef __DEBUG_H__
[b87a5ed]510 cerr << "nargs: " << nargs << endl;
511 cerr << "args:" << endl;
512 for ( int i = 0; args[i] != NULL; i += 1 ) {
513 cerr << " \"" << args[i] << "\"" << endl;
514 } // for
[dffaeac]515 #endif // __DEBUG_H__
[51b73452]516
[b87a5ed]517 if ( ! quiet ) {
518 cerr << "CFA " << "Version " << Version << heading << endl;
519
520 if ( help ) {
521 cerr <<
522 "-debug\t\t\t: use cfa runtime with debug checking" << endl <<
523 "-help\t\t\t: print this help message" << endl <<
524 "-quiet\t\t\t: print no messages from the cfa command" << endl <<
525 "-CFA\t\t\t: run the cpp preprocessor and the cfa-cpp translator" << endl <<
526 "-XCFA -cfa-cpp-flag\t: pass next flag as-is to the cfa-cpp translator" << endl <<
527 "...\t\t\t: any other " << compiler_name << " flags" << endl;
528 } // if
[51b73452]529 } // if
530
[b87a5ed]531 if ( verbose ) {
532 if ( argc == 2 ) exit( EXIT_SUCCESS ); // if only the -v flag is specified, do not invoke gcc
[51b73452]533
[b87a5ed]534 for ( int i = 0; args[i] != NULL; i += 1 ) {
535 cerr << args[i] << " ";
536 } // for
537 cerr << endl;
538 } // if
[51b73452]539
[b87a5ed]540 if ( ! nonoptarg ) {
541 cerr << argv[0] << " error, no input files" << endl;
542 exit( EXIT_FAILURE );
543 } // if
[51b73452]544
[b87a5ed]545 // execute the command and return the result
[51b73452]546
[b87a5ed]547 execvp( args[0], (char *const *)args ); // should not return
548 perror( "CFA Translator error: cfa level, execvp" );
549 exit( EXIT_FAILURE );
[51b73452]550} // main
551
552// Local Variables: //
[b87a5ed]553// tab-width: 4 //
554// mode: c++ //
[51b73452]555// compile-command: "make install" //
556// End: //
Note: See TracBrowser for help on using the repository browser.