known_condition_true/false(): handle expression statements
[smatch.git] / smatch_scripts / gen_gfp_flags.sh
blob0f1aa96a7a8745fbd317a8537ac128ffaf62fde2
1 #!/bin/bash
3 file=$1
5 if [[ "$file" = "" ]] ; then
6 echo "Usage: $0 <file with smatch messages>"
7 exit 1
8 fi
10 outfile="kernel.gfp_flags"
11 bin_dir=$(dirname $0)
12 remove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove)
13 tmp=$(mktemp /tmp/smatch.XXXX)
14 tmp2=$(mktemp /tmp/smatch.XXXX)
16 echo "// list of GFP flag parameters." > $outfile
17 echo '// generated by `gen_gfp_flags.sh`' >> $outfile
18 ${bin_dir}/trace_params.pl $file kmalloc 1 >> $tmp
19 ${bin_dir}/trace_params.pl $file kzalloc 1 >> $tmp
20 ${bin_dir}/trace_params.pl $file kcalloc 2 >> $tmp
21 cat $tmp | sort -u > $tmp2
22 mv $tmp2 $tmp
23 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $outfile
24 rm $tmp
25 echo "Done. List saved as '$outfile'"