[cfe-commits] [PATCH] Improve Clang diagnostic on ignored GNU type attributes

Eli Friedman eli.friedman at gmail.com
Mon Dec 12 11:53:05 PST 2011


On Mon, Dec 12, 2011 at 11:44 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Sun, Dec 11, 2011 at 3:25 PM, Michael Han <Michael.Han at autodesk.com> wrote:
>> Hi,
>>
>>
>>
>> This patch improves Clang diagnostic to warn about ignored GNU type
>> attributes in declaration specifiers, such as ““__attribute__((aligned))
>> struct foo”, where the attribute should (according to GCC attribute syntax
>> and implementation) be placed after the tag to apply to the type
>> declaration.
>>
>>
>>
>> Please review, thanks!
>
> +        if (attrs->isCXX0XAttribute()) continue;
>
> Why exclude C++11 attributes here?  They have the same issue.
>
> +  }
> +
>   // FIXME: Warn on useless attributes
>
> Might as well get rid of the FIXME, since you're fixing it. :)
>
> Otherwise, looks good!

Err, wait... I actually realized an issue: clang actually does process
the attributes in question sometimes. :)  We call
ProcessDeclAttributeList in Sema::ParsedFreeStandingDeclSpec in some
cases.  At first glance, it looks like a bug, but it needs further
investigation.

-Eli




More information about the cfe-commits mailing list