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