[cfe-commits] [PATCH] Warn when an anonymous warning group is used more than once

Jordan Rose jordan_rose at apple.com
Wed Jan 9 14:27:59 PST 2013


Updated with tests. Do people agree with the general style warning?



On Jan 7, 2013, at 18:59 , Jordan Rose <jordan_rose at apple.com> wrote:

> Hi, everyone. One thing that's bothered me about our diagnostic TableGen files is the anonymous use of warning groups:
> 
> def warn_foo : Warning<"foo is bad">, InGroup<DiagGroup<"foo">>;
> def warn_foo_cxx : Warning<"foo is even worse in C++">, InGroup<DiagGroup<"foo">>;
> 
> If we ever want to put the warning groups in a hierarchy, or change the name, there's a big chance we'll miss one.
> 
> So, I wrote a new warning for clang-tblgen, which even has a fixit if the group already has a name:
> 
> warning: group 'foo' is referred to anonymously
> def warn_foo : Warning<"foo is bad">, InGroup<DiagGroup<"foo">>;
>                                       ~~~~~~~~^~~~~~~~~~~~~~~~~
>                                       InGroup<Foo>
> 
> And then fixed all the warnings, with the intent that we make this a new style requirement going forwards: groups that cover more than one diagnostic must be named.
> 
> This depends on the changes being discussed in http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130107/161252.html, but what do people think of this?
> 
> Thanks,
> Jordan
> 
> <0001-Warn-if-an-anonymous-DiagGroup-is-referenced-multipl.patch>
> <0002-Diagnostics-name-all-implicit-groups-used-more-than-.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130109/76efcf57/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Warn-if-an-anonymous-DiagGroup-is-referenced-multipl.patch
Type: application/octet-stream
Size: 14753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130109/76efcf57/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130109/76efcf57/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Diagnostics-name-all-implicit-groups-used-more-than-.patch
Type: application/octet-stream
Size: 25002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130109/76efcf57/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130109/76efcf57/attachment-0002.html>


More information about the cfe-commits mailing list