[cfe-dev] Request for comments on proposed patch for warning "levels" support
Sohail Somani
sohail at taggedtype.net
Tue Mar 1 09:04:26 PST 2011
Hi,
I'm working on an implementation for part of the #pragma warning from
Visual C++[1]. An example is below:
// regular code here
code()
// Coming across safe code that triggers warnings at level 4
#pragma warning(push,3)
// code that triggers warnings at level 4
// silenced because we set the level to 3 above
#pragma warning(pop)
The effect of this is to set the global warning level to be 3 for some
portion of the file. Each global warning level has associated warnings,
kind of like the -Wall and -Wextra parameters. So when the global
warning level is 3, only those warnings that have a level <= 3 will be
enabled.
The implementation that I am proposing is:
* Have all warnings default to level 1
* Map individual warnings to higher levels via a new mixin in
Diagnostic.td
* Add a "current level" to the DiagState class
* Modify DiagState so that the warning level filters out warnings that
should be ignored
The attached patch contains a first go. The way it is constructed at the
moment, all warnings will be enabled as they are at level 1 and the
"current level" defaults to 4.
Also note that the patch contains diffs against some more local changes.
I hope that there is still enough context.
The important files in the diff (imo):
* Diagnostic.h/cpp
* Diagnostic.td
I look forward to your comments.
Thanks for your time!
Sohail
[1] http://msdn.microsoft.com/en-us/library/2c8f766e.aspx
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pragma-warning-level.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110301/c1f85370/attachment.ksh>
More information about the cfe-dev
mailing list