Thanks! I've committed this (with 80 column fixes / minor copy edits) as r151445.<br><br><div class="gmail_quote">On Sat, Feb 25, 2012 at 12:36 AM, Jonathan Sauer <span dir="ltr"><<a href="mailto:jonathan.sauer@gmx.de">jonathan.sauer@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Hello,<br>
<br>
>> following the discussion in cfe-dev[*], I decided to put my money where my mouth is and have attached a patch<br>
>> that makes it possible to use __has_feature(__feature__) in place of __has_feature(feature) to protect the<br>
>> feature name in case the user defines a macro with the same name.<br>
>><br>
>> I modeled the patch after the similar handling of __attribute__ names.<br>
><br>
> This patch looks great to me, please commit!<br>
<br>
</div>As I have not commit access, I would kindly ask someone who has to do it for me.<br>
<br>
I updated the patch to include Jean-Daniel's suggestion to handle __has_extension the same way. I also<br>
modified the code slightly to make the normalization of the name work without invoking undefined<br>
behaviour in case the string is shorter than 4 characters: Before, it depended on the assumption that an<br>
unsigned integer underflow would result in a very large integer, which was then ignored as it was larger<br>
than the string size. As this also was the case when normalizing the attribute name, I modified that<br>
code as well.<br>
<br>
I don't think that a feature "has_feature_supports_double_underscore" or similar is necessary. Simply<br>
choose an arbitrary extension that is always supported in clang and check for the feature with and<br>
without underscores:<br>
<br>
  #if __has_extension(c_alignas) && !__has_extension(__c_alignas__)<br>
  #  message Double underscores in extension names are not supported<br>
  #else<br>
  #  message Double underscores in extension names are supported<br>
  #endif<br>
<br>
If you disagree, just tell me and I'll add it.<br>
<br>
<br>
I have attached the new patch.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
Jonathan<br>
</font></span><br><br>
<br>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br>