Or vs and: warn about bitwise ANDs that always give zero
[smatch.git] / smatch_scripts / gen_bit_shifters.sh
blob0e8adaab0cc91dd12b4a29c30ca641d70c1b2923
1 #!/bin/bash
3 file=$1
5 if [[ "$file" = "" ]] ; then
6 echo "Usage: $0 <file with smatch messages>"
7 exit 1
8 fi
10 bin_dir=$(dirname $0)
11 remove=$(echo ${bin_dir}/../smatch_data/kernel.bit_shifters.remove)
12 tmp=$(mktemp /tmp/smatch.XXXX)
14 echo "// list of macros used as shifters." \
15 > kernel.bit_shifters
16 echo '// generated by `gen_bit_shifters.sh`' >> kernel.bit_shifters
17 grep "info: bit shifter" $file | cut -s -d "'" -f 2- | sed -e "s/'//g" | sort -u > $tmp
19 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> kernel.bit_shifters
20 rm $tmp
21 echo "Done. List saved as 'kernel.bit_shifters'"