user_data2: don't set parameters to user_data
[smatch.git] / smatch_scripts / gen_err_ptr_list.sh
blob79c40c570b0a8b0761e678db632e3688891b45da
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 bin_dir=$(dirname $0)
16 remove=$(echo ${bin_dir}/../smatch_data/kernel.returns_err_ptr.remove)
17 tmp=$(mktemp /tmp/smatch.XXXX)
19 echo "// list of functions that return a new allocation." \
20 > kernel.returns_err_ptr
21 echo '// generated by `gen_err_ptr_list.sh`' >> kernel.returns_err_ptr
22 grep "returns_err_ptr$" $file | cut -s -d ' ' -f 2 | cut -d '(' -f 1 | \
23 sort -u > $tmp
24 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u \
25 >> kernel.returns_err_ptr
26 rm $tmp
27 echo "Done. List saved as 'kernel.returns_err_ptr'"