clean up: move DIMPLIED() to smatch_implied.c
[smatch.git] / smatch_scripts / gen_err_ptr_list.sh
blobe6ec0b6099881f18a82141ea0e06173624a6a0dd
1 #!/bin/bash
3 file=$1
5 if [[ "$file" = "" ]] ; then
6 echo "Usage: $0 <file with smatch messages>"
7 exit 1
8 fi
10 bin_dir=$(dirname $0)
11 remove=$(echo ${bin_dir}/../smatch_data/kernel.returns_err_ptr.remove)
12 tmp=$(mktemp /tmp/smatch.XXXX)
14 echo "// list of functions that return a new allocation." \
15 > kernel.returns_err_ptr
16 echo '// generated by `gen_err_ptr_list.sh`' >> kernel.returns_err_ptr
17 grep "returns_err_ptr$" $file | cut -s -d ' ' -f 3 | cut -d '(' -f 1 | \
18 sort -u > $tmp
19 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u \
20 >> kernel.returns_err_ptr
21 rm $tmp
22 echo "Done. List saved as 'kernel.returns_err_ptr'"