-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++][test] __cpp_lib_within_lifetime
-> __cpp_lib_is_within_lifetime
#91896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc++][test] __cpp_lib_within_lifetime
-> __cpp_lib_is_within_lifetime
#91896
Conversation
@llvm/pr-subscribers-libcxx Author: Mital Ashok (MitalAshok) ChangesFull diff: https://github.com/llvm/llvm-project/pull/91896.diff 5 Files Affected:
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 17b3476d2c869..17d2da907692e 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -436,6 +436,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_hazard_pointer`` *unimplemented*
---------------------------------------------------------- -----------------
+ ``__cpp_lib_is_within_lifetime`` *unimplemented*
+ ---------------------------------------------------------- -----------------
``__cpp_lib_linalg`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_out_ptr`` *unimplemented*
@@ -465,7 +467,5 @@ Status
``__cpp_lib_to_chars`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_tuple_like`` *unimplemented*
- ---------------------------------------------------------- -----------------
- ``__cpp_lib_within_lifetime`` *unimplemented*
========================================================== =================
diff --git a/libcxx/include/version b/libcxx/include/version
index ba116957b033f..69556d731f1cf 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -143,6 +143,7 @@ __cpp_lib_is_null_pointer 201309L <type_traits>
__cpp_lib_is_pointer_interconvertible 201907L <type_traits>
__cpp_lib_is_scoped_enum 202011L <type_traits>
__cpp_lib_is_swappable 201603L <type_traits>
+__cpp_lib_is_within_lifetime 202306L <type_traits>
__cpp_lib_jthread 201911L <stop_token> <thread>
__cpp_lib_latch 201907L <latch>
__cpp_lib_launder 201606L <new>
@@ -251,7 +252,6 @@ __cpp_lib_unreachable 202202L <utility>
__cpp_lib_unwrap_ref 201811L <functional>
__cpp_lib_variant 202102L <variant>
__cpp_lib_void_t 201411L <type_traits>
-__cpp_lib_within_lifetime 202306L <type_traits>
*/
@@ -520,6 +520,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
// # define __cpp_lib_function_ref 202306L
// # define __cpp_lib_generate_random 202403L
// # define __cpp_lib_hazard_pointer 202306L
+// # define __cpp_lib_is_within_lifetime 202306L
// # define __cpp_lib_linalg 202311L
# undef __cpp_lib_out_ptr
// # define __cpp_lib_out_ptr 202311L
@@ -538,7 +539,6 @@ __cpp_lib_within_lifetime 202306L <type_traits>
// # define __cpp_lib_to_chars 202306L
# undef __cpp_lib_tuple_like
// # define __cpp_lib_tuple_like 202311L
-// # define __cpp_lib_within_lifetime 202306L
#endif
// clang-format on
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
index b1dd76b98720d..98277f832f5a0 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
@@ -30,6 +30,7 @@
__cpp_lib_is_pointer_interconvertible 201907L [C++20]
__cpp_lib_is_scoped_enum 202011L [C++23]
__cpp_lib_is_swappable 201603L [C++17]
+ __cpp_lib_is_within_lifetime 202306L [C++26]
__cpp_lib_logical_traits 201510L [C++17]
__cpp_lib_reference_from_temporary 202202L [C++23]
__cpp_lib_remove_cvref 201711L [C++20]
@@ -38,7 +39,6 @@
__cpp_lib_type_identity 201806L [C++20]
__cpp_lib_type_trait_variable_templates 201510L [C++17]
__cpp_lib_void_t 201411L [C++17]
- __cpp_lib_within_lifetime 202306L [C++26]
*/
#include <type_traits>
@@ -102,6 +102,10 @@
# error "__cpp_lib_is_swappable should not be defined before c++17"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_logical_traits
# error "__cpp_lib_logical_traits should not be defined before c++17"
# endif
@@ -134,10 +138,6 @@
# error "__cpp_lib_void_t should not be defined before c++17"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER == 14
# ifdef __cpp_lib_bool_constant
@@ -205,6 +205,10 @@
# error "__cpp_lib_is_swappable should not be defined before c++17"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_logical_traits
# error "__cpp_lib_logical_traits should not be defined before c++17"
# endif
@@ -243,10 +247,6 @@
# error "__cpp_lib_void_t should not be defined before c++17"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER == 17
# ifndef __cpp_lib_bool_constant
@@ -329,6 +329,10 @@
# error "__cpp_lib_is_swappable should have the value 201603L in c++17"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_logical_traits
# error "__cpp_lib_logical_traits should be defined in c++17"
# endif
@@ -376,10 +380,6 @@
# error "__cpp_lib_void_t should have the value 201411L in c++17"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER == 20
# ifndef __cpp_lib_bool_constant
@@ -489,6 +489,10 @@
# error "__cpp_lib_is_swappable should have the value 201603L in c++20"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_logical_traits
# error "__cpp_lib_logical_traits should be defined in c++20"
# endif
@@ -542,10 +546,6 @@
# error "__cpp_lib_void_t should have the value 201411L in c++20"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER == 23
# ifndef __cpp_lib_bool_constant
@@ -658,6 +658,10 @@
# error "__cpp_lib_is_swappable should have the value 201603L in c++23"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_logical_traits
# error "__cpp_lib_logical_traits should be defined in c++23"
# endif
@@ -720,10 +724,6 @@
# error "__cpp_lib_void_t should have the value 201411L in c++23"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER > 23
# ifndef __cpp_lib_bool_constant
@@ -836,6 +836,19 @@
# error "__cpp_lib_is_swappable should have the value 201603L in c++26"
# endif
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should be defined in c++26"
+# endif
+# if __cpp_lib_is_within_lifetime != 202306L
+# error "__cpp_lib_is_within_lifetime should have the value 202306L in c++26"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
# ifndef __cpp_lib_logical_traits
# error "__cpp_lib_logical_traits should be defined in c++26"
# endif
@@ -898,18 +911,5 @@
# error "__cpp_lib_void_t should have the value 201411L in c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should be defined in c++26"
-# endif
-# if __cpp_lib_within_lifetime != 202306L
-# error "__cpp_lib_within_lifetime should have the value 202306L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined because it is unimplemented in libc++!"
-# endif
-# endif
-
#endif // TEST_STD_VER > 23
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 d7035d7e5e3ad..7829e06f90760 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
@@ -130,6 +130,7 @@
__cpp_lib_is_pointer_interconvertible 201907L [C++20]
__cpp_lib_is_scoped_enum 202011L [C++23]
__cpp_lib_is_swappable 201603L [C++17]
+ __cpp_lib_is_within_lifetime 202306L [C++26]
__cpp_lib_jthread 201911L [C++20]
__cpp_lib_latch 201907L [C++20]
__cpp_lib_launder 201606L [C++17]
@@ -232,7 +233,6 @@
__cpp_lib_unwrap_ref 201811L [C++20]
__cpp_lib_variant 202102L [C++17]
__cpp_lib_void_t 201411L [C++17]
- __cpp_lib_within_lifetime 202306L [C++26]
*/
#include <version>
@@ -680,6 +680,10 @@
# error "__cpp_lib_is_swappable should not be defined before c++17"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_jthread
# error "__cpp_lib_jthread should not be defined before c++20"
# endif
@@ -1060,10 +1064,6 @@
# error "__cpp_lib_void_t should not be defined before c++17"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER == 14
# ifdef __cpp_lib_adaptor_iterator_pair_constructor
@@ -1530,6 +1530,10 @@
# error "__cpp_lib_is_swappable should not be defined before c++17"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_jthread
# error "__cpp_lib_jthread should not be defined before c++20"
# endif
@@ -1958,10 +1962,6 @@
# error "__cpp_lib_void_t should not be defined before c++17"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER == 17
# ifdef __cpp_lib_adaptor_iterator_pair_constructor
@@ -2518,6 +2518,10 @@
# error "__cpp_lib_is_swappable should have the value 201603L in c++17"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_jthread
# error "__cpp_lib_jthread should not be defined before c++20"
# endif
@@ -3054,10 +3058,6 @@
# error "__cpp_lib_void_t should have the value 201411L in c++17"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER == 20
# ifdef __cpp_lib_adaptor_iterator_pair_constructor
@@ -3797,6 +3797,10 @@
# error "__cpp_lib_is_swappable should have the value 201603L in c++20"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_jthread
# error "__cpp_lib_jthread should be defined in c++20"
@@ -4438,10 +4442,6 @@
# error "__cpp_lib_void_t should have the value 201411L in c++20"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER == 23
# ifndef __cpp_lib_adaptor_iterator_pair_constructor
@@ -5259,6 +5259,10 @@
# error "__cpp_lib_is_swappable should have the value 201603L in c++23"
# endif
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined before c++26"
+# endif
+
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_jthread
# error "__cpp_lib_jthread should be defined in c++23"
@@ -6056,10 +6060,6 @@
# error "__cpp_lib_void_t should have the value 201411L in c++23"
# endif
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined before c++26"
-# endif
-
#elif TEST_STD_VER > 23
# ifndef __cpp_lib_adaptor_iterator_pair_constructor
@@ -7042,6 +7042,19 @@
# error "__cpp_lib_is_swappable should have the value 201603L in c++26"
# endif
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should be defined in c++26"
+# endif
+# if __cpp_lib_is_within_lifetime != 202306L
+# error "__cpp_lib_is_within_lifetime should have the value 202306L in c++26"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_is_within_lifetime
+# error "__cpp_lib_is_within_lifetime should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && (!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_SYNC)
# ifndef __cpp_lib_jthread
# error "__cpp_lib_jthread should be defined in c++26"
@@ -7911,18 +7924,5 @@
# error "__cpp_lib_void_t should have the value 201411L in c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should be defined in c++26"
-# endif
-# if __cpp_lib_within_lifetime != 202306L
-# error "__cpp_lib_within_lifetime should have the value 202306L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_within_lifetime
-# error "__cpp_lib_within_lifetime should not be defined because it is unimplemented in libc++!"
-# endif
-# endif
-
#endif // TEST_STD_VER > 23
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index d0171c84acbc3..a7c483670e0ed 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -767,6 +767,14 @@ def add_version_header(tc):
"values": {"c++17": 201603},
"headers": ["type_traits"],
},
+ {
+ "name": "__cpp_lib_is_within_lifetime",
+ "values": {
+ "c++26": 202306 # P2641R4 Checking if a union alternative is active
+ },
+ "headers": ["type_traits"],
+ "unimplemented": True,
+ },
{
"name": "__cpp_lib_jthread",
"values": {"c++20": 201911},
@@ -1342,14 +1350,6 @@ def add_version_header(tc):
"values": {"c++17": 201411},
"headers": ["type_traits"],
},
- {
- "name": "__cpp_lib_within_lifetime",
- "values": {
- "c++26": 202306 # P2641R4 Checking if a union alternative is active
- },
- "headers": ["type_traits"],
- "unimplemented": True,
- },
]
]
|
This was renamed when P2641R4 was adopted into the standard: cplusplus/draft@0facada https://wg21.link/version.syn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch!
Can you update the commit message with your comment?
This was renamed when [P2641R4](https://wg21.link/P2641R4) was adopted into the standard: https://github.com/cplusplus/draft/commit/0facada4cadd97e1ba15bfaea76a804f1dc5c309 https://wg21.link/version.syn
That way the information is available in git.
817c41f
to
1253071
Compare
✅ With the latest revision this PR passed the Python code formatter. |
…fetime` The feature test macro was renamed when [P2641R4](https://wg21.link/P2641R4) was adopted into the standard: cplusplus/draft@0facada https://wg21.link/version.syn#lib:__cpp_lib_is_constant_evaluated
1253071
to
3e5eed5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM!
The feature test macro was renamed when P2641R4 was adopted into the standard: cplusplus/draft@0facada https://wg21.link/version.syn#lib:__cpp_lib_is_constant_evaluated