add a check for passing stack variables to dma functions
[smatch.git] / smatch_scripts / wine_checker.sh
blob24d2a3f24b4ea18a5b43dddf2ad4aa99e4d7020c
1 #!/bin/bash
3 function useage {
4 echo "Usage: $0 [--sparse][--valgrind][--debug] path/to/file.c"
5 exit 1
8 CMD=smatch
9 POST=""
10 WINE_ARGS="-p=wine --full-path -D__i386__"
12 while true ; do
13 if [[ "$1" == "--sparse" ]] ; then
14 CMD="sparse"
15 shift
16 elif [[ "$1" == "--valgrind" ]] ; then
17 PRE="valgrind"
18 shift
19 elif [[ "$1" == "" ]] ; then
20 break
21 else
22 if [[ "$1" == "--help" ]] ; then
23 $CMD --help
24 exit 1
26 if echo $1 | grep -q ^- ; then
27 POST="$POST $1"
28 else
29 break
31 shift
33 done
35 cname=$1
36 cname=$(echo ${cname/.o/.c})
37 if [[ "$cname" == "" ]] ; then
38 useage
40 if ! test -e $cname ; then
41 useage
44 oname=$(echo ${cname/.c/.o})
45 if ! echo $oname | grep .o$ > /dev/null ; then
46 useage
48 rm -f $oname
50 cur=$(pwd)
51 file_dir=$(dirname $oname)
52 o_short_name=$(basename $oname)
53 cd $file_dir
54 make CC="$PRE $CMD $POST $WINE_ARGS" $o_short_name
55 make $o_short_name
56 cd $cur