[cfe-dev] numbered warnings & errors?

Daniel Dunbar daniel at zuster.org
Thu Dec 24 00:09:00 PST 2009

2009/12/23 Chandler Carruth <chandlerc at google.com>:
> On Wed, Dec 23, 2009 at 9:43 PM, Zhanyong Wan (λx.x x) <wan at google.com> wrote:
>> Hi,
>> Sorry if this has been discussed before.  What do people say to
>> assigning each warning/error a number and printing that number as part
>> of the compiler message, like what MSVC does?
>> When we see a compiler error/warning, often we need to read up on what
>> it really means.  A unique number is much easier to search for than
>> the actual message, which can change from one version of Clang to
>> another.  Also different warnings/errors may have similar messages,
>> making a search even harder.
>> Unique error/warning numbers also make it easier to suppress warnings
>> using -W or #pragma.  When I see a warning message, I can suppress it
>> using the warning number in it.  I don't have to look up the symbolic
>> ID of the warning from the Clang documentation.  (While this problem
>> can be solved by printing the symbolic ID as part of the message, it's
>> visually more intrusive.)
> Personally, I'd accept the intrusion to have something easier than a
> number to refer to. It should be equally searchable. But I do agree
> with printing some identifier, whatever form it takes.

I also found the MSVC warning numbers to be really useful in practice,
but want something better. A proposal I thought about making, but
haven't actually written, was to organize diagnostics into a compact
reverse dotted notation. The idea being that a fully dotted warning
should be easy to google / search docs for, and the components in the
dot could be useful for organization and high level grouping.

I'm not in a particular rush to see this problem solved though,
because a lot of the value of having stable warning numbers/names is
in the stability, so letting our diagnostics bake for a while is good.

I'm also curious about alternate approaches which don't rely on
exposing a stable name to the user (for example, by having the
compiler embed some of the documentation, which could then have a
verbose link to more information -- it would still be keyed by some
number + version, but not in a way that needs to be stable).

 - Daniel

>> Thoughts?  Thanks,
>> --
>> Zhanyong
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list