egcs-l9980418

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue Apr 21 17:06:00 GMT 1998


 > From: Jeffrey A Law <law@cygnus.com>
 > 
 >   In message < 199804201451.MAA24804@nitro.avint.net >you write:
 >   > 
 >   > There were hundreds of warnings and a few test failures.  Is this
 >   > considered material for a bug report?  The compiler appears to
 >   > be working ok.. I have built a few programs with it.
 > 
 > This is normal.  Not too long ago we turned on extra warnings while
 > building the compiler.  We are working to eliminate them.
 > 
 > Depending on the target, you'll get somewhere around a thousand
 > warnings.  There's even a script floating around somewhere to
 > summarize the warnings.
 > jeff

	That's down from eight thousand warnings several months ago!
Here's the most recent copy of my "warns" script. 

		--Kaveh

#!/bin/sh
# This script parses the output of a gcc bootstrap when using warning
# flags and determines various statistics.
#
# By Kaveh Ghazi  (ghazi@caip.rutgers.edu)  12/13/97.

# This function displays all warnings from stageN of the bootstrap.
stageNwarns()
{
  stageNminus1=`expr $stageN - 1`
# Some awks choke on long lines so grep them out.
  grep -v libf2c.a $1 | \
	$AWK "/ warning: /{if(t==1)print} ; /stage$stageNminus1/{if(t==0)t=1} ; /stage$stageN/{if(t==1)t=0}"
}

usage="usage: `basename $0` [-s stage] [file(s)]"
stageN=3

# Find a good awk.
if test -z "$AWK" ; then
  for AWK in gawk nawk awk ; do
    if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then
      :
    else
      break
    fi
  done
fi

while test -n "$1" ; do
 case "$1" in
   -s)  if test -z "$2"; then echo $usage; exit 1; fi; stageN="$2"; shift 2 ;;
   -s*) stageN="`expr $1 : '-s\(.*\)'`" ; shift ;;
   -*)  echo $usage ; exit 1 ;;
   *)   break ;;
 esac
done



for file in "$@" ; do

  count=`stageNwarns $file | wc -l`
  echo There are $count warnings in stage$stageN of this bootstrap.

  echo
  echo Number of warnings per file:
  stageNwarns $file | $AWK -F: '{print$1}' | sort | uniq -c | sort -nr

  echo
  echo Number of warning types:
  stageNwarns $file | sed 's/.*warning: //; 
		s/`\(int\)'"'"'/"\1"/g;
		s/`\(char\)'"'"'/"\1"/g;
		s/`\(inline\)'"'"'/"\1"/g;
		s/`\(else\)'"'"'/"\1"/g;
		s/`\(return\)'"'"'/"\1"/g;
		s/`\(static\)'"'"'/"\1"/g;
		s/`\(extern\)'"'"'/"\1"/g;
		s/`\(longjmp\)'"'"' or `\(vfork\)'"'"'/"\1" or "\2"/g;
		s/`'"[^']*'/"'`???'"'/g;"'
		s/.*format, .* arg (arg [0-9]*)/??? format, ??? arg (arg ???)/;
		s/(arg [0-9]*)/(arg ???)/;
		s/"\([^"]*\)"/`\1'"'"'/g' | \
	sort | uniq -c | sort -nr

done



More information about the Gcc mailing list