Skip to content

Conversation

mordante
Copy link
Member

@mordante mordante commented May 8, 2024

The paper
P0768R1 Library Support for the Spaceship (Comparison) Operator
did not add a feature-test macro. This omission has been corrected in
P1353R0 Missing Feature Test Macros

This enables the FTM for P0768R1

Fixes: #73953

@mordante mordante requested a review from a team as a code owner May 8, 2024 18:04
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 8, 2024
@llvmbot
Copy link
Member

llvmbot commented May 8, 2024

@llvm/pr-subscribers-libcxx

Author: Mark de Wever (mordante)

Changes

The paper
P0768R1 Library Support for the Spaceship (Comparison) Operator
did not add a feature-test macro. This omission has been corrected in
P1353R0 Missing Feature Test Macros

This enables the FTM for P0768R1

Fixes: #73953


Full diff: https://github.com/llvm/llvm-project/pull/91515.diff

5 Files Affected:

  • (modified) libcxx/docs/Status/Cxx20Papers.csv (+1-1)
  • (modified) libcxx/include/version (+2-2)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp (+7-7)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp (+7-7)
  • (modified) libcxx/utils/generate_feature_test_macro_components.py (+2-1)
diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv
index d31720b7576d7..064e32a45d81a 100644
--- a/libcxx/docs/Status/Cxx20Papers.csv
+++ b/libcxx/docs/Status/Cxx20Papers.csv
@@ -78,7 +78,7 @@
 "`P1236R1 <https://wg21.link/P1236R1>`__","CWG","Alternative Wording for P0907R4 Signed Integers are Two's Complement","San Diego","* *",""
 "`P1248R1 <https://wg21.link/P1248R1>`__","LWG","Remove CommonReference requirement from StrictWeakOrdering (a.k.a Fixing Relations)","San Diego","|Complete|","13.0"
 "`P1285R0 <https://wg21.link/P1285R0>`__","LWG","Improving Completeness Requirements for Type Traits","San Diego","* *",""
-"`P1353R0 <https://wg21.link/P1353R0>`__","CWG","Missing feature test macros","San Diego","* *",""
+"`P1353R0 <https://wg21.link/P1353R0>`__","CWG","Missing feature test macros","San Diego","|In Progress|",""
 "","","","","","",""
 "`P0339R6 <https://wg21.link/P0339R6>`__","LWG","polymorphic_allocator<> as a vocabulary type","Kona","|Complete|","16.0"
 "`P0340R3 <https://wg21.link/P0340R3>`__","LWG","Making std::underlying_type SFINAE-friendly","Kona","|Complete|","9.0"
diff --git a/libcxx/include/version b/libcxx/include/version
index eb5fd5c805784..0e0eeca4799c1 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -228,7 +228,7 @@ __cpp_lib_string_view                                   201803L <string> <string
 __cpp_lib_submdspan                                     202306L <mdspan>
 __cpp_lib_syncbuf                                       201803L <syncstream>
 __cpp_lib_text_encoding                                 202306L <text_encoding>
-__cpp_lib_three_way_comparison                          201907L <compare>
+__cpp_lib_three_way_comparison                          201711L <compare>
 __cpp_lib_to_address                                    201711L <memory>
 __cpp_lib_to_array                                      201907L <array>
 __cpp_lib_to_chars                                      202306L <charconv>
@@ -438,7 +438,7 @@ __cpp_lib_within_lifetime                               202306L <type_traits>
 # if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
 #   define __cpp_lib_syncbuf                            201803L
 # endif
-// # define __cpp_lib_three_way_comparison                 201907L
+// # define __cpp_lib_three_way_comparison                 201711L
 # define __cpp_lib_to_address                           201711L
 # define __cpp_lib_to_array                             201907L
 # define __cpp_lib_type_identity                        201806L
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
index f521c53250b63..4b81f212b786b 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
@@ -16,7 +16,7 @@
 // Test the feature test macros defined by <compare>
 
 /*  Constant                          Value
-    __cpp_lib_three_way_comparison    201907L [C++20]
+    __cpp_lib_three_way_comparison    201711L [C++20]
 */
 
 #include <compare>
@@ -46,8 +46,8 @@
 #   ifndef __cpp_lib_three_way_comparison
 #     error "__cpp_lib_three_way_comparison should be defined in c++20"
 #   endif
-#   if __cpp_lib_three_way_comparison != 201907L
-#     error "__cpp_lib_three_way_comparison should have the value 201907L in c++20"
+#   if __cpp_lib_three_way_comparison != 201711L
+#     error "__cpp_lib_three_way_comparison should have the value 201711L in c++20"
 #   endif
 # else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_three_way_comparison
@@ -61,8 +61,8 @@
 #   ifndef __cpp_lib_three_way_comparison
 #     error "__cpp_lib_three_way_comparison should be defined in c++23"
 #   endif
-#   if __cpp_lib_three_way_comparison != 201907L
-#     error "__cpp_lib_three_way_comparison should have the value 201907L in c++23"
+#   if __cpp_lib_three_way_comparison != 201711L
+#     error "__cpp_lib_three_way_comparison should have the value 201711L in c++23"
 #   endif
 # else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_three_way_comparison
@@ -76,8 +76,8 @@
 #   ifndef __cpp_lib_three_way_comparison
 #     error "__cpp_lib_three_way_comparison should be defined in c++26"
 #   endif
-#   if __cpp_lib_three_way_comparison != 201907L
-#     error "__cpp_lib_three_way_comparison should have the value 201907L in c++26"
+#   if __cpp_lib_three_way_comparison != 201711L
+#     error "__cpp_lib_three_way_comparison should have the value 201711L in c++26"
 #   endif
 # else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_three_way_comparison
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index da7a780528c7a..7675a515977d8 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -210,7 +210,7 @@
     __cpp_lib_submdspan                                     202306L [C++26]
     __cpp_lib_syncbuf                                       201803L [C++20]
     __cpp_lib_text_encoding                                 202306L [C++26]
-    __cpp_lib_three_way_comparison                          201907L [C++20]
+    __cpp_lib_three_way_comparison                          201711L [C++20]
     __cpp_lib_to_address                                    201711L [C++20]
     __cpp_lib_to_array                                      201907L [C++20]
     __cpp_lib_to_chars                                      201611L [C++17]
@@ -4309,8 +4309,8 @@
 #   ifndef __cpp_lib_three_way_comparison
 #     error "__cpp_lib_three_way_comparison should be defined in c++20"
 #   endif
-#   if __cpp_lib_three_way_comparison != 201907L
-#     error "__cpp_lib_three_way_comparison should have the value 201907L in c++20"
+#   if __cpp_lib_three_way_comparison != 201711L
+#     error "__cpp_lib_three_way_comparison should have the value 201711L in c++20"
 #   endif
 # else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_three_way_comparison
@@ -5903,8 +5903,8 @@
 #   ifndef __cpp_lib_three_way_comparison
 #     error "__cpp_lib_three_way_comparison should be defined in c++23"
 #   endif
-#   if __cpp_lib_three_way_comparison != 201907L
-#     error "__cpp_lib_three_way_comparison should have the value 201907L in c++23"
+#   if __cpp_lib_three_way_comparison != 201711L
+#     error "__cpp_lib_three_way_comparison should have the value 201711L in c++23"
 #   endif
 # else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_three_way_comparison
@@ -7764,8 +7764,8 @@
 #   ifndef __cpp_lib_three_way_comparison
 #     error "__cpp_lib_three_way_comparison should be defined in c++26"
 #   endif
-#   if __cpp_lib_three_way_comparison != 201907L
-#     error "__cpp_lib_three_way_comparison should have the value 201907L in c++26"
+#   if __cpp_lib_three_way_comparison != 201711L
+#     error "__cpp_lib_three_way_comparison should have the value 201711L in c++26"
 #   endif
 # else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_three_way_comparison
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 29c8ceba0c7ef..795037a479b98 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -1236,7 +1236,8 @@ def add_version_header(tc):
         },
         {
             "name": "__cpp_lib_three_way_comparison",
-            "values": {"c++20": 201907},
+            "values": {"c++20": 201711},
+            # {"c++20": 201711} # P1614R2 The Mothership has Landed (see P1902R1 Missing feature-test macros 2017-2019)
             "headers": ["compare"],
             "unimplemented": True,
         },

The paper
  P0768R1 Library Support for the Spaceship (Comparison) Operator
did not add a feature-test macro. This omission has been corrected in
  P1353R0 Missing Feature Test Macros

This enables the FTM for P0768R1

Fixes: llvm#73953
@mordante mordante force-pushed the review/adds__cpp_lib_three_way branch from d27160a to 65447fd Compare May 9, 2024 15:21
@mordante mordante merged commit c36961b into llvm:main Jun 12, 2024
@mordante mordante deleted the review/adds__cpp_lib_three_way branch June 12, 2024 16:59
frederick-vs-ja added a commit that referenced this pull request Jan 19, 2025
Library feature-test macros added by P1353R0 are already implemented.
- `__cpp_lib_destroying_delete` was added by
ae02e89
(https://reviews.llvm.org/D55840) in LLVM 9.
- `__cpp_lib_three_way_comparison` was added by #91515 in LLVM 19.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__cpp_lib_three_way_comparison not defined when it should be
5 participants