clean up in merge_slist()
[smatch.git] / smatch_scripts / gen_frees_list.sh
bloba6d01ccd8d0b77d334919b6e304e9953c8cce607
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.frees_argument.remove)
12 tmp=$(mktemp /tmp/smatch.XXXX)
14 echo "// list of functions and the argument they free." > kernel.frees_argument
15 echo '// generated by `gen_frees_list.sh`' >> kernel.frees_argument
16 grep -w free_arg $file | cut -d ' ' -f 3- >> $tmp
17 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> kernel.frees_argument
18 rm $tmp
19 echo "Done. List saved as 'kernel.frees_argument'"