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
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.
Author: Mark Wielaard <mjw(a)redhat.com>
Date: Mon Apr 11 16:34:17 2011 +0200
dwarflint: check_dups_abstract_origin use wr_message id for filtering
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
@@ -258,7 +258,7 @@ wr_verror (const struct where *wh, const char *format, va_list ap)
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");
@@ -279,7 +279,11 @@ wr_message (unsigned long category, const struct where *wh,
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?