kernel: fix a type bug handling err_cast()
[smatch.git] / sparsec
blobbafe2da5d508ed88482e94d2982ffae16b5f5f61
1 #!/bin/sh
3 # GCC compatible C compiler based on Sparse LLVM
5 set +e
7 SPARSEOPTS=""
8 DIRNAME=`dirname $0`
10 NEED_LINK=1
12 if [ $# -eq 0 ]; then
13 echo "`basename $0`: no input files"
14 exit 1
17 while [ $# -gt 0 ]; do
18 case $1 in
19 '-o')
20 OUTFILE=$2
21 shift
23 '-c')
24 NEED_LINK=0
27 SPARSEOPTS="$SPARSEOPTS $1 " ;;
28 esac
29 shift
30 done
32 TMPFILE=`mktemp -t tmp.XXXXXX`
35 LLC=`"${LLVM_CONFIG:-llvm-config}" --bindir`/llc
37 LLC_ARCH_OPTS=
38 case "$(uname -s)" in
39 *CYGWIN*)
40 # cygwin uses the sjlj (setjmp-longjmp) exception model
41 LLC_ARCH_OPTS="-exception-model=sjlj"
45 esac
47 $DIRNAME/sparse-llvm $SPARSEOPTS | $LLC ${LLC_ARCH_OPTS} | as -o $TMPFILE
49 if [ $NEED_LINK -eq 1 ]; then
50 if [ -z $OUTFILE ]; then
51 OUTFILE=a.out
53 gcc $TMPFILE -o $OUTFILE
54 rm -f $TMPFILE
55 else
56 if [ -z $OUTFILE ]; then
57 echo "`basename $0`: no output file"
58 exit 1
60 mv $TMPFILE $OUTFILE