source: driver/cfa.cc@ 5dd3098

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 5dd3098 was 34a6b2e, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

Merge branch 'master' of plg2:software/cfa/cfa-cc

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