1 #!/bin/bash 2 3 file=$1 4 project=$(echo "$2" | cut -d = -f 2) 5 6 if [[ "$file" = "" ]] ; then 7 echo "Usage: $0 <file with smatch messages> -p=<project>" 8 exit 1 9 fi 10 11 bin_dir=$(dirname $0) 12 remove=$(echo ${bin_dir}/../smatch_data/${project}.bit_shifters.remove) 13 tmp=$(mktemp /tmp/smatch.XXXX) 14 15 echo "// list of macros used as shifters." \ 16 > ${project}.bit_shifters 17 echo '// generated by `gen_bit_shifters.sh`' >> ${project}.bit_shifters 18 grep "info: bit shifter" $file | cut -s -d "'" -f 2- | sed -e "s/'//g" | sort -u > $tmp 19 20 cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> ${project}.bit_shifters 21 rm $tmp 22 echo "Done. List saved as '${project}.bit_shifters'" 23