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

David Blaikie dblaikie at gmail.com
Wed Jan 9 14:33:47 PST 2013


On Wed, Jan 9, 2013 at 2:27 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> Updated with tests. Do people agree with the general style warning?

Sounds good to me

> 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>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-commits mailing list