4 echo "Usage: $0 [--sparse][--valgrind][--debug] path/to/file.c"
8 SCRIPT_DIR
=$
(dirname $0)
9 if [ -e $SCRIPT_DIR/..
/smatch
] ; then
10 CMD
=$SCRIPT_DIR/..
/smatch
11 elif which smatch |
grep smatch
> /dev
/null
; then
14 echo "Smatch binary not found."
19 if [[ "$1" == "--sparse" ]] ; then
22 elif [[ "$1" == "--test-parsing" ]] ; then
23 CMD
="$SCRIPT_DIR/../test-parsing -no-lineno"
25 elif echo "$1" |
grep -q -- "--outfile=" ; then
26 outfile
=$
(echo "$1" | cut
-d '=' -f 2)
27 if [ "outfile" != "" ] ; then
28 POST
="$POST > $outfile"
31 elif [[ "$1" == "--valgrind" ]] ; then
34 elif [[ "$1" == "--endian" ]] ; then
35 ENDIAN
="CF=-D__CHECK_ENDIAN__"
37 elif [[ "$1" == "" ]] ; then
40 if [[ "$1" == "--help" ]] ; then
44 if echo $1 |
grep -q ^
- ; then
52 if echo $CMD |
grep -q smatch
; then
53 POST
="--project=kernel $POST"
57 cname
=$
(echo ${cname/.o/.c})
58 if [[ "$cname" == "" ]] ; then
61 if ! test -e $cname ; then
65 oname
=$
(echo ${cname/.c/.o})
66 if ! echo $oname |
grep -q .o$
&& ! echo $oname |
grep -q /$
; then
69 if echo $oname |
grep -q .o$
; then
73 make C
=1 $ENDIAN CHECK
="$PRE $CMD $POST" $oname