Commit c097fab6 by Kaveh R. Ghazi Committed by Kaveh Ghazi

warn_summary: Fix subdirectory filtering.

	* warn_summary: Fix subdirectory filtering.  Add -intl and -fixinc
	subdirectory flags.  Add source directory prefix filtering.
	Redirect diagnostic output to stderr.

From-SVN: r38260
parent e7103ad2
2000-12-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* warn_summary: Fix subdirectory filtering. Add -intl and -fixinc
subdirectory flags. Add source directory prefix filtering.
Redirect diagnostic output to stderr.
2000-12-07 Zack Weinberg <zack@wolery.stanford.edu> 2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
* texi2pod.pl: If multiple @c man sections with the same tag * texi2pod.pl: If multiple @c man sections with the same tag
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# This script parses the output of a gcc bootstrap when using warning # This script parses the output of a gcc bootstrap when using warning
# flags and determines various statistics. # flags and determines various statistics.
# #
# usage: warn_summary [-llf] [-s stage] [-nosub|-ch|-cp|-f|-java] # usage: warn_summary [-llf] [-s stage] [-nosub|-ch|-cp|-f|-java|-intl|-fixinc]
# [-pass|-wpass] [file(s)] # [-pass|-wpass] [file(s)]
# #
# -llf # -llf
...@@ -19,10 +19,9 @@ ...@@ -19,10 +19,9 @@
# #
# -nosub # -nosub
# Only show warnings from the gcc top level directory. # Only show warnings from the gcc top level directory.
# -ch|-cp|-f|-java # -ch|-cp|-f|-java|-intl|-fixinc
# Only show warnings from the specified language subdirectory. # Only show warnings from the specified language subdirectory.
# These flags assume the output contains "Entering/Leaving" messages from # These override each other so only the last one passed takes effect.
# gnu make. They override each other so only the last one takes effect.
# #
# -pass # -pass
# Pass through the bootstrap output after filtering stage and subdir # Pass through the bootstrap output after filtering stage and subdir
...@@ -40,9 +39,9 @@ ...@@ -40,9 +39,9 @@
longLineFilter() longLineFilter()
{ {
if test -z "$llf" ; then if test -z "$llf" ; then
cat $1 cat
else else
sed 's/^\(...............................................................................................................................................................................................................................................................\).*/\1/' $1 sed 's/^\(...............................................................................................................................................................................................................................................................\).*/\1/'
fi fi
} }
...@@ -51,17 +50,17 @@ longLineFilter() ...@@ -51,17 +50,17 @@ longLineFilter()
# through a particular subdirectory set of warnings. # through a particular subdirectory set of warnings.
subdirectoryFilter() subdirectoryFilter()
{ {
longLineFilter $1 | ( longLineFilter | (
if test -z "$filter" ; then if test -z "$filter" ; then
# Pass through all lines. # Pass through all lines.
cat cat
else else
if test "$filter" = nosub ; then if test "$filter" = nosub ; then
# Omit all subdirectories. # Omit all subdirectories.
$AWK 'BEGIN{t=1} ; /Entering directory.*\/gcc\/[a-z]/{t--} ; /Leaving directory.*\/gcc\/[a-z]/{t++} ; {if(t==1)print}' egrep -v '/gcc/(ch|cp|f|java|intl|fixinc)/'
else else
# Pass through only subdir $filter. # Pass through only subdir $filter.
$AWK "BEGIN {t=-1} ; /^cd $filter; make/{t=0} ; /Entering directory .*\/gcc\/$filter/{t++} ; /Leaving directory .*\/gcc\/$filter/{t--} ; {if(t==1)print}" grep "/gcc/$filter/"
fi fi
fi ) fi )
} }
...@@ -87,7 +86,7 @@ stageNfilter() ...@@ -87,7 +86,7 @@ stageNfilter()
# This function displays lines containing warnings. # This function displays lines containing warnings.
warningFilter() warningFilter()
{ {
grep ' warning: ' $1 grep ' warning: '
} }
# This function replaces `xxx' with `???', where xxx is usually some # This function replaces `xxx' with `???', where xxx is usually some
...@@ -114,10 +113,26 @@ keywordFilter() { ...@@ -114,10 +113,26 @@ keywordFilter() {
s/"\([^"]*\)"/`\1'"'"'/g' s/"\([^"]*\)"/`\1'"'"'/g'
} }
# This function strips out relative pathnames for source files printed
# by the warningFilter function. This is done so that as the snapshot
# directory name changes every week, the output of this program can be
# compared to previous runs without spurious diffs caused by source
# directory name changes.
srcdirFilter()
{
sed '
s%^[^ ]*/\(gcc/\)%\1%;
s%^[^ ]*/\(include/\)%\1%;
s%^[^ ]*/\(texinfo/\)%\1%;
s%^[^ ]*/\(fastjar/\)%\1%;
s%^[^ ]*/\(zlib/\)%\1%;
s%^[^ ]*/\(lib[a-z23+-]*/\)%\1%;'
}
# Start the main section. # Start the main section.
usage="usage: `basename $0` [-llf] [-s stage] [-nosub|-ch|-cp|-f|-java] [-pass|-wpass] [file(s)]" usage="usage: `basename $0` [-llf] [-s stage] [-nosub|-ch|-cp|-f|-java|-intl|-fixinc] [-pass|-wpass] [file(s)]"
stageN=3 stageN=3
tmpfile=/tmp/tmp-warn.$$ tmpfile=/tmp/tmp-warn.$$
...@@ -140,12 +155,13 @@ fi ...@@ -140,12 +155,13 @@ fi
while test -n "$1" ; do while test -n "$1" ; do
case "$1" in case "$1" in
-llf) llf=1 ; shift ;; -llf) llf=1 ; shift ;;
-s) if test -z "$2"; then echo $usage; exit 1; fi; stageN="$2"; shift 2 ;; -s) if test -z "$2"; then echo $usage 1>&2; exit 1; fi
stageN="$2"; shift 2 ;;
-s*) stageN="`expr $1 : '-s\(.*\)'`" ; shift ;; -s*) stageN="`expr $1 : '-s\(.*\)'`" ; shift ;;
-nosub|-ch|-cp|-f|-java) filter="`expr $1 : '-\(.*\)'`" ; shift ;; -nosub|-ch|-cp|-f|-java|-intl|-fixinc) filter="`expr $1 : '-\(.*\)'`" ; shift ;;
-pass) pass=1 ; shift ;; -pass) pass=1 ; shift ;;
-wpass) pass=w ; shift ;; -wpass) pass=w ; shift ;;
-*) echo $usage ; exit 1 ;; -*) echo $usage 1>&2 ; exit 1 ;;
*) break ;; *) break ;;
esac esac
done done
...@@ -153,17 +169,17 @@ done ...@@ -153,17 +169,17 @@ done
# Check for a valid value of $stageN. # Check for a valid value of $stageN.
case "$stageN" in case "$stageN" in
[0-9]) ;; [0-9]) ;;
*) echo "Stage <$stageN> must be in the range [0..9]." ; exit 1 ;; *) echo "Stage <$stageN> must be in the range [0..9]." 1>&2 ; exit 1 ;;
esac esac
for file in "$@" ; do for file in "$@" ; do
subdirectoryFilter $file | stageNfilter > $tmpfile stageNfilter < $file | subdirectoryFilter > $tmpfile
# (Just) show me the warnings. # (Just) show me the warnings.
if test "$pass" != '' ; then if test "$pass" != '' ; then
if test "$pass" = w ; then if test "$pass" = w ; then
warningFilter $tmpfile warningFilter < $tmpfile
else else
cat $tmpfile cat $tmpfile
fi fi
...@@ -179,15 +195,16 @@ for file in "$@" ; do ...@@ -179,15 +195,16 @@ for file in "$@" ; do
echo "Counting warnings in the gcc/$filter subdirectory," echo "Counting warnings in the gcc/$filter subdirectory,"
fi fi
fi fi
count=`warningFilter $tmpfile | wc -l` count=`warningFilter < $tmpfile | wc -l`
echo there are $count warnings in stage$stageN of this bootstrap. echo there are $count warnings in stage$stageN of this bootstrap.
echo echo
echo Number of warnings per file: echo Number of warnings per file:
warningFilter $tmpfile | $AWK -F: '{print$1}' | sort | uniq -c | sort -nr warningFilter < $tmpfile | srcdirFilter | $AWK -F: '{print$1}' | sort | \
uniq -c | sort -nr
echo echo
echo Number of warning types: echo Number of warning types:
warningFilter $tmpfile | keywordFilter | sort | uniq -c | sort -nr warningFilter < $tmpfile | keywordFilter | sort | uniq -c | sort -nr
done done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment