<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 12, 2016 at 3:55 AM, Jonathan Wakely <span dir="ltr"><<a href="mailto:cxx@kayari.org" target="_blank">cxx@kayari.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The SD-6 draft has<br>
<br>
[3.3.6] Example<br>
<br>
This demonstrates a way to use the attribute [[deprecated]] only if it<br>
is available.<br>
<br>
#ifdef __has_cpp_attribute<br>
# if __has_cpp_attribute(<wbr>deprecated)<br>
# define ATTR_DEPRECATED(msg) [[deprecated(msg)]]<br>
# else<br>
# define ATTR_DEPRECATED(msg)<br>
# endif<br>
#endif<br>
<br>
<br>
<br>
This leaves ATTR_DEPRECATED undefined if the compiler doesn't support<br>
the __has_cpp_attribute macro, is that intended? Unless the idea is<br>
that some other method would be used to decide if it's available, it<br>
should be something like:<br>
<br>
#ifdef __has_cpp_attribute<br>
# if __has_cpp_attribute(<wbr>deprecated)<br>
# define ATTR_DEPRECATED(msg) [[deprecated(msg)]]<br>
# endif<br>
#endif<br>
#ifndef ATTR_DEPRECATED(msg)<br>
# define ATTR_DEPRECATED(msg)<br>
#endif<br></blockquote><div><br></div><div>The usage model we've always documented for these __has_* macros in Clang is:</div><div><br></div><div>#ifndef __has_cpp_attribute</div><div># define __has_cpp_attribute(x) 0</div><div>#endif</div><div><br></div><div>#if __has_cpp_attribute(deprecated)</div><div><div># define ATTR_DEPRECATED(msg) [[deprecated(msg)]]</div><div>#else<br></div><div># define ATTR_DEPRECATED(msg)<br></div><div>#endif</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Would it also be useful to mention that the grammar term<br>
"attribute-token" allows scoped attributes, such as foo::bar, so that<br>
non-standard attributes can be tested the same way?<br>
______________________________<wbr>_________________<br>
Features mailing list<br>
<a href="mailto:Features@isocpp.open-std.org">Features@isocpp.open-std.org</a><br>
<a href="http://www.open-std.org/mailman/listinfo/features" rel="noreferrer" target="_blank">http://www.open-std.org/<wbr>mailman/listinfo/features</a><br>
</blockquote></div><br></div></div>