move up apply_ctype()'s declaration
[smatch.git] / smatch_scripts / new_bugs.sh
blobfd27359665f941ffccb431117325515e44051f33
1 #!/bin/bash
3 new=$1
4 old=$2
6 if [ "$old" = "" ] ; then
7 echo "usage: $0 <new file> <old file>"
8 exit 1
9 fi
12 # If the $old and $new are very similar then we can
13 # filter out a lot of bug just by doing a diff.
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
22 IFS="
24 for err in $(diff -u $old $new | cut -b 2- | egrep '(warn|error|warning):') ; do
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-)
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 .*//')
34 if ! grep -Fq "$last" $old ; then
35 echo $err
37 done