diff --git a/libcxx/include/version b/libcxx/include/version index a91c344c43609..7aa002e257b0a 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -93,7 +93,7 @@ __cpp_lib_expected 202211L __cpp_lib_filesystem 201703L __cpp_lib_format 202106L __cpp_lib_format_ranges 202207L -__cpp_lib_format_uchar 202311L <> +__cpp_lib_format_uchar 202311L __cpp_lib_formatters 202302L __cpp_lib_forward_like 202207L __cpp_lib_freestanding_algorithm 202311L @@ -188,7 +188,7 @@ __cpp_lib_remove_cvref 201711L __cpp_lib_result_of_sfinae 201210L __cpp_lib_robust_nonmodifying_seq_ops 201304L __cpp_lib_sample 201603L -__cpp_lib_saturation_arithmetic 202311L <> +__cpp_lib_saturation_arithmetic 202311L __cpp_lib_scoped_lock 201703L __cpp_lib_semaphore 201907L __cpp_lib_shared_mutex 201505L diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/.version.compile.pass.cpp deleted file mode 100644 index 2486985cefaca..0000000000000 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/.version.compile.pass.cpp +++ /dev/null @@ -1,105 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// WARNING: This test was generated by generate_feature_test_macro_components.py -// and should not be edited manually. -// -// clang-format off - -// <> - -// Test the feature test macros defined by <> - -/* Constant Value - __cpp_lib_format_uchar 202311L [C++20] - __cpp_lib_saturation_arithmetic 202311L [C++26] -*/ - -#include <> -#include "test_macros.h" - -#if TEST_STD_VER < 14 - -# ifdef __cpp_lib_format_uchar -# error "__cpp_lib_format_uchar should not be defined before c++20" -# endif - -# ifdef __cpp_lib_saturation_arithmetic -# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" -# endif - -#elif TEST_STD_VER == 14 - -# ifdef __cpp_lib_format_uchar -# error "__cpp_lib_format_uchar should not be defined before c++20" -# endif - -# ifdef __cpp_lib_saturation_arithmetic -# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" -# endif - -#elif TEST_STD_VER == 17 - -# ifdef __cpp_lib_format_uchar -# error "__cpp_lib_format_uchar should not be defined before c++20" -# endif - -# ifdef __cpp_lib_saturation_arithmetic -# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" -# endif - -#elif TEST_STD_VER == 20 - -# ifndef __cpp_lib_format_uchar -# error "__cpp_lib_format_uchar should be defined in c++20" -# endif -# if __cpp_lib_format_uchar != 202311L -# error "__cpp_lib_format_uchar should have the value 202311L in c++20" -# endif - -# ifdef __cpp_lib_saturation_arithmetic -# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" -# endif - -#elif TEST_STD_VER == 23 - -# ifndef __cpp_lib_format_uchar -# error "__cpp_lib_format_uchar should be defined in c++23" -# endif -# if __cpp_lib_format_uchar != 202311L -# error "__cpp_lib_format_uchar should have the value 202311L in c++23" -# endif - -# ifdef __cpp_lib_saturation_arithmetic -# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" -# endif - -#elif TEST_STD_VER > 23 - -# ifndef __cpp_lib_format_uchar -# error "__cpp_lib_format_uchar should be defined in c++26" -# endif -# if __cpp_lib_format_uchar != 202311L -# error "__cpp_lib_format_uchar should have the value 202311L in c++26" -# endif - -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_saturation_arithmetic -# error "__cpp_lib_saturation_arithmetic should be defined in c++26" -# endif -# if __cpp_lib_saturation_arithmetic != 202311L -# error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++26" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_saturation_arithmetic -# error "__cpp_lib_saturation_arithmetic 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/format.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp index 4e2c50483c229..aa7b2f4286827 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp @@ -18,6 +18,7 @@ /* Constant Value __cpp_lib_format 202106L [C++20] __cpp_lib_format_ranges 202207L [C++23] + __cpp_lib_format_uchar 202311L [C++20] */ #include @@ -33,6 +34,10 @@ # error "__cpp_lib_format_ranges should not be defined before c++23" # endif +# ifdef __cpp_lib_format_uchar +# error "__cpp_lib_format_uchar should not be defined before c++20" +# endif + #elif TEST_STD_VER == 14 # ifdef __cpp_lib_format @@ -43,6 +48,10 @@ # error "__cpp_lib_format_ranges should not be defined before c++23" # endif +# ifdef __cpp_lib_format_uchar +# error "__cpp_lib_format_uchar should not be defined before c++20" +# endif + #elif TEST_STD_VER == 17 # ifdef __cpp_lib_format @@ -53,6 +62,10 @@ # error "__cpp_lib_format_ranges should not be defined before c++23" # endif +# ifdef __cpp_lib_format_uchar +# error "__cpp_lib_format_uchar should not be defined before c++20" +# endif + #elif TEST_STD_VER == 20 # if !defined(_LIBCPP_VERSION) @@ -72,6 +85,13 @@ # error "__cpp_lib_format_ranges should not be defined before c++23" # endif +# ifndef __cpp_lib_format_uchar +# error "__cpp_lib_format_uchar should be defined in c++20" +# endif +# if __cpp_lib_format_uchar != 202311L +# error "__cpp_lib_format_uchar should have the value 202311L in c++20" +# endif + #elif TEST_STD_VER == 23 # if !defined(_LIBCPP_VERSION) @@ -94,6 +114,13 @@ # error "__cpp_lib_format_ranges should have the value 202207L in c++23" # endif +# ifndef __cpp_lib_format_uchar +# error "__cpp_lib_format_uchar should be defined in c++23" +# endif +# if __cpp_lib_format_uchar != 202311L +# error "__cpp_lib_format_uchar should have the value 202311L in c++23" +# endif + #elif TEST_STD_VER > 23 # if !defined(_LIBCPP_VERSION) @@ -116,5 +143,12 @@ # error "__cpp_lib_format_ranges should have the value 202207L in c++26" # endif +# ifndef __cpp_lib_format_uchar +# error "__cpp_lib_format_uchar should be defined in c++26" +# endif +# if __cpp_lib_format_uchar != 202311L +# error "__cpp_lib_format_uchar should have the value 202311L in c++26" +# endif + #endif // TEST_STD_VER > 23 diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp index 60004b06c5ff5..b510eefc69a5d 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp @@ -15,12 +15,13 @@ // Test the feature test macros defined by -/* Constant Value - __cpp_lib_constexpr_numeric 201911L [C++20] - __cpp_lib_gcd_lcm 201606L [C++17] - __cpp_lib_interpolate 201902L [C++20] - __cpp_lib_parallel_algorithm 201603L [C++17] - __cpp_lib_ranges_iota 202202L [C++23] +/* Constant Value + __cpp_lib_constexpr_numeric 201911L [C++20] + __cpp_lib_gcd_lcm 201606L [C++17] + __cpp_lib_interpolate 201902L [C++20] + __cpp_lib_parallel_algorithm 201603L [C++17] + __cpp_lib_ranges_iota 202202L [C++23] + __cpp_lib_saturation_arithmetic 202311L [C++26] */ #include @@ -48,6 +49,10 @@ # error "__cpp_lib_ranges_iota should not be defined before c++23" # endif +# ifdef __cpp_lib_saturation_arithmetic +# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" +# endif + #elif TEST_STD_VER == 14 # ifdef __cpp_lib_constexpr_numeric @@ -70,6 +75,10 @@ # error "__cpp_lib_ranges_iota should not be defined before c++23" # endif +# ifdef __cpp_lib_saturation_arithmetic +# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" +# endif + #elif TEST_STD_VER == 17 # ifdef __cpp_lib_constexpr_numeric @@ -104,6 +113,10 @@ # error "__cpp_lib_ranges_iota should not be defined before c++23" # endif +# ifdef __cpp_lib_saturation_arithmetic +# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" +# endif + #elif TEST_STD_VER == 20 # ifndef __cpp_lib_constexpr_numeric @@ -144,6 +157,10 @@ # error "__cpp_lib_ranges_iota should not be defined before c++23" # endif +# ifdef __cpp_lib_saturation_arithmetic +# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" +# endif + #elif TEST_STD_VER == 23 # ifndef __cpp_lib_constexpr_numeric @@ -193,6 +210,10 @@ # endif # endif +# ifdef __cpp_lib_saturation_arithmetic +# error "__cpp_lib_saturation_arithmetic should not be defined before c++26" +# endif + #elif TEST_STD_VER > 23 # ifndef __cpp_lib_constexpr_numeric @@ -242,5 +263,18 @@ # endif # endif +# if !defined(_LIBCPP_VERSION) +# ifndef __cpp_lib_saturation_arithmetic +# error "__cpp_lib_saturation_arithmetic should be defined in c++26" +# endif +# if __cpp_lib_saturation_arithmetic != 202311L +# error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++26" +# endif +# else // _LIBCPP_VERSION +# ifdef __cpp_lib_saturation_arithmetic +# error "__cpp_lib_saturation_arithmetic 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 6a30324397883..70e18b6dde006 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -486,7 +486,9 @@ def add_version_header(tc): "values": { "c++20": 202311 # DR P2909R4 Fix formatting of code units as integers }, - "headers": [""], # Note not in format + "headers": [ + "format" # TODO verify this entry since the paper was underspecified. + ], }, { "name": "__cpp_lib_formatters", @@ -660,7 +662,7 @@ def add_version_header(tc): }, { "name": "__cpp_lib_ios_noreplace", - "values": { "c++23": 202207 }, + "values": {"c++23": 202207}, "headers": ["ios"], }, { @@ -1010,7 +1012,9 @@ def add_version_header(tc): { "name": "__cpp_lib_saturation_arithmetic", "values": {"c++26": 202311}, # P0543R3 Saturation arithmetic - "headers": [""], # Note not in + "headers": [ + "numeric" # TODO verify this entry since the paper was underspecified. + ], "unimplemented": True, }, {