From 72cd15b20a887bed9b0b1f4196be99fe052247b4 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 12 Jul 2024 00:30:24 +0100 Subject: libstdc++: Support P2510R3 "Formatting pointers" as a DR for C++20 We already enable this for -std=gnu++20 but we can do it for -std=c++20 too. Both libc++ and MSVC also treat this change as a DR for C++20. Now that the previous change to the value of __cpp_lib_format is supported, we can finally update it to 202304 to indicate support for this feature too. libstdc++-v3/ChangeLog: * include/bits/version.def (format): Update value for P2510R3. * include/bits/version.h: Regenerate. * include/std/format (_GLIBCXX_P2518R3): Remove misspelled macro and check __glibcxx_format instead. * testsuite/std/format/functions/format.cc: Check value of the __cpp_lib_format macro for formatting pointers support. * testsuite/std/format/parse_ctx.cc: Likewise. --- libstdc++-v3/testsuite/std/format/functions/format.cc | 2 +- libstdc++-v3/testsuite/std/format/parse_ctx.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'libstdc++-v3/testsuite') diff --git a/libstdc++-v3/testsuite/std/format/functions/format.cc b/libstdc++-v3/testsuite/std/format/functions/format.cc index 78cc1ab..5152bb0 100644 --- a/libstdc++-v3/testsuite/std/format/functions/format.cc +++ b/libstdc++-v3/testsuite/std/format/functions/format.cc @@ -458,7 +458,7 @@ test_pointer() s = std::format("{:20} {:20p}", p, pc); VERIFY( s == (str_int + ' ' + str_int) ); -#if __cplusplus > 202302L || ! defined __STRICT_ANSI__ +#if __cpp_lib_format >= 202304L // P2510R3 Formatting pointers s = std::format("{:06} {:07P} {:08p}", (void*)0, (const void*)0, nullptr); VERIFY( s == "0x0000 0X00000 0x000000" ); diff --git a/libstdc++-v3/testsuite/std/format/parse_ctx.cc b/libstdc++-v3/testsuite/std/format/parse_ctx.cc index 497427b..3b3201c 100644 --- a/libstdc++-v3/testsuite/std/format/parse_ctx.cc +++ b/libstdc++-v3/testsuite/std/format/parse_ctx.cc @@ -266,8 +266,8 @@ test_pointer() VERIFY( ! is_std_format_spec_for("G") ); VERIFY( ! is_std_format_spec_for("+p") ); -#if __cplusplus > 202302L || ! defined __STRICT_ANSI__ - // As an extension, we support P2510R3 Formatting pointers +#if __cpp_lib_format >= 202304L + // P2510R3 Formatting pointers VERIFY( is_std_format_spec_for("P") ); VERIFY( is_std_format_spec_for("0p") ); VERIFY( is_std_format_spec_for("0P") ); -- cgit v1.1