expressions: make assign_expression() take an op argument
[smatch.git] / smatch_scripts / gen_expects_err_ptr.sh
blob83dbe8fffd35235ee1d1546b16d25060f9db815c
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 if [[ "$project" != "kernel" ]] ; then
12 exit 0
15 outfile="kernel.expects_err_ptr"
16 bin_dir=$(dirname $0)
17 remove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove)
18 tmp=$(mktemp /tmp/smatch.XXXX)
20 echo "// list of functions which expect an ERR_PTR." > $outfile
21 echo '// generated by `gen_expects_err_ptr.sh`' >> $outfile
22 grep -w "expects ERR_PTR" $file | cut -d ' ' -f 2,6 | \
23 sed -e 's/([1234567890]*)//' | sort -u > $tmp
24 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $outfile
25 rm $tmp
26 echo "Done. List saved as '$outfile'"