patch: add GCC bit to Attr.td and use it to disable -Wgcc-compat

Richard Smith richard at metafoo.co.uk
Tue Oct 29 09:56:14 PDT 2013


On 29 Oct 2013 08:46, "Aaron Ballman" <aaron at aaronballman.com> wrote:
>
> On Mon, Oct 28, 2013 at 10:52 PM, Nick Lewycky <nlewycky at google.com>
wrote:
> > On 18 October 2013 10:50, Aaron Ballman <aaron at aaronballman.com> wrote:
> >>
> >> Can this be done as part of the attribute spelling instead of a
> >> separate bit?  Eg) introduce GCC as a spelling that implies GNU?
> >
> > You can add a GCC spelling but you can't make a single spelling imply
both
> > GNU and CXX11<"gnu",...>. I tried this first -- having one GCC entry in
the
> > Spellings list imply two spellings under the hood, but it was really,
nasty.
> > Do not suggest that I do this unless you try it.
>
> It may be nasty, but it's also far less error-prone for everyone
> defining attributes.  You have an explicit assumption in the tablegen
> that the GNU spellings will also have a matching CXX11 spelling with
> gnu::, but that's extra, hidden work for people writing attributes.
> It would be considerably less burden on everyone writing attributes
> were this to not be an assumption within tablegen, but be an
> obligation via the syntax.
>
> What I am proposing is to retain the GNU and CXX11 spelling as-is, but
> add another spelling type: GCC.  GCC<"string"> is semantically
> equivalent to GNU<"string">, CXX11<"gnu", "string"> for the spellings,
> and let GCC = 1 for the extra bit you just added.

I believe this is exactly the approach that Nick described as really nasty.

I'd be fine with tablegen just checking that the user got it right. We want
to catch errors, but this file doesn't need to be maximally convenient to
write. We don't add attributes that often.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131029/1df9dfdf/attachment.html>


More information about the cfe-commits mailing list