Skip to content

Commit 65447fd

Browse files
committed
[libc++] Adds __cpp_lib_three_way_comparison FTM.
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
1 parent fcfc15b commit 65447fd

File tree

6 files changed

+38
-74
lines changed

6 files changed

+38
-74
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ Status
290290
---------------------------------------------------------- -----------------
291291
``__cpp_lib_syncbuf`` ``201803L``
292292
---------------------------------------------------------- -----------------
293-
``__cpp_lib_three_way_comparison`` *unimplemented*
293+
``__cpp_lib_three_way_comparison`` ``201711L``
294294
---------------------------------------------------------- -----------------
295295
``__cpp_lib_to_address`` ``201711L``
296296
---------------------------------------------------------- -----------------

libcxx/docs/Status/Cxx20Papers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"`P1236R1 <https://wg21.link/P1236R1>`__","CWG","Alternative Wording for P0907R4 Signed Integers are Two's Complement","San Diego","* *",""
7979
"`P1248R1 <https://wg21.link/P1248R1>`__","LWG","Remove CommonReference requirement from StrictWeakOrdering (a.k.a Fixing Relations)","San Diego","|Complete|","13.0"
8080
"`P1285R0 <https://wg21.link/P1285R0>`__","LWG","Improving Completeness Requirements for Type Traits","San Diego","* *",""
81-
"`P1353R0 <https://wg21.link/P1353R0>`__","CWG","Missing feature test macros","San Diego","* *",""
81+
"`P1353R0 <https://wg21.link/P1353R0>`__","CWG","Missing feature test macros","San Diego","|In Progress|",""
8282
"","","","","","",""
8383
"`P0339R6 <https://wg21.link/P0339R6>`__","LWG","polymorphic_allocator<> as a vocabulary type","Kona","|Complete|","16.0"
8484
"`P0340R3 <https://wg21.link/P0340R3>`__","LWG","Making std::underlying_type SFINAE-friendly","Kona","|Complete|","9.0"

libcxx/include/version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ __cpp_lib_string_view 201803L <string> <string
228228
__cpp_lib_submdspan 202306L <mdspan>
229229
__cpp_lib_syncbuf 201803L <syncstream>
230230
__cpp_lib_text_encoding 202306L <text_encoding>
231-
__cpp_lib_three_way_comparison 201907L <compare>
231+
__cpp_lib_three_way_comparison 201711L <compare>
232232
__cpp_lib_to_address 201711L <memory>
233233
__cpp_lib_to_array 201907L <array>
234234
__cpp_lib_to_chars 202306L <charconv>
@@ -438,7 +438,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
438438
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
439439
# define __cpp_lib_syncbuf 201803L
440440
# endif
441-
// # define __cpp_lib_three_way_comparison 201907L
441+
# define __cpp_lib_three_way_comparison 201711L
442442
# define __cpp_lib_to_address 201711L
443443
# define __cpp_lib_to_array 201907L
444444
# define __cpp_lib_type_identity 201806L

libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Test the feature test macros defined by <compare>
1717

1818
/* Constant Value
19-
__cpp_lib_three_way_comparison 201907L [C++20]
19+
__cpp_lib_three_way_comparison 201711L [C++20]
2020
*/
2121

2222
#include <compare>
@@ -42,47 +42,29 @@
4242

4343
#elif TEST_STD_VER == 20
4444

45-
# if !defined(_LIBCPP_VERSION)
46-
# ifndef __cpp_lib_three_way_comparison
47-
# error "__cpp_lib_three_way_comparison should be defined in c++20"
48-
# endif
49-
# if __cpp_lib_three_way_comparison != 201907L
50-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++20"
51-
# endif
52-
# else // _LIBCPP_VERSION
53-
# ifdef __cpp_lib_three_way_comparison
54-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
55-
# endif
45+
# ifndef __cpp_lib_three_way_comparison
46+
# error "__cpp_lib_three_way_comparison should be defined in c++20"
47+
# endif
48+
# if __cpp_lib_three_way_comparison != 201711L
49+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++20"
5650
# endif
5751

5852
#elif TEST_STD_VER == 23
5953

60-
# if !defined(_LIBCPP_VERSION)
61-
# ifndef __cpp_lib_three_way_comparison
62-
# error "__cpp_lib_three_way_comparison should be defined in c++23"
63-
# endif
64-
# if __cpp_lib_three_way_comparison != 201907L
65-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++23"
66-
# endif
67-
# else // _LIBCPP_VERSION
68-
# ifdef __cpp_lib_three_way_comparison
69-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
70-
# endif
54+
# ifndef __cpp_lib_three_way_comparison
55+
# error "__cpp_lib_three_way_comparison should be defined in c++23"
56+
# endif
57+
# if __cpp_lib_three_way_comparison != 201711L
58+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++23"
7159
# endif
7260

7361
#elif TEST_STD_VER > 23
7462

75-
# if !defined(_LIBCPP_VERSION)
76-
# ifndef __cpp_lib_three_way_comparison
77-
# error "__cpp_lib_three_way_comparison should be defined in c++26"
78-
# endif
79-
# if __cpp_lib_three_way_comparison != 201907L
80-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++26"
81-
# endif
82-
# else // _LIBCPP_VERSION
83-
# ifdef __cpp_lib_three_way_comparison
84-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
85-
# endif
63+
# ifndef __cpp_lib_three_way_comparison
64+
# error "__cpp_lib_three_way_comparison should be defined in c++26"
65+
# endif
66+
# if __cpp_lib_three_way_comparison != 201711L
67+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++26"
8668
# endif
8769

8870
#endif // TEST_STD_VER > 23

libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
__cpp_lib_submdspan 202306L [C++26]
211211
__cpp_lib_syncbuf 201803L [C++20]
212212
__cpp_lib_text_encoding 202306L [C++26]
213-
__cpp_lib_three_way_comparison 201907L [C++20]
213+
__cpp_lib_three_way_comparison 201711L [C++20]
214214
__cpp_lib_to_address 201711L [C++20]
215215
__cpp_lib_to_array 201907L [C++20]
216216
__cpp_lib_to_chars 201611L [C++17]
@@ -4305,17 +4305,11 @@
43054305
# error "__cpp_lib_text_encoding should not be defined before c++26"
43064306
# endif
43074307

4308-
# if !defined(_LIBCPP_VERSION)
4309-
# ifndef __cpp_lib_three_way_comparison
4310-
# error "__cpp_lib_three_way_comparison should be defined in c++20"
4311-
# endif
4312-
# if __cpp_lib_three_way_comparison != 201907L
4313-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++20"
4314-
# endif
4315-
# else // _LIBCPP_VERSION
4316-
# ifdef __cpp_lib_three_way_comparison
4317-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
4318-
# endif
4308+
# ifndef __cpp_lib_three_way_comparison
4309+
# error "__cpp_lib_three_way_comparison should be defined in c++20"
4310+
# endif
4311+
# if __cpp_lib_three_way_comparison != 201711L
4312+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++20"
43194313
# endif
43204314

43214315
# ifndef __cpp_lib_to_address
@@ -5899,17 +5893,11 @@
58995893
# error "__cpp_lib_text_encoding should not be defined before c++26"
59005894
# endif
59015895

5902-
# if !defined(_LIBCPP_VERSION)
5903-
# ifndef __cpp_lib_three_way_comparison
5904-
# error "__cpp_lib_three_way_comparison should be defined in c++23"
5905-
# endif
5906-
# if __cpp_lib_three_way_comparison != 201907L
5907-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++23"
5908-
# endif
5909-
# else // _LIBCPP_VERSION
5910-
# ifdef __cpp_lib_three_way_comparison
5911-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
5912-
# endif
5896+
# ifndef __cpp_lib_three_way_comparison
5897+
# error "__cpp_lib_three_way_comparison should be defined in c++23"
5898+
# endif
5899+
# if __cpp_lib_three_way_comparison != 201711L
5900+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++23"
59135901
# endif
59145902

59155903
# ifndef __cpp_lib_to_address
@@ -7760,17 +7748,11 @@
77607748
# endif
77617749
# endif
77627750

7763-
# if !defined(_LIBCPP_VERSION)
7764-
# ifndef __cpp_lib_three_way_comparison
7765-
# error "__cpp_lib_three_way_comparison should be defined in c++26"
7766-
# endif
7767-
# if __cpp_lib_three_way_comparison != 201907L
7768-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++26"
7769-
# endif
7770-
# else // _LIBCPP_VERSION
7771-
# ifdef __cpp_lib_three_way_comparison
7772-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
7773-
# endif
7751+
# ifndef __cpp_lib_three_way_comparison
7752+
# error "__cpp_lib_three_way_comparison should be defined in c++26"
7753+
# endif
7754+
# if __cpp_lib_three_way_comparison != 201711L
7755+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++26"
77747756
# endif
77757757

77767758
# ifndef __cpp_lib_to_address

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,9 +1236,9 @@ def add_version_header(tc):
12361236
},
12371237
{
12381238
"name": "__cpp_lib_three_way_comparison",
1239-
"values": {"c++20": 201907},
1239+
"values": {"c++20": 201711},
1240+
# {"c++20": 201711} # P1614R2 The Mothership has Landed (see P1902R1 Missing feature-test macros 2017-2019)
12401241
"headers": ["compare"],
1241-
"unimplemented": True,
12421242
},
12431243
{
12441244
"name": "__cpp_lib_to_address",

0 commit comments

Comments
 (0)