<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 20, 2014 at 3:48 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, Nov 20, 2014 at 6:27 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
> On Thu, Nov 20, 2014 at 1:38 PM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com">aaron@aaronballman.com</a>><br>
> wrote:<br>
>><br>
>> The __has_attribute implementation does not pay attention to the<br>
>> syntax supported by attributes -- instead, it looks to see whether an<br>
>> attribute is generally known with that spelling. Since pragmas can now<br>
>> be spelled as attributes, this means __has_attribute(loop) returns<br>
>> true because of the #pragma loop functionality. Same for unroll.<br>
>><br>
>> Should __has_attribute ignore attributes spelled with a #pragma spelling?<br>
><br>
><br>
> I would go further: __has_attribute should probably only look for GNU-syntax<br>
> attributes. We have __has_cpp_attribute for C++-syntax attributes now, and I<br>
> don't think anyone is (yet) using this for __declspec, so now seems like a<br>
> good time to make this change.<br>
<br>
</div></div>A long, long while back, we discussed having a way to determine<br>
attributes by syntax, because that's sometimes important, as well as a<br>
general query mechanism.<br>
<br>
How about adding:<br>
<br>
__has_declspec_attribute<br>
__has_keyword_attribute<br>
__has_gnu_attribute<br>
<br>
and leaving __has_attribute generic across syntaxes?<br>
<br>
This also reduces the chances of breaking code by allowing the<br>
__has_attribute syntax to continue to work as it always has.<br></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Back when we only had GNU attributes, that's all it detected. I'm not convinced that people are actually using it for anything else, and I think it would be surprising if it said an attribute was supported but that attribute didn't work with GNU syntax. A generic-across-syntaxes __has_attribute is basically useless.</div></div>