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

Michael Han Michael.Han at autodesk.com
Mon Dec 12 12:52:42 PST 2011


Hi Eli,

> Why exclude C++11 attributes here?  They have the same issue.
I am not familiar with C++11 attribute syntax so for safety I just skip warning about them for now. 

> We call ProcessDeclAttributeList in Sema::ParsedFreeStandingDeclSpec in some cases.  At first glance, it looks like a bug, but it needs further investigation.
Seems a bug.. I'll look into it.

Thanks!
~
Michael

-----Original Message-----
From: Eli Friedman [mailto:eli.friedman at gmail.com] 
Sent: Monday, December 12, 2011 11:53 AM
To: Michael Han
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] [PATCH] Improve Clang diagnostic on ignored GNU type attributes

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