This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [dwarflint] Default to 16 dups


On Sat, 2011-04-09 at 00:21 +0200, Petr Machata wrote:
> The message counting is keyed by the address of the first string sent to
> the stream and counted.  That means that non-unique strings that are
> merged by GCC are not considered separate messages, and that dynamically
> generated strings are not filtered at all.  This can be mended by
> stating the key explicitly like so:
> 
>     wr_message (wh, mc_error).id (msgid) << "blah" //...

I added one to check_dups_abstract_origin.

commit 41aa345222e2981e395fecb9c498885253063409
Author: Mark Wielaard <mjw@redhat.com>
Date:   Mon Apr 11 16:34:17 2011 +0200

   dwarflint: check_dups_abstract_origin use wr_message id for filtering
dups.

> There's currently no standard way to obtain msgids.  It's simply a void*
> as of now.  I'm using check descriptor in a couple places as the id,
> with the downside that all messages in one check get one counter.

I think this is fine (at least for now).

The duplication checking doesn't currently work for non-stream based
wr_messages that take a format string. The following makes it work for
those too (which really helps when you have lots of low level checks
firing the same message over and over again, just try dwarflint on
dwarflint itself and see all the range warnings).

diff --git a/dwarflint/messages.cc b/dwarflint/messages.cc
index 2c0810e..995220c 100644
--- a/dwarflint/messages.cc
+++ b/dwarflint/messages.cc
@@ -258,7 +258,7 @@ wr_verror (const struct where *wh, const char *format, va_list ap)
 static void
 wr_vwarning (const struct where *wh, const char *format, va_list ap)
 {
-  printf ("warning: %s", where_fmt (wh, NULL));
+  printf ("%s", where_fmt (wh, NULL));
   vprintf (format, ap);
   where_fmt_chain (wh, "warning");
   ++error_count;
@@ -279,7 +279,11 @@ wr_message (unsigned long category, const struct where *wh,
 {
   va_list ap;
   va_start (ap, format);
-  if (message_accept (&warning_criteria, category))
+  // Clumsy duplicate filtering. Use format as key.
+  bool whether = false;
+  message_category cat = (message_category) category;
+  wr_message (cat).id (format, whether);
+  if (whether && message_accept (&warning_criteria, category))
     {
       if (message_accept (&error_criteria, category))
        wr_verror (wh, format, ap);

This is slightly ugly (because we ask for the id () filtering the
"warning: " string is already printed), but seems to work fine. Does
this make sense, or is there a cleaner way to do it?

Thanks,

Mark



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]