[cfe-dev] Warning flags
kremenek at apple.com
Thu Oct 6 13:16:37 PDT 2011
On Oct 6, 2011, at 10:21 AM, Ahmed Charles wrote:
> I'm looking into adding flags for the various warnings without them and was wondering what the bar is in terms of test cases? It seems like existing flags don't have explicit test cases and in some cases neither do the warnings.
Good questions. These are two separate issues. It's simply bad that we have warnings that aren't being tested at all (behaviorally). For those we should continue to add test cases to improve our coverage of the compiler's behavior.
For testing coverage of warning flags, the only thing you could really test from a behavior perspective is whether passing -W/-Wno<warning> enables/disables the warning (or use pragmas that accomplish the same thing). Many warnings are on by default, so many of the tests would need to go for the "disable warning" route. We are pretty confident that the general warning suppression/enabling mechanism works (it is well tested), so we only really need to add specific tests like these for warnings where it is clear we want to tease out some warning from a larger class of warnings and have the ability to disable it (e.g., a user explicitly requested this functionality).
So, for testing whether or not a warning has a flag, we have test/Misc/warning-flags.c. Essentially we run diagtool to list all the warnings that are not covered by a flag. Whenever a warning that was previously not covered by a flag gets a flag, this test needs to be updated (i.e., remove the entry). That's usually sufficient in my opinion to test that a warning is covered by a flag.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev