2 # This script parses the output of a gcc bootstrap when using warning
3 # flags and determines various statistics.
5 # By Kaveh Ghazi (ghazi@caip.rutgers.edu) 12/13/97.
7 # This function displays all warnings from stageN of the bootstrap.
10 stageNminus1=`expr $stageN - 1`
11 # Some awks choke on long lines so grep them out.
12 grep -v libf2c.a $1 | \
13 $AWK "/ warning: /{if(t==1)print} ; /stage$stageNminus1/{if(t==0)t=1} ; /stage$stageN/{if(t==1)t=0}"
16 usage="usage: `basename $0` [-s stage] [file(s)]"
20 if test -z "$AWK" ; then
21 for AWK in gawk nawk awk ; do
22 if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then
30 while test -n "$1" ; do
32 -s) if test -z "$2"; then echo $usage; exit 1; fi; stageN="$2"; shift 2 ;;
33 -s*) stageN="`expr $1 : '-s\(.*\)'`" ; shift ;;
34 -*) echo $usage ; exit 1 ;;
43 count=`stageNwarns $file | wc -l`
44 echo There are $count warnings in stage$stageN of this bootstrap.
47 echo Number of warnings per file:
48 stageNwarns $file | $AWK -F: '{print$1}' | sort | uniq -c | sort -nr
51 echo Number of warning types:
52 stageNwarns $file | sed 's/.*warning: //;
53 s/`\(int\)'"'"'/"\1"/g;
54 s/`\(char\)'"'"'/"\1"/g;
55 s/`\(inline\)'"'"'/"\1"/g;
56 s/`\(else\)'"'"'/"\1"/g;
57 s/`\(return\)'"'"'/"\1"/g;
58 s/`\(static\)'"'"'/"\1"/g;
59 s/`\(extern\)'"'"'/"\1"/g;
60 s/`\(longjmp\)'"'"' or `\(vfork\)'"'"'/"\1" or "\2"/g;
61 s/`'"[^']*'/"'`???'"'/g;"'
62 s/.*format, .* arg (arg [0-9]*)/??? format, ??? arg (arg ???)/;
63 s/(arg [0-9]*)/(arg ???)/;
64 s/"\([^"]*\)"/`\1'"'"'/g' | \
65 sort | uniq -c | sort -nr