+# This function replaces `xxx' with `???', where xxx is usually some
+# variable or function name. This allows similar warnings to be
+# counted together when summarizing. However it avoids replacing
+# certain C keywords which are known appear in various messages.
+
+keywordFilter() {
+ sed 's/.*warning: //;
+ s/`\(int\)'"'"'/"\1"/g;
+ s/`\(long\)'"'"'/"\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/`\(const\)'"'"'/"\1"/g;
+ s/`\(noreturn\)'"'"'/"\1"/g;
+ s/`\(longjmp\)'"'"' or `\(vfork\)'"'"'/"\1" or "\2"/g;
+ s/'"[\`'][^']*'/"'"???"/g;
+ s/.*format, .* arg (arg [0-9][0-9]*)/??? format, ??? arg (arg ???)/;
+ s/\([( ]\)arg [0-9][0-9]*\([) ]\)/\1arg ???\2/;
+ 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%^[^ ]*/\(fixincludes/\)%\1%;
+s%^[^ ]*/\(sim/\)%\1%;
+s%^[^ ]*/\(newlib/\)%\1%;
+s%^[^ ]*/\(mpfr/\)%\1%;
+s%^[^ ]*/\(lib[a-z23+-]*/\)%\1%;'
+}
+
+# Start the main section.
+
+usage="usage: `basename $0` [-llf] [-s stage] [-nosub|-ch|-cp|-f|-fortran|-java|-ada|-intl|-fixinc] [-pass|-wpass] [file(s)]"
+stageN=3
+tmpfile=/tmp/tmp-warn.$$
+
+# Remove $tmpfile on exit and various signals.
+trap "rm -f $tmpfile" 0
+trap "rm -f $tmpfile ; exit 1" 1 2 3 5 9 13 15
+