source: driver/cfa.cc@ 713905fd

Last change on this file since 713905fd was 727c39d5, checked in by Peter A. Buhr <pabuhr@…>, 2 years ago

add commented alternative option for ARM atomics

  • Property mode set to 100644
File size: 20.5 KB
Line 
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//
7// cfa.cc --
8//
9// Author : Peter A. Buhr
10// Created On : Tue Aug 20 13:44:49 2002
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Fri Jun 9 14:36:41 2023
13// Update Count : 479
14//
15
16#include <iostream>
17#include <cstdio> // perror
18#include <cstdlib> // putenv, exit
19#include <climits> // PATH_MAX
20#include <string> // STL version
21#include <algorithm> // find
22
23#include <unistd.h> // execvp
24#include <sys/types.h>
25#include <sys/stat.h>
26
27#include "Common/SemanticError.h"
28#include "config.h" // configure info
29
30using std::cerr;
31using std::endl;
32using std::string;
33using std::to_string;
34
35//#define __DEBUG_H__
36
37#define xstr(s) str(s)
38#define str(s) #s
39
40static string __CFA_FLAGPREFIX__( "__CFA_FLAG" ); // "__CFA_FLAG__=" suffix
41
42static void Putenv( char * argv[], string arg ) {
43 // environment variables must have unique names
44 static int flags = 0;
45
46 // This allocation 'leaks' memory from the program to the execution
47 // environment, as putenv does not manage the storage of the string used
48 // as an environment variable. This leak is necessary to ensure the
49 // underlying C string is allocated long enough.
50 if ( putenv( (char *)( *new string( string( __CFA_FLAGPREFIX__ + to_string( flags++ ) + "__=" ) + arg ) ).c_str() ) ) {
51 cerr << argv[0] << " error, cannot set environment variable." << endl;
52 exit( EXIT_FAILURE );
53 } // if
54} // Putenv
55
56static bool prefix( const string & arg, const string & pre ) { // check if string has prefix
57 return arg.substr( 0, pre.size() ) == pre;
58} // prefix
59
60// check if string has suffix
61static bool suffix( const string & arg ) {
62 enum { NumSuffixes = 3 };
63 static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" };
64
65 size_t dot = arg.find_last_of( "." );
66 if ( dot == string::npos ) return false;
67 const string * end = suffixes + NumSuffixes;
68 return std::find( suffixes, end, arg.substr( dot + 1 ) ) != end;
69} // suffix
70
71static inline bool dirExists( const string & path ) { // check if directory exists
72 struct stat info;
73 if ( stat( path.c_str(), &info ) != 0 ) return false;
74 return (info.st_mode & S_IFDIR) != 0;
75} // dirExists
76
77static inline string dir(const string & path) {
78 return path.substr(0, path.find_last_of('/'));
79} // dir
80
81// Different path modes
82enum PathMode {
83 Installed, // cfa is installed, use prefix
84 BuildTree, // cfa is in the tree, use source and build tree
85 Distributed // cfa is distributed, use build tree for includes and executable directory for .cfs
86};
87
88// Get path mode from /proc
89PathMode FromProc() {
90 std::string abspath;
91 abspath.resize(PATH_MAX);
92
93 // get executable path from /proc/self/exe
94 ssize_t size = readlink("/proc/self/exe", const_cast<char*>(abspath.c_str()), abspath.size());
95 if ( size <= 0 ) {
96 std::cerr << "Error could not evaluate absolute path from /proc/self/exe" << std::endl;
97 std::cerr << "Failed with " << std::strerror(errno) << std::endl;
98 std::exit(1);
99 } // if
100
101 // Trim extra characters
102 abspath.resize(size);
103
104 // Are we installed
105 if ( abspath.rfind(CFA_BINDIR, 0) == 0 ) { return Installed; }
106
107 // Is this the build tree
108 if ( abspath.rfind(TOP_BUILDDIR, 0 ) == 0 ) { return BuildTree; }
109
110 // Does this look like distcc
111 if ( abspath.find( "/.cfadistcc/" ) != std::string::npos ) { return Distributed; }
112
113 // None of the above? Give up since we don't know where the prelude or include directories are
114 std::cerr << "Cannot find required files from excutable path " << abspath << std::endl;
115 std::exit(1);
116}
117
118
119int main( int argc, char * argv[] ) {
120 string Version( CFA_VERSION_LONG ); // current version number from CONFIG
121 string Major( xstr( CFA_VERSION_MAJOR ) ), Minor( xstr( CFA_VERSION_MINOR ) ), Patch( xstr( CFA_VERSION_PATCH ) );
122
123 string installincdir( CFA_INCDIR ); // fixed location of include files
124 string installlibdir( CFA_LIBDIR ); // fixed location of cc1 and cfa-cpp commands when installed
125 string srcdriverdir ( TOP_BUILDDIR "driver"); // fixed location of cc1 and cfa-cpp commands when in tree
126
127 string heading; // banner printed at start of cfa compilation
128 string arg; // current command-line argument during command-line parsing
129 string bprefix; // path where gcc looks for compiler steps
130 string langstd; // language standard
131
132 string compiler_path( CFA_BACKEND_CC ); // path/name of C compiler
133 string compiler_name; // name of C compiler
134
135 bool x_flag = false; // -x flag
136 bool nonoptarg = false; // no non-option arguments specified, i.e., no file names
137 bool link = true; // link stage occurring
138 bool verbose = false; // -v flag
139 bool quiet = false; // -quiet flag
140 bool debug = true; // -debug flag
141 bool nolib = false; // -nolib flag
142 bool help = false; // -help flag
143 bool CFA_flag = false; // -CFA flag
144 bool cpp_flag = false; // -E or -M flag, preprocessor only
145 bool std_flag = false; // -std= flag
146 bool noincstd_flag = false; // -no-include-stdhdr= flag
147 bool debugging __attribute(( unused )) = false; // -g flag
148 bool m32 = false; // -m32 flag
149 bool m64 = false; // -m64 flag
150 bool compiling_libs = false;
151 int o_file = 0; // -o filename position
152
153 PathMode path = FromProc();
154
155 const char * args[argc + 100]; // cfa command line values, plus some space for additional flags
156 int sargs = 1; // starting location for arguments in args list
157 int nargs = sargs; // number of arguments in args list; 0 => command name
158
159 const char * libs[argc + 20]; // non-user libraries must come separately, plus some added libraries and flags
160 int nlibs = 0;
161
162 #ifdef __DEBUG_H__
163 cerr << "CFA:" << endl;
164 for ( int i = 1; i < argc; i += 1 ) {
165 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
166 } // for
167 #endif // __DEBUG_H__
168
169 // process command-line arguments
170
171 for ( int i = 1; i < argc; i += 1 ) {
172 arg = argv[i]; // convert to string value
173 if ( prefix( arg, "-" ) ) {
174 // pass through arguments
175
176 if ( arg == "-Xlinker" || arg == "-o" ) {
177 args[nargs++] = argv[i]; // pass flag along
178 i += 1;
179 if ( i == argc ) continue; // next argument available ?
180 args[nargs++] = argv[i]; // pass argument along
181 if ( arg == "-o" ) o_file = i; // remember file
182
183 // CFA specific arguments
184
185 } else if ( strncmp(arg.c_str(), "-XCFA", 5) == 0 ) { // CFA pass through
186 if ( arg.size() == 5 ) {
187 i += 1;
188 if ( i == argc ) continue; // next argument available ?
189 Putenv( argv, argv[i] ); // make available for cc1
190 } else if ( arg[5] == ',' ) { // CFA specific arguments
191 string xcfargs = arg.substr( 6 ) + ","; // add sentinel
192 for ( ;; ) {
193 size_t posn = xcfargs.find_first_of( "," ); // find separator
194 if ( posn == string::npos ) break; // any characters left ?
195 string xcfarg = xcfargs.substr( 0, posn ); // remove XCFA argument
196 Putenv( argv, xcfarg ); // make available for cc1
197 xcfargs.erase( 0, posn + 1 ); // remove first argument and comma
198 } // for
199 } else { // CFA specific arguments
200 assert( false ); // this does not make sense
201 args[nargs++] = argv[i];
202 } // if
203 } else if ( arg == "-CFA" ) {
204 CFA_flag = true; // strip -CFA flag
205 link = false;
206 args[nargs++] = "-fsyntax-only"; // stop after stage 2
207 } else if ( arg == "-debug" ) {
208 debug = true; // strip debug flag
209 } else if ( arg == "-nodebug" ) {
210 debug = false; // strip nodebug flag
211 } else if ( arg == "-quiet" ) {
212 quiet = true; // strip quiet flag
213 } else if ( arg == "-noquiet" ) {
214 quiet = false; // strip noquiet flag
215 } else if ( arg == "-invariant" ) {
216 Putenv( argv, "-" + arg );
217 } else if ( arg == "--invariant" ) {
218 Putenv( argv, arg );
219 } else if ( arg == "-no-include-stdhdr" ) {
220 noincstd_flag = true; // strip no-include-stdhdr flag
221 } else if ( arg == "-nolib" ) {
222 nolib = true; // strip nolib flag
223 } else if ( arg == "-help" ) {
224 help = true; // strip help flag
225 } else if ( arg == "-nohelp" ) {
226 help = false; // strip nohelp flag
227 } else if ( arg == "-cfalib") {
228 compiling_libs = true;
229 } else if ( arg == "-compiler" ) {
230 // use the user specified compiler
231 i += 1;
232 if ( i == argc ) continue; // next argument available ?
233 compiler_path = argv[i];
234 Putenv( argv, arg + "=" + argv[i] );
235
236 // C specific arguments
237
238 } else if ( arg == "-v" ) {
239 verbose = true; // verbosity required
240 args[nargs++] = argv[i]; // pass flag along
241 } else if ( arg == "-g" ) {
242 debugging = true; // symbolic debugging required
243 args[nargs++] = argv[i]; // pass flag along
244 } else if ( arg == "-save-temps" || arg == "--save-temps" ) {
245 args[nargs++] = argv[i]; // pass flag along
246 Putenv( argv, arg ); // save cfa-cpp output
247 } else if ( prefix( arg, "-x" ) ) { // file suffix ?
248 string lang;
249 args[nargs++] = argv[i]; // pass flag along
250 if ( arg.length() == 2 ) { // separate argument ?
251 i += 1;
252 if ( i == argc ) continue; // next argument available ?
253 lang = argv[i];
254 args[nargs++] = argv[i]; // pass argument along
255 } else {
256 lang = arg.substr( 2 );
257 } // if
258 if ( x_flag ) {
259 cerr << argv[0] << " warning, only one -x flag per compile, ignoring subsequent flag." << endl;
260 } else {
261 x_flag = true;
262 Putenv( argv, string( "-x=" ) + lang );
263 } // if
264 } else if ( prefix( arg, "-std=" ) || prefix( arg, "--std=" ) ) {
265 std_flag = true; // -std=XX provided
266 args[nargs++] = argv[i]; // pass flag along
267 } else if ( arg == "-w" ) {
268 args[nargs++] = argv[i]; // pass flag along
269 Putenv( argv, arg );
270 } else if ( prefix( arg, "-W" ) ) { // check before next tests
271 if ( arg == "-Werror" || arg == "-Wall" ) {
272 args[nargs++] = argv[i]; // pass flag along
273 Putenv( argv, argv[i] );
274 } else {
275 unsigned int adv = prefix( arg, "-Wno-" ) ? 5 : 2;
276 args[nargs] = argv[i]; // conditionally pass argument along
277 const char * warning = argv[i] + adv; // extract warning
278 if ( SemanticWarning_Exist( warning ) ) { // replace the argument for cfa-cpp
279 Putenv( argv, arg );
280 } // if
281 nargs += 1;
282 } // if
283 } else if ( prefix( arg, "-B" ) ) {
284 bprefix = arg.substr(2); // strip -B flag
285 } else if ( arg == "-c" || arg == "-S" || arg == "-E" || arg == "-M" || arg == "-MM" ) {
286 args[nargs++] = argv[i]; // pass flag along
287 if ( arg == "-E" || arg == "-M" || arg == "-MM" ) {
288 cpp_flag = true; // cpp only
289 } // if
290 link = false; // no linkage required
291 } else if ( arg == "-D" || arg == "-U" || arg == "-I" || arg == "-MF" || arg == "-MT" || arg == "-MQ" ||
292 arg == "-include" || arg == "-imacros" || arg == "-idirafter" || arg == "-iprefix" ||
293 arg == "-iwithprefix" || arg == "-iwithprefixbefore" || arg == "-isystem" || arg == "-isysroot" ) {
294 args[nargs++] = argv[i]; // pass flag along
295 i += 1;
296 args[nargs++] = argv[i]; // pass argument along
297 } else if ( arg[1] == 'l' ) {
298 // if the user specifies a library, load it after user code
299 libs[nlibs++] = argv[i];
300 } else if ( arg == "-m32" ) {
301 m32 = true;
302 m64 = false;
303 args[nargs++] = argv[i];
304 } else if ( arg == "-m64" ) {
305 m64 = true;
306 m32 = false;
307 args[nargs++] = argv[i];
308 } else {
309 // concatenate any other arguments
310 args[nargs++] = argv[i];
311 } // if
312 } else {
313 bool cfa = suffix( arg ); // check suffix
314 if ( ! x_flag && cfa ) { // no explicit suffix and cfa suffix ?
315 args[nargs++] = "-x";
316 args[nargs++] = "c";
317 } // if
318 args[nargs++] = argv[i]; // concatenate files
319 if ( ! x_flag && cfa ) { // no explicit suffix and cfa suffix ?
320 args[nargs++] = "-x";
321 args[nargs++] = "none";
322 } // if
323 nonoptarg = true;
324 } // if
325 } // for
326
327 #ifdef __x86_64__
328 args[nargs++] = "-mcx16"; // allow double-wide CAS
329 #endif // __x86_64__
330
331 // ARM -mno-outline-atomics => use LL/SC instead of calls to atomic routines: __aarch64_swp_acq_rel, __aarch64_cas8_acq_rel
332 // ARM -march=armv8.2-a+lse => generate Arm LSE extension instructions SWAP and CAS
333 // https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/making-the-most-of-the-arm-architecture-in-gcc-10
334 #ifdef __ARM_ARCH
335 args[nargs++] = "-mno-outline-atomics"; // use ARM LL/SC instructions for atomics
336 // args[nargs++] = "-march=armv8.2-a+lse"; // use atomic instructions
337 #endif // __ARM_ARCH
338
339 #ifdef __DEBUG_H__
340 cerr << "args:";
341 for ( int i = 1; i < nargs; i += 1 ) {
342 cerr << " " << args[i];
343 } // for
344 cerr << endl;
345 #endif // __DEBUG_H__
346
347 // -E flag stops at cc1 stage 1, so cfa-cpp in cc1 stage 2 is never executed.
348 if ( cpp_flag && CFA_flag ) {
349 CFA_flag = false;
350 cerr << argv[0] << " warning, both -E and -CFA flags specified, using -E and ignoring -CFA." << endl;
351 } // if
352
353 // add the CFA include-library paths, which allow direct access to header files without directory qualification
354 string libbase;
355 switch(path) {
356 case Installed:
357 args[nargs++] = "-I" CFA_INCDIR;
358 // do not use during build
359 if ( ! noincstd_flag ) {
360 args[nargs++] = "-I" CFA_INCDIR "stdhdr";
361 } // if
362 args[nargs++] = "-I" CFA_INCDIR "concurrency";
363 args[nargs++] = "-I" CFA_INCDIR "containers";
364 libbase = CFA_LIBDIR;
365 break;
366 case BuildTree:
367 case Distributed:
368 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src";
369 // do not use during build
370 if ( ! noincstd_flag ) {
371 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
372 } // if
373 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
374 args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
375
376 libbase = TOP_BUILDDIR "libcfa/";
377
378 break;
379 } // if
380
381 // add stdbool to get defines for bool/true/false
382 args[nargs++] = "-imacros";
383 args[nargs++] = "stdbool.h";
384
385 if ( compiling_libs ) {
386 Putenv( argv, "-t" );
387 } // if
388
389 string arch( m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU) );
390 if ( ! m32 && ! m64 ) {
391 if ( arch == "x86" ) {
392 args[nargs++] = "-m32";
393 } else if ( arch == "x64" ) {
394 args[nargs++] = "-m64";
395 } // if
396 } // if
397
398 const char * config = nolib ? "nolib" : (debug ? "debug": "nodebug");
399 string libdir = libbase + arch + "-" + config;
400
401 if ( path != Distributed ) {
402 if ( ! nolib && ! dirExists( libdir ) ) {
403 cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
404 cerr << "Was looking for " << libdir << endl;
405 for(int i = 1; i < argc; i++) {
406 cerr << argv[i] << " ";
407 }
408 cerr << endl;
409 libdir = libbase + arch + "-" + "nolib";
410 } // if
411
412 if ( ! dirExists( libdir ) ) {
413 cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
414 cerr << "Was looking for " << libdir << endl;
415 exit( EXIT_FAILURE );
416 } // if
417 } // if
418
419 string preludedir;
420 switch(path) {
421 case Installed : preludedir = libdir; break;
422 case BuildTree : preludedir = libdir + "/prelude"; break;
423 case Distributed : preludedir = dir(argv[0]); break;
424 } // switch
425
426 Putenv( argv, "--prelude-dir=" + preludedir );
427 args[nargs++] = "-include";
428 args[nargs++] = (*new string(preludedir + "/defines.hfa")).c_str();
429
430 for ( int i = 0; i < nlibs; i += 1 ) { // copy non-user libraries after all user libraries
431 args[nargs++] = libs[i];
432 } // for
433
434 if ( link ) {
435 args[nargs++] = "-Xlinker";
436 args[nargs++] = "--undefined=__cfaabi_dbg_bits_write";
437 args[nargs++] = "-Xlinker";
438 args[nargs++] = "--undefined=__cfaabi_interpose_startup";
439 args[nargs++] = "-Xlinker";
440 args[nargs++] = "--undefined=__cfaabi_appready_startup";
441 args[nargs++] = "-z";
442 args[nargs++] = "execstack";
443
444 // include the cfa library in case it is needed
445 args[nargs++] = ( *new string( string("-L" ) + libdir + (path != Installed ? "/src/.libs" : "")) ).c_str();
446 args[nargs++] = ( *new string( string("-Wl,-rpath," ) + libdir + (path != Installed ? "/src/.libs" : "")) ).c_str();
447 args[nargs++] = "-Wl,--push-state,--as-needed";
448 args[nargs++] = "-lcfathread";
449 args[nargs++] = "-Wl,--pop-state";
450 args[nargs++] = "-Wl,--push-state,--no-as-needed";
451 args[nargs++] = "-lcfa";
452 args[nargs++] = "-Wl,--pop-state";
453 args[nargs++] = "-pthread";
454 #if defined( __x86_64__ ) || defined( __ARM_ARCH )
455 args[nargs++] = "-latomic"; // allow double-wide CAS
456 #endif // __x86_64__
457 args[nargs++] = "-ldl";
458 args[nargs++] = "-lm";
459 } // if
460
461 args[nargs++] = "-fexceptions"; // add exception flags (unconditionally)
462 args[nargs++] = "-D_GNU_SOURCE"; // force gnu libraries
463
464 // add flags based on the type of compile
465
466 args[nargs++] = ( *new string( string("-D__CFA_MAJOR__=") + Major ) ).c_str();
467 args[nargs++] = ( *new string( string("-D__CFA_MINOR__=") + Minor ) ).c_str();
468 args[nargs++] = ( *new string( string("-D__CFA_PATCH__=") + Patch ) ).c_str();
469 args[nargs++] = "-D__CFA__";
470 args[nargs++] = "-D__CFORALL__";
471 args[nargs++] = "-D__cforall";
472
473 if ( cpp_flag ) {
474 args[nargs++] = "-D__CPP__";
475 } // if
476
477 if ( CFA_flag ) {
478 Putenv( argv, "-N" );
479 Putenv( argv, "-CFA" );
480 // -CFA implies cc1 stage 2, but gcc does not pass the -o file to this stage because it believe the file is for
481 // the linker. Hence, the -o file is explicit passed to cc1 stage 2 and used as cfa-cpp's output file.
482 if ( o_file ) Putenv( argv, string( "-o=" ) + argv[o_file] );
483 } else {
484 Putenv( argv, "-L" );
485 } // if
486
487 if ( debug ) {
488 heading += " (debug)";
489 args[nargs++] = "-D__CFA_DEBUG__";
490 } else {
491 heading += " (no debug)";
492 } // if
493
494 if ( bprefix.length() == 0 ) {
495 switch(path) {
496 case Installed : bprefix = installlibdir; break;
497 case BuildTree : bprefix = srcdriverdir ; break;
498 case Distributed : bprefix = dir(argv[0]) ; break;
499 } // switch
500 } // if
501 if ( bprefix[bprefix.length() - 1] != '/' ) bprefix += '/';
502 Putenv( argv, string("-B=") + bprefix );
503
504 args[nargs++] = "-Xlinker"; // used by backtrace
505 args[nargs++] = "-export-dynamic";
506
507 // execute the compilation command
508
509 args[0] = compiler_path.c_str(); // set compiler command for exec
510 // find actual name of the compiler independent of the path to it
511 int p = compiler_path.find_last_of( '/' ); // scan r -> l for first '/'
512 if ( p == -1 ) {
513 compiler_name = compiler_path;
514 } else {
515 compiler_name = *new string( compiler_path.substr( p + 1 ) );
516 } // if
517
518 if ( prefix( compiler_name, "gcc" ) ) { // allow suffix on gcc name
519 args[nargs++] = "-no-integrated-cpp";
520 args[nargs++] = "-Wno-deprecated";
521 args[nargs++] = "-Wno-strict-aliasing"; // casting from one type to another
522 #ifdef HAVE_CAST_FUNCTION_TYPE
523 args[nargs++] = "-Wno-cast-function-type";
524 #endif // HAVE_CAST_FUNCTION_TYPE
525 if ( ! std_flag && ! x_flag ) {
526 args[nargs++] = "-std=gnu11"; // default c11, if none specified
527 } // if
528 args[nargs++] = "-fgnu89-inline";
529 args[nargs++] = "-D__int8_t_defined"; // prevent gcc type-size attributes
530 args[nargs++] = ( *new string( string("-B") + bprefix ) ).c_str();
531 } else {
532 cerr << argv[0] << " error, compiler \"" << compiler_name << "\" unsupported." << endl;
533 exit( EXIT_FAILURE );
534 } // if
535
536 args[nargs] = nullptr; // terminate
537
538 #ifdef __DEBUG_H__
539 cerr << "nargs: " << nargs << endl;
540 cerr << "args:" << endl;
541 for ( int i = 0; args[i] != nullptr; i += 1 ) {
542 cerr << " \"" << args[i] << "\"" << endl;
543 } // for
544 cerr << endl;
545 #endif // __DEBUG_H__
546
547 if ( ! quiet ) {
548 cerr << "CFA " << "Version " << Version << heading << endl;
549 if ( help ) {
550 cerr <<
551 "-debug\t\t\t: use cfa runtime with debug checking" << endl <<
552 "-help\t\t\t: print this help message" << endl <<
553 "-quiet\t\t\t: print no messages from the cfa command" << endl <<
554 "-CFA\t\t\t: run the cpp preprocessor and the cfa-cpp translator" << endl <<
555 "-XCFA -cfa-cpp-flag\t: pass next flag as-is to the cfa-cpp translator" << endl <<
556 "...\t\t\t: any other " << compiler_name << " flags" << endl;
557 } // if
558 } // if
559
560 if ( verbose ) {
561 if ( argc == 2 ) exit( EXIT_SUCCESS ); // if only the -v flag is specified, do not invoke gcc
562
563 for ( int i = 0; args[i] != nullptr; i += 1 ) {
564 cerr << args[i] << " ";
565 } // for
566 cerr << endl;
567 } // if
568
569 if ( ! nonoptarg ) {
570 cerr << argv[0] << " error, no input files" << endl;
571 exit( EXIT_FAILURE );
572 } // if
573
574 // execute the command and return the result
575
576 execvp( args[0], (char * const *)args ); // should not return
577 perror( "CFA Translator error: execvp" );
578 exit( EXIT_FAILURE );
579} // main
580
581// Local Variables: //
582// tab-width: 4 //
583// mode: c++ //
584// compile-command: "make install" //
585// End: //
Note: See TracBrowser for help on using the repository browser.