core: make fake cur_slists stackable
[smatch.git] / smatch_scripts / gen_array_bounds.sh
blob8ff436065ef228ebcaf866a2fa15fe2e2fdfcd86
1 #!/bin/bash
3 file=$1
5 if [[ "$file" = "" ]] ; then
6 echo "Usage: $0 <file with smatch messages>"
7 exit 1
8 fi
10 new_file=kernel.array_bounds
11 bin_dir=$(dirname $0)
12 remove=$(echo ${bin_dir}/../smatch_data/kernel.array_bounds.remove)
13 tmp=$(mktemp /tmp/smatch.XXXX)
15 echo "// the format is: function <param> <max in array>" > $new_file
16 echo '// generated by `gen_puts_list.sh`' >> $new_file
17 grep "array index" warns.txt | sed -e 's/(.*)//' | cut -d ' ' -f 3,6,10 | sort -u > $tmp
18 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> $new_file
19 rm $tmp
20 echo "Done. List saved as 'kernel.puts_argument'"