aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2019-01-08 18:24:39 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2019-01-08 18:24:39 +0000
commit6ccc173b97232a5f685b0b01d916792834feba9e (patch)
tree4f4a01d9f132c90cdd5f22ec615dab97ca95cab5
parent7402fd9a35bcfd534dbd339e0ccfcd0fa1642c9d (diff)
__has_feature(pragma_clang_attribute_namespaces) should be __has_extension
Thanks to Richard Smith for pointing this out. llvm-svn: 350642
-rw-r--r--clang/docs/LanguageExtensions.rst2
-rw-r--r--clang/include/clang/Basic/Features.def8
-rw-r--r--clang/test/Sema/pragma-attribute-namespace.c2
3 files changed, 9 insertions, 3 deletions
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 574bb77345a8..e155cefb7890 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2727,7 +2727,7 @@ Without the namespaces on the macros, ``other_function`` will be annotated with
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. You can test if
your version of clang supports namespaces on ``#pragma clang attribute`` with
-``__has_feature(pragma_clang_attribute_namespaces)``.
+``__has_extension(pragma_clang_attribute_namespaces)``.
Subject Match Rules
-------------------
diff --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def
index e3b97fd078e4..05464ed85f13 100644
--- a/clang/include/clang/Basic/Features.def
+++ b/clang/include/clang/Basic/Features.def
@@ -17,6 +17,12 @@
//
// The Predicate field dictates the conditions under which the feature or
// extension will be made available.
+//
+// FEATURE(...) should be used to advertise support for standard language
+// features, whereas EXTENSION(...) should be used for clang extensions. Note
+// that many of the identifiers in this file don't follow this rule for backward
+// compatibility reasons.
+//
//===----------------------------------------------------------------------===//
#if !defined(FEATURE) && !defined(EXTENSION)
@@ -69,7 +75,6 @@ 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)
@@ -241,6 +246,7 @@ EXTENSION(cxx_init_captures, LangOpts.CPlusPlus11)
EXTENSION(cxx_variable_templates, LangOpts.CPlusPlus)
// Miscellaneous language extensions
EXTENSION(overloadable_unmarked, true)
+EXTENSION(pragma_clang_attribute_namespaces, true)
#undef EXTENSION
#undef FEATURE
diff --git a/clang/test/Sema/pragma-attribute-namespace.c b/clang/test/Sema/pragma-attribute-namespace.c
index 2db788865b26..e7a36afcdc23 100644
--- a/clang/test/Sema/pragma-attribute-namespace.c
+++ b/clang/test/Sema/pragma-attribute-namespace.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-#if !__has_feature(pragma_clang_attribute_namespaces)
+#if !__has_extension(pragma_clang_attribute_namespaces)
#error
#endif