On Thu, Nov 20, 2014 at 6:27 PM, Richard Smith <[email protected]> wrote:
> On Thu, Nov 20, 2014 at 1:38 PM, Aaron Ballman <[email protected]>
> wrote:
>>
>> The __has_attribute implementation does not pay attention to the
>> syntax supported by attributes -- instead, it looks to see whether an
>> attribute is generally known with that spelling. Since pragmas can now
>> be spelled as attributes, this means __has_attribute(loop) returns
>> true because of the #pragma loop functionality. Same for unroll.
>>
>> Should __has_attribute ignore attributes spelled with a #pragma spelling?
>
>
> I would go further: __has_attribute should probably only look for GNU-syntax
> attributes. We have __has_cpp_attribute for C++-syntax attributes now, and I
> don't think anyone is (yet) using this for __declspec, so now seems like a
> good time to make this change.

A long, long while back, we discussed having a way to determine
attributes by syntax, because that's sometimes important, as well as a
general query mechanism.

How about adding:

__has_declspec_attribute
__has_keyword_attribute
__has_gnu_attribute

and leaving __has_attribute generic across syntaxes?

This also reduces the chances of breaking code by allowing the
__has_attribute syntax to continue to work as it always has.

~Aaron
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to