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
11bin_dir=$(dirname $0)
12remove=$(echo ${bin_dir}/../smatch_data/${project}.bit_shifters.remove)
13tmp=$(mktemp /tmp/smatch.XXXX)
14
15echo "// list of macros used as shifters." \
16    > ${project}.bit_shifters
17echo '// generated by `gen_bit_shifters.sh`' >> ${project}.bit_shifters
18grep "info: bit shifter" $file | cut -s -d "'" -f 2- | sed -e "s/'//g" | sort -u > $tmp
19
20cat $tmp $remove $remove 2> /dev/null | sort | uniq -u >> ${project}.bit_shifters
21rm $tmp
22echo "Done.  List saved as '${project}.bit_shifters'"
23
24