From: Richard Smith
Date: Wed, 28 Sep 2016 20:26:06 +0000 (+0000)
Subject: P0095R3: Implement the latest published revision of SD-6 (C++ feature test macros).
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8cee8f0e8124e979744401fd248c5be331ee424;p=clang
P0095R3: Implement the latest published revision of SD-6 (C++ feature test macros).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282627 91177308-0d34-0410-b5e6-96231b3b80d8
---
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 8f669c7179..0351106a0a 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -467,7 +467,8 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
Builder.defineMacro("__cpp_lambdas", "200907");
Builder.defineMacro("__cpp_constexpr",
LangOpts.CPlusPlus14 ? "201304" : "200704");
- Builder.defineMacro("__cpp_range_based_for", "200907");
+ Builder.defineMacro("__cpp_range_based_for",
+ LangOpts.CPlusPlus1z ? "201603" : "200907");
Builder.defineMacro("__cpp_static_assert",
LangOpts.CPlusPlus1z ? "201411" : "200410");
Builder.defineMacro("__cpp_decltype", "200707");
@@ -498,12 +499,15 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
// C++17 features.
if (LangOpts.CPlusPlus1z) {
+ Builder.defineMacro("__cpp_hex_float", "201603");
//Builder.defineMacro("__cpp_noexcept_function_type", "201510");
- Builder.defineMacro("__cpp_fold_expressions", "201411");
+ Builder.defineMacro("__cpp_capture_star_this", "201603");
Builder.defineMacro("__cpp_namespace_attributes", "201411");
Builder.defineMacro("__cpp_enumerator_attributes", "201411");
Builder.defineMacro("__cpp_nested_namespace_definitions", "201411");
+ Builder.defineMacro("__cpp_aggregate_bases", "201603");
Builder.defineMacro("__cpp_nontype_template_args", "201411");
+ Builder.defineMacro("__cpp_fold_expressions", "201603");
}
// TS features.
diff --git a/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp
index a616e7f423..18fdaa5dda 100644
--- a/test/Lexer/cxx-features.cpp
+++ b/test/Lexer/cxx-features.cpp
@@ -22,15 +22,27 @@
// --- C++17 features ---
+#if check(hex_float, 0, 0, 0, 201603)
+#error "wrong value for __cpp_hex_float"
+#endif
+
#if check(noexcept_function_type, 0, 0, 0, 0)
-// FIXME
+// FIXME: value shuld be 201510 for cxx1z once implemented
#error "wrong value for __cpp_noexcept_function_type"
#endif
-#if check(fold_expressions, 0, 0, 0, 201411)
+#if check(fold_expressions, 0, 0, 0, 201603)
#error "wrong value for __cpp_fold_expressions"
#endif
+#if check(capture_star_this, 0, 0, 0, 201603)
+#error "wrong value for __cpp_capture_star_this"
+#endif
+
+// FIXME: bump __cpp_constexpr to 201603 for constexpr lambda support
+
+// range_based_for checked below
+
// static_assert checked below
#if check(namespace_attributes, 0, 0, 0, 201411)
@@ -47,6 +59,10 @@
#error "wrong value for __cpp_nested_namespace_definitions"
#endif
+#if check(aggregate_bases, 0, 0, 0, 201603)
+#error "wrong value for __cpp_aggregate_bases"
+#endif
+
#if check(nontype_template_args, 0, 0, 0, 201411)
#error "wrong value for __cpp_nontype_template_args"
#endif
@@ -122,7 +138,7 @@
#error "wrong value for __cpp_constexpr"
#endif
-#if check(range_based_for, 0, 200907, 200907, 200907)
+#if check(range_based_for, 0, 200907, 200907, 201603)
#error "wrong value for __cpp_range_based_for"
#endif
diff --git a/www/cxx_status.html b/www/cxx_status.html
index 3f57a95a08..76ab17317f 100644
--- a/www/cxx_status.html
+++ b/www/cxx_status.html
@@ -774,7 +774,7 @@ Clang version they became available:
- SVN (P0096R2)
+ SVN (P0096R3)
|