r282627 - P0095R3: Implement the latest published revision of SD-6 (C++ feature test macros).

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 13:26:07 PDT 2016


Author: rsmith
Date: Wed Sep 28 15:26:06 2016
New Revision: 282627

URL: http://llvm.org/viewvc/llvm-project?rev=282627&view=rev
Log:
P0095R3: Implement the latest published revision of SD-6 (C++ feature test macros).

Modified:
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/test/Lexer/cxx-features.cpp
    cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=282627&r1=282626&r2=282627&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Sep 28 15:26:06 2016
@@ -467,7 +467,8 @@ static void InitializeCPlusPlusFeatureTe
     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 InitializeCPlusPlusFeatureTe
 
   // 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.

Modified: cfe/trunk/test/Lexer/cxx-features.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=282627&r1=282626&r2=282627&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/cxx-features.cpp (original)
+++ cfe/trunk/test/Lexer/cxx-features.cpp Wed Sep 28 15:26:06 2016
@@ -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
 

Modified: cfe/trunk/www/cxx_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=282627&r1=282626&r2=282627&view=diff
==============================================================================
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Wed Sep 28 15:26:06 2016
@@ -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.




More information about the cfe-commits mailing list