]> granicus.if.org Git - clang/commitdiff
P0095R3: Implement the latest published revision of SD-6 (C++ feature test macros).
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 28 Sep 2016 20:26:06 +0000 (20:26 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 28 Sep 2016 20:26:06 +0000 (20:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282627 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/Lexer/cxx-features.cpp
www/cxx_status.html

index 8f669c7179cd223a8422992cc3cdd80d14955d0e..0351106a0aec7e5523c01368a34a6354c99b0cb1 100644 (file)
@@ -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.
index a616e7f423c77aa0979acb781af80dae15e48a94..18fdaa5dda3e1d5b74410bb76300cd3664b129e7 100644 (file)
 
 // --- 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)
 #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
 #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
 
index 3f57a95a0821b88bf5d57bb426b81b0c5ab7fbe5..76ab17317f213b838487b3f0f3da921b4ff4d6c5 100644 (file)
@@ -774,7 +774,7 @@ Clang version they became available:</p>
     </tr>
     <tr>
       <td class="svn" align="center">
-        SVN (<a href="http://wg21.link/p0096r2">P0096R2</a>)</a>
+        SVN (<a href="http://wg21.link/p0096r3">P0096R3</a>)</a>
       </td>
     </tr>
     <!-- FIXME: Implement latest recommendations.