expressions: make assign_expression() take an op argument
[smatch.git] / smatch_scripts / gen_sizeof_param.sh
blob8f4e5f7493c0c413f7a312bfb1667b82a6e6fe71
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 outfile="${project}.sizeof_param"
12 bin_dir=$(dirname $0)
13 remove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove)
14 tmp=$(mktemp /tmp/smatch.XXXX)
15 tmp2=$(mktemp /tmp/smatch.XXXX)
18 echo "// list of function parameters that are the size of a buffer." > $outfile
19 echo '// generated by `gen_sizeof_param.sh`' >> $outfile
21 grep sizeof_param $file | grep '[0-9] [0-9]$' | cut -d ' ' -f 5- | \
22 sort -u | sed -e "s/'//g" > $tmp
23 grep sizeof_param $file | grep '[0-9] -1$' | cut -d ' ' -f 5- | \
24 sort -u | sed -e "s/'//g" >> $tmp
25 grep -f $remove $tmp >> $tmp2 2> /dev/null
26 cat $tmp $tmp2 2> /dev/null | sort | uniq -u >> $outfile
27 rm $tmp
28 rm $tmp2
30 echo "Done. List saved as '$outfile'"