| [2] | 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # This script parses the output of a gcc bootstrap when using warning
|
|---|
| 4 | # flags and determines various statistics.
|
|---|
| 5 | #
|
|---|
| 6 | # usage: warn_summary [-llf] [-s stage] [-nosub|-ch|-cp|-f|-java|-ada|-intl|-fixinc]
|
|---|
| 7 | # [-pass|-wpass] [file(s)]
|
|---|
| 8 | #
|
|---|
| 9 | # -llf
|
|---|
| 10 | # Filter out long lines from the bootstrap output before any other
|
|---|
| 11 | # action. This is useful for systems with broken awks/greps which choke
|
|---|
| 12 | # on long lines. It is not done by default as it sometimes slows things
|
|---|
| 13 | # down.
|
|---|
| 14 | #
|
|---|
| 15 | # -s number
|
|---|
| 16 | # Take warnings from stage "Number". Stage 0 means show warnings from
|
|---|
| 17 | # before and after the gcc bootstrap directory. E.g. libraries, etc.
|
|---|
| 18 | # This presupposes using "gcc -W*" for the stage1 compiler.
|
|---|
| 19 | #
|
|---|
| 20 | # -nosub
|
|---|
| 21 | # Only show warnings from the gcc top level directory.
|
|---|
| 22 | # -ch|-cp|-f|-java|-ada|-intl|-fixinc
|
|---|
| 23 | # Only show warnings from the specified language subdirectory.
|
|---|
| 24 | # These override each other so only the last one passed takes effect.
|
|---|
| 25 | #
|
|---|
| 26 | # -pass
|
|---|
| 27 | # Pass through the bootstrap output after filtering stage and subdir
|
|---|
| 28 | # (useful for manual inspection.) This is all lines, not just warnings.
|
|---|
| 29 | # -wpass
|
|---|
| 30 | # Pass through only warnings from the bootstrap output after filtering
|
|---|
| 31 | # stage and subdir.
|
|---|
| 32 | #
|
|---|
| 33 | # By Kaveh Ghazi ([email protected]) 12/13/97.
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 | # Some awks choke on long lines, sed seems to do a better job.
|
|---|
| 37 | # Truncate lines > 255 characters. RE '.\{255,\}' doesn't seem to work. :-(
|
|---|
| 38 | # Only do this if -llf was specified, because it can really slow things down.
|
|---|
| 39 | longLineFilter()
|
|---|
| 40 | {
|
|---|
| 41 | if test -z "$llf" ; then
|
|---|
| 42 | cat
|
|---|
| 43 | else
|
|---|
| 44 | sed 's/^\(...............................................................................................................................................................................................................................................................\).*/\1/'
|
|---|
| 45 | fi
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | # This function does one of three things. It either passes through
|
|---|
| 49 | # all warning data, or passes through gcc toplevel warnings, or passes
|
|---|
| 50 | # through a particular subdirectory set of warnings.
|
|---|
| 51 | subdirectoryFilter()
|
|---|
| 52 | {
|
|---|
| 53 | longLineFilter | (
|
|---|
| 54 | if test -z "$filter" ; then
|
|---|
| 55 | # Pass through all lines.
|
|---|
| 56 | cat
|
|---|
| 57 | else
|
|---|
| 58 | if test "$filter" = nosub ; then
|
|---|
| 59 | # Omit all subdirectories.
|
|---|
| 60 | egrep -v '/gcc/(ch|cp|f|java|intl|fixinc)/'
|
|---|
| 61 | else
|
|---|
| 62 | # Pass through only subdir $filter.
|
|---|
| 63 | grep "/gcc/$filter/"
|
|---|
| 64 | fi
|
|---|
| 65 | fi )
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | # This function displays all lines from stageN of the bootstrap. If
|
|---|
| 69 | # stage==0, then show lines prior to stage1 and lines from after the last
|
|---|
| 70 | # stage. I.e. utilities, libraries, etc.
|
|---|
| 71 | stageNfilter()
|
|---|
| 72 | {
|
|---|
| 73 | if test "$stageN" -lt 1 ; then
|
|---|
| 74 | # stage "0" means check everything *but* gcc.
|
|---|
| 75 | $AWK "BEGIN{t=1} ; /^Bootstrapping the compiler/{t=0} ; /^Building runtime libraries/{t=1} ; {if(t==1)print}"
|
|---|
| 76 | else
|
|---|
| |
|---|