[cfe-dev] ccc return code
Török Edwin
edwintorok at gmail.com
Sun Feb 3 06:40:48 PST 2008
Hi,
ccc returns exitcode 0, even on failure:
$ cat x.c
#include <sys/int_types.h>
$ /home/edwin/llvm-svn/llvm/tools/clang/utils/ccc -c x.c; echo exitcode:$?
clang -emit-llvm-bc -x c -o x.o x.c
x.c:1:10: error: 'sys/int_types.h' file not found
#include <sys/int_types.h>
^
1 diagnostic generated.
exitcode:0
$ clang -emit-llvm-bc -x c -o x.o x.c; echo exitcode:$?
x.c:1:10: error: 'sys/int_types.h' file not found
#include <sys/int_types.h>
^
1 diagnostic generated.
exitcode:1
The exitcode in python is 256, if I add an if to make 256 into 1, it works:
$ /home/edwin/llvm-svn/llvm/tools/clang/utils/ccc -c x.c; echo exitcode:$?
clang -emit-llvm-bc -x c -o x.o x.c
x.c:1:10: error: 'sys/int_types.h' file not found
#include <sys/int_types.h>
^
1 diagnostic generated.
exitcode:1
Index: utils/ccc
===================================================================
--- utils/ccc (revision 46686)
+++ utils/ccc (working copy)
@@ -22,6 +22,8 @@
cmd = ' '.join(args)
print >> sys.stderr, cmd
code = os.system(cmd)
+ if code > 255:
+ code = 1
if code:
sys.exit(code)
More information about the cfe-dev
mailing list