patch: add GCC bit to Attr.td and use it to disable -Wgcc-compat
aaron at aaronballman.com
Tue Oct 29 08:46:13 PDT 2013
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.
More information about the cfe-commits