extra, db: we have to record every function call in the db
[smatch.git] / smatch_scripts / gen_no_return_funcs.sh
blobc78b7f8ea0dc7006a0dc337cce5d6c025e5d2789
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="no_return_funcs"
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 functions which don't return." > $outfile
17 echo '// generated by `gen_no_return_funcs.sh`' >> $outfile
18 cat $(echo ${bin_dir}/../smatch_data/no_return_funcs) >> $outfile
20 grep no_return_funcs $file | cut -d ' ' -f 3 | cut -d '(' -f 1 > $tmp
22 cat $tmp | sort -u > $tmp2
23 mv $tmp2 $tmp
24 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $outfile
25 rm $tmp
26 echo "Done. List saved as '$outfile'"
27 echo "Copy it to smatch_data/<project>.no_return_funcs"