expressions: make assign_expression() take an op argument
[smatch.git] / smatch_scripts / gen_gfp_flags.sh
blob2c7ea98b5b334f27730648957f6dc89c0743f5ed
1 #!/bin/bash
3 file=$1
4 project=$(echo "$2" | cut -d = -f 2)
6 if [[ "$file" = "" ]] ; then
7 echo "Usage: $0 <file with smatch messages> -p=<project>"
8 exit 1
9 fi
11 if [[ "$project" != "kernel" ]] ; then
12 exit 0
15 outfile="kernel.gfp_flags"
16 bin_dir=$(dirname $0)
17 remove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove)
18 tmp=$(mktemp /tmp/smatch.XXXX)
19 tmp2=$(mktemp /tmp/smatch.XXXX)
21 echo "// list of GFP flag parameters." > $outfile
22 echo '// generated by `gen_gfp_flags.sh`' >> $outfile
23 ${bin_dir}/trace_params.pl $file kmalloc 1 >> $tmp
24 ${bin_dir}/trace_params.pl $file kzalloc 1 >> $tmp
25 ${bin_dir}/trace_params.pl $file kcalloc 2 >> $tmp
26 cat $tmp | sort -u > $tmp2
27 mv $tmp2 $tmp
28 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $outfile
29 rm $tmp
30 echo "Done. List saved as '$outfile'"