[PATCH] Disallowing just GNU-style attributes in certain positions

Aaron Ballman aaron at aaronballman.com
Tue Jul 22 05:53:22 PDT 2014


On Mon, Jul 21, 2014 at 5:27 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Mon, Jul 21, 2014 at 2:03 PM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> I've cleaned the patch up and implemented your suggestions. Just to
>> clarify something:
>>
>> > Index: lib/Parse/ParseDecl.cpp
>> > ===================================================================
>> > --- lib/Parse/ParseDecl.cpp (revision 213263)
>> > +++ lib/Parse/ParseDecl.cpp (working copy)
>> > @@ -5535,7 +5541,7 @@
>> >    // If there is a type-qualifier-list, read it now.
>> >    // Type qualifiers in an array subscript are a C99 feature.
>> >    DeclSpec DS(AttrFactory);
>> > -  ParseTypeQualifierListOpt(DS, false /*no attributes*/);
>> > +  ParseTypeQualifierListOpt(DS, NoAttributesAllowed);
>>
>> The old code used to allow C++11-style attributes, but from what I can
>> tell, those should have been prohibited here as well, so I switched to
>> NoAttributesAllowed. Is my understanding correct? Is there a sensible
>> testcase I should add for this?
>
>
> I think that we need something like this to reach that code:
>
> void f(int a[static [[]] 5]);
>
> ... where we produce an error on the 'static', but don't reject the
> attribute list.

Thank you for the suggestion! I've committed with that as a test case
in r213650.

~Aaron



More information about the cfe-commits mailing list