states: add another read_only check
[smatch.git] / smatch_scripts / gen_expects_err_ptr.sh
blob96c5968e7fa275f93b038684b7cd1d009b76bcdc
1 #!/bin/bash
3 file=$1
5 if [[ "$file" = "" ]] ; then
6 echo "Usage: $0 <file with smatch messages>"
7 exit 1
8 fi
11 outfile="kernel.expects_err_ptr"
12 bin_dir=$(dirname $0)
13 remove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove)
14 tmp=$(mktemp /tmp/smatch.XXXX)
16 echo "// list of functions which expect an ERR_PTR." > $outfile
17 echo '// generated by `gen_expects_err_ptr.sh`' >> $outfile
18 grep -w "expects ERR_PTR" $file | cut -d ' ' -f 2,6 | \
19 sed -e 's/([1234567890]*)//' | sort -u > $tmp
20 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $outfile
21 rm $tmp
22 echo "Done. List saved as '$outfile'"