Skip to content

Commit c36961b

Browse files
mordantecpplearner
andauthored
[libc++] Adds __cpp_lib_three_way_comparison FTM. (#91515)
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 --------- Co-authored-by: S. B. Tam <[email protected]>
1 parent 9a1611f commit c36961b

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
@@ -229,7 +229,7 @@ __cpp_lib_string_view 201803L <string> <string
229229
__cpp_lib_submdspan 202306L <mdspan>
230230
__cpp_lib_syncbuf 201803L <syncstream>
231231
__cpp_lib_text_encoding 202306L <text_encoding>
232-
__cpp_lib_three_way_comparison 201907L <compare>
232+
__cpp_lib_three_way_comparison 201711L <compare>
233233
__cpp_lib_to_address 201711L <memory>
234234
__cpp_lib_to_array 201907L <array>
235235
__cpp_lib_to_chars 202306L <charconv>
@@ -437,7 +437,7 @@ __cpp_lib_void_t 201411L <type_traits>
437437
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
438438
# define __cpp_lib_syncbuf 201803L
439439
# endif
440-
// # define __cpp_lib_three_way_comparison 201907L
440+
# define __cpp_lib_three_way_comparison 201711L
441441
# define __cpp_lib_to_address 201711L
442442
# define __cpp_lib_to_array 201907L
443443
# 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
@@ -211,7 +211,7 @@
211211
__cpp_lib_submdspan 202306L [C++26]
212212
__cpp_lib_syncbuf 201803L [C++20]
213213
__cpp_lib_text_encoding 202306L [C++26]
214-
__cpp_lib_three_way_comparison 201907L [C++20]
214+
__cpp_lib_three_way_comparison 201711L [C++20]
215215
__cpp_lib_to_address 201711L [C++20]
216216
__cpp_lib_to_array 201907L [C++20]
217217
__cpp_lib_to_chars 201611L [C++17]
@@ -4309,17 +4309,11 @@
43094309
# error "__cpp_lib_text_encoding should not be defined before c++26"
43104310
# endif
43114311

4312-
# if !defined(_LIBCPP_VERSION)
4313-
# ifndef __cpp_lib_three_way_comparison
4314-
# error "__cpp_lib_three_way_comparison should be defined in c++20"
4315-
# endif
4316-
# if __cpp_lib_three_way_comparison != 201907L
4317-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++20"
4318-
# endif
4319-
# else // _LIBCPP_VERSION
4320-
# ifdef __cpp_lib_three_way_comparison
4321-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
4322-
# endif
4312+
# ifndef __cpp_lib_three_way_comparison
4313+
# error "__cpp_lib_three_way_comparison should be defined in c++20"
4314+
# endif
4315+
# if __cpp_lib_three_way_comparison != 201711L
4316+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++20"
43234317
# endif
43244318

43254319
# ifndef __cpp_lib_to_address
@@ -5894,17 +5888,11 @@
58945888
# error "__cpp_lib_text_encoding should not be defined before c++26"
58955889
# endif
58965890

5897-
# if !defined(_LIBCPP_VERSION)
5898-
# ifndef __cpp_lib_three_way_comparison
5899-
# error "__cpp_lib_three_way_comparison should be defined in c++23"
5900-
# endif
5901-
# if __cpp_lib_three_way_comparison != 201907L
5902-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++23"
5903-
# endif
5904-
# else // _LIBCPP_VERSION
5905-
# ifdef __cpp_lib_three_way_comparison
5906-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
5907-
# endif
5891+
# ifndef __cpp_lib_three_way_comparison
5892+
# error "__cpp_lib_three_way_comparison should be defined in c++23"
5893+
# endif
5894+
# if __cpp_lib_three_way_comparison != 201711L
5895+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++23"
59085896
# endif
59095897

59105898
# ifndef __cpp_lib_to_address
@@ -7749,17 +7737,11 @@
77497737
# endif
77507738
# endif
77517739

7752-
# if !defined(_LIBCPP_VERSION)
7753-
# ifndef __cpp_lib_three_way_comparison
7754-
# error "__cpp_lib_three_way_comparison should be defined in c++26"
7755-
# endif
7756-
# if __cpp_lib_three_way_comparison != 201907L
7757-
# error "__cpp_lib_three_way_comparison should have the value 201907L in c++26"
7758-
# endif
7759-
# else // _LIBCPP_VERSION
7760-
# ifdef __cpp_lib_three_way_comparison
7761-
# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
7762-
# endif
7740+
# ifndef __cpp_lib_three_way_comparison
7741+
# error "__cpp_lib_three_way_comparison should be defined in c++26"
7742+
# endif
7743+
# if __cpp_lib_three_way_comparison != 201711L
7744+
# error "__cpp_lib_three_way_comparison should have the value 201711L in c++26"
77637745
# endif
77647746

77657747
# 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
@@ -1246,9 +1246,9 @@ def add_version_header(tc):
12461246
},
12471247
{
12481248
"name": "__cpp_lib_three_way_comparison",
1249-
"values": {"c++20": 201907},
1249+
"values": {"c++20": 201711},
1250+
# {"c++20": 201907} # P1614R2 The Mothership has Landed (see P1902R1 Missing feature-test macros 2017-2019)
12501251
"headers": ["compare"],
1251-
"unimplemented": True,
12521252
},
12531253
{
12541254
"name": "__cpp_lib_to_address",

0 commit comments

Comments
 (0)