[cfe-dev] Warning options table

Sebastian Redl sebastian.redl at getdesigned.at
Thu Feb 26 11:13:32 PST 2009


Hi,

Revisiting the discussion about warning options we had some time ago.
I've now (finally) looked at tblgen and cooked up how I imagine the
warning option definition might look like. I've attached a sample table
definition.

There are three classes. WarningOption is the base of everything. It has
a name, by which the user refers to it, i.e. if the name is "undef" then
the warning is enabled by -Wundef, disabled by -Wno-undef, and made an
error by -Werror=undef.
I think we should also support -Wundef=warn|ignore|error. That's not
what GCC does, but it seems much more logical to me.
If display is 0, the warning is not shown in the options list. This is
important because there's a LOT of warnings, and showing them all would
be very overwhelming. For example, there's no point in showing
null_in_string, null_in_char and null_in_file as separate warnings.

Warning is a warning (WARN, EXTWARN or EXTENSION) as it appears in the
diagnostic definition file. The diag value is the name of the constant.
The default value is the state the warning is in if it is not otherwise
specified. The default value can only be specified for individual
warnings, not warning groups, because resolving the meaning of different
defaults in different groups would be a mess.

WarningGroup is a group of warning options, i.e. it can contain warnings
and other groups. Setting a warning group is equivalent to setting every
single warning it (recursively) contains. The intention is that later
parameters override the values of earlier parameters, so it is possible
to write, e.g.
clang -Weverything=warn -Whard-to-get-rid-of=ignore
I think the list of members should really be a dag type, but I'm not
quite sure how that works.


Next, I'll dive into llvm::cl and how to write tblgen backends, to see
if I can hook my example file up. Comments are of course very welcome.

Sebastian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: warn.td
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090226/0ce6cbe9/attachment.ksh>


More information about the cfe-dev mailing list