hooks: add a warning to detect unimplemented hooks
[smatch.git] / smatch_scripts / gen_no_return_funcs.sh
blob713456c04aac9b9b088f8122c32a2a03a9b6fab1
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}.no_return_funcs"
12 bin_dir=$(dirname $0)
13 add_file=$(echo ${bin_dir}/../smatch_data/${outfile}.add)
14 remove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove)
15 tmp=$(mktemp /tmp/smatch.XXXX)
16 tmp2=$(mktemp /tmp/smatch.XXXX)
18 echo "// list of functions which don't return." > $outfile
19 echo '// generated by `gen_no_return_funcs.sh`' >> $outfile
20 cat $(echo ${bin_dir}/../smatch_data/no_return_funcs) >> $outfile
21 cat $add_file >> $outfile 2> /dev/null
23 grep no_return_funcs $file | cut -d ' ' -f 2 | cut -d '(' -f 1 > $tmp
25 cat $tmp | sort -u > $tmp2
26 mv $tmp2 $tmp
27 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $outfile
28 rm $tmp
29 echo "Done. List saved as '$outfile'"
30 echo "Copy it to smatch_data/<project>.no_return_funcs"