[cfe-dev] prefixed gnu style attributes are ignored on tag types

John McCall rjmccall at apple.com
Mon Dec 13 08:25:20 PST 2010


On Dec 13, 2010, at 1:32 AM, Michael Han wrote:

> Greetings,
>  
> It looks like clang parser ignores gnu style attributes prefixed on the tag types. For example (assume attr is an implementation defined attribute):
>  
> class __attribute__((attr)) foo ; // works
>  
> __attribute__((attr)) class foo; // doesn’t work; the attribute is parsed while parsing declaration specifiers but doesn’t get merged into the attribute list while parsing the class specifier. So the attribute never makes to Sema.
>  
> I am wondering why the parser ignores the prefixed attributes. Is this for gcc compatibility? (from http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html#Type-Attributes, it looks like prefixed attribute is not one of the “legal” syntax of gcc type attributes).

That position would apply to the declared objects, so we should at least diagnose that they're being ignored here.

John.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101213/259e1ecd/attachment.html>


More information about the cfe-dev mailing list