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