public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: egcs@cygnus.com
Subject: egcs, script to summarize stage3 warning output
Date: Mon, 16 Feb 1998 16:56:00 -0000	[thread overview]
Message-ID: <199802162134.QAA06678@caip.rutgers.edu> (raw)

	Here is the script I've been using to parse the stage3 output
from a bootstrap and summarize the warning diagnostics.  Just do a
bootstrap into a file and run it as "warns [bootstrap-outputfile]".  Its
useful to help understand where to focus your efforts, either on a
particular file or on a particular warning type. 

	I've just done three particularly noisy files, fold-const.c,
haifa-sched.c and cp/method.c using this script to choose them.
(Patches forthcoming after some testing.)  I hope someone finds the
script useful.  Now that -W -Wall is on by default, if you find
yourself in a file for any reason, see if you can whack a few warnings
while you're at it. :-)

		--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 stage3 of the bootstrap.
stage3warns()
{
# Some awks choke on long lines so grep them out.
  grep -v libf2c.a $1 | \
	$AWK '/ warning: /{if(t==1)print} ; /stage2/{if(t==0)t=1}'
}

# 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

for file in "$@" ; do

  count=`stage3warns $file | wc -l`
  echo There are $count warnings in stage3 of this bootstrap.

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

  echo
  echo Number of warning types:
  stage3warns $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

                 reply	other threads:[~1998-02-16 16:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199802162134.QAA06678@caip.rutgers.edu \
    --to=ghazi@caip.rutgers.edu \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).