<div dir="ltr"><div dir="ltr">On Mon, 7 Jan 2019 at 13:57, Erik Pilkington via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: epilk<br>
Date: Mon Jan 7 13:54:00 2019<br>
New Revision: 350572<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=350572&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=350572&view=rev</a><br>
Log:<br>
Add a __has_feature check for namespaces on #pragma clang attribute.<br></blockquote><div><br></div><div>Should this be __has_extension rather than __has_feature, since it's not a standard feature?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Support for this was added in r349845.<br>
<br>
Modified:<br>
cfe/trunk/docs/LanguageExtensions.rst<br>
cfe/trunk/include/clang/Basic/Features.def<br>
cfe/trunk/test/Sema/pragma-attribute-namespace.c<br>
<br>
Modified: cfe/trunk/docs/LanguageExtensions.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=350572&r1=350571&r2=350572&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=350572&r1=350571&r2=350572&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/docs/LanguageExtensions.rst (original)<br>
+++ cfe/trunk/docs/LanguageExtensions.rst Mon Jan 7 13:54:00 2019<br>
@@ -2725,7 +2725,9 @@ same namespace. For instance:<br>
Without the namespaces on the macros, ``other_function`` will be annotated with<br>
``[[noreturn]]`` instead of ``__attribute__((unavailable))``. This may seem like<br>
a contrived example, but its very possible for this kind of situation to appear<br>
-in real code if the pragmas are spread out across a large file.<br>
+in real code if the pragmas are spread out across a large file. You can test if<br>
+your version of clang supports namespaces on ``#pragma clang attribute`` with<br>
+``__has_feature(pragma_clang_attribute_namespaces)``.<br>
<br>
Subject Match Rules<br>
-------------------<br>
<br>
Modified: cfe/trunk/include/clang/Basic/Features.def<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Features.def?rev=350572&r1=350571&r2=350572&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Features.def?rev=350572&r1=350571&r2=350572&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/Features.def (original)<br>
+++ cfe/trunk/include/clang/Basic/Features.def Mon Jan 7 13:54:00 2019<br>
@@ -69,6 +69,7 @@ FEATURE(attribute_overloadable, true)<br>
FEATURE(attribute_unavailable_with_message, true)<br>
FEATURE(attribute_unused_on_fields, true)<br>
FEATURE(attribute_diagnose_if_objc, true)<br>
+FEATURE(pragma_clang_attribute_namespaces, true)<br>
FEATURE(blocks, LangOpts.Blocks)<br>
FEATURE(c_thread_safety_attributes, true)<br>
FEATURE(cxx_exceptions, LangOpts.CXXExceptions)<br>
<br>
Modified: cfe/trunk/test/Sema/pragma-attribute-namespace.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/pragma-attribute-namespace.c?rev=350572&r1=350571&r2=350572&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/pragma-attribute-namespace.c?rev=350572&r1=350571&r2=350572&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Sema/pragma-attribute-namespace.c (original)<br>
+++ cfe/trunk/test/Sema/pragma-attribute-namespace.c Mon Jan 7 13:54:00 2019<br>
@@ -1,5 +1,9 @@<br>
// RUN: %clang_cc1 -fsyntax-only -verify %s<br>
<br>
+#if !__has_feature(pragma_clang_attribute_namespaces)<br>
+#error<br>
+#endif<br>
+<br>
#pragma clang attribute MyNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}}<br>
<br>
int some_func(); // expected-note{{when applied to this declaration}}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>