1 #!/bin/bash 2 3 new=$1 4 old=$2 5 6 if [ "$old" = "" ] ; then 7 echo "usage: $0 <new file> <old file>" 8 exit 1 9 fi 10 11 # 12 # If the $old and $new are very similar then we can 13 # filter out a lot of bug just by doing a diff. 14 # 15 # But the line numbers change quite frequently so 16 # really we only want to see if the line numbers 17 # have changed inside the function. 18 # The 42 in this message: 19 # file.c +123 some_func(42) warn: blah blah blah 20 # 21 22 IFS=" 23 " 24 for err in $(diff -u $old $new | cut -b 2- | egrep '(warn|error|warning):') ; do 25 26 # we are only interested in the last chunk. 27 # "some_func(42) warn: blah blah blah" 28 last=$(echo $err | cut -d ' ' -f 2-) 29 30 # There are some error message which include a second 31 # line number so we crudely chop that off. 32 last=$(echo $last | sed -e 's/line .*//') 33 34 if ! grep -Fq "$last" $old ; then 35 echo $err 36 fi 37 done