Hi John, The attached patch adds a diagnostic kind and makes parser to emit warning diagnostic when it found there are attributes appear before class/struct/union keywords. For gcc compatibility, I have checked that gcc does emit warnings for such ignored attributes so this patch would enable clang to emit similar warnings.
Cheers ~Michael From: John McCall [mailto:[email protected]] Sent: Tuesday, December 14, 2010 12:25 AM To: Michael Han Cc: [email protected] Subject: Re: [cfe-dev] prefixed gnu style attributes are ignored on tag types 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.
attributes.patch
Description: attributes.patch
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
