db: set parse_error if the SQL fails
[smatch.git] / smatch_scripts / gen_sizeof_param.sh
blob3ff906000c09af300547ef73fba624aab0d956aa
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 -f $remove $tmp >> $tmp2
24 cat $tmp $tmp2 2> /dev/null | sort | uniq -u >> $outfile
25 rm $tmp
26 rm $tmp2
28 echo "Done. List saved as '$outfile'"