[cfe-dev] proposal: every warning should have a -W flag

David Blaikie dblaikie at gmail.com
Tue Aug 9 14:10:42 PDT 2011


> (1) We aim to gradually put all existing warnings under a -W flag.  Multiple (related) warnings can be placed under the same -W flag (as they are often done now), but the main idea is to allow users to control these warnings.

Is it worth considering whether they should all be under separate
flags (eg: VC numbers each diagnostic uniquely - the numbers are a bit
annoying, but it does make finding documentation/discussions on the
issues relatively easy & I can imagine we might end up with some
difficulty uniquely naming certain diagnostics)? I suppose I could see
the benefit of two technically distinct diagnostics being grouped
under the same name because they're different phrasings of the same
problem. At which point it's just a policy/semantic thing where we try
not to group things that aren't really tightly related - fuzzier to
keep track of, but possibly the right thing to do.

> (2) We require all new warnings to include a -W flag the moment they are added to Clang.  We can enforce this by using diagtool in our tests (e.g., verify that the set of warnings without flags hasn't changed).

I assume eventually this would be enforced syntactically (I don't know
enough about how the tblgen works to generate the diagnostic messages
- but would the documentation be able to be included alongside the
diagnostic message itself? I suppose that only works if it's a 1-1
mapping, otherwise you'd need some kind of grouping structure in the
tblgen itself such that no diagnostic could be outside a -W group.
That would also be awkward because each diagnostic would be in a
single place in the hierarchy while still possibly belonging to
multiple -W groups?)

- David




More information about the cfe-dev mailing list