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" == "" ]] ; then
37 if [[ "$1" == "--help" ]] ; then
41 if echo $1 |
grep -q ^
- ; then
49 if echo $CMD |
grep -q smatch
; then
50 POST
="--project=kernel $POST"
54 cname
=$
(echo ${cname/.o/.c})
55 if [[ "$cname" == "" ]] ; then
58 if ! test -e $cname ; then
62 oname
=$
(echo ${cname/.c/.o})
63 if ! echo $oname |
grep .o$
> /dev
/null
; then
68 make C
=y CHECK
="$PRE $CMD $POST" $oname