sval: cast the result in sval_binop()
[smatch.git] / smatch_scripts / gen_sizeof_param.sh
blob544b8bad47507b479546c9712cc73d79c566f8e7
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.sizeof_param"
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)
17 echo "// list of function parameters that are the size of a buffer." > $outfile
18 echo '// generated by `gen_sizeof_param.sh`' >> $outfile
20 cat $file | grep sizeof_param | grep '[0-9] [0-9]$' | cut -d ' ' -f 5- | \
21 sort -u | sed -e "s/'//g" > $tmp
22 grep -f $remove $tmp >> $tmp2
23 cat $tmp $tmp2 2> /dev/null | sort | uniq -u >> $outfile
24 rm $tmp
25 rm $tmp2
27 echo "Done. List saved as '$outfile'"