[committed] libstdc++: Remove unnecessary dg-options and outdated comment

2023-09-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- It's no longer true that 1.0if has type float _Complex when GNU extensions are enabled, so remove the hardcoded -std option. libstdc++-v3/ChangeLog: * testsuite/26_numerics/complex/literals/types.cc: Remove dg-options and add

[committed] libstdc++: Enable std::auto_ptr tests for C++11 and later

2023-09-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- There is no reason to only test std::auto_ptr with -std=c++03, we just need to handle the deprecated warnings for C++11 and later. libstdc++-v3/ChangeLog: * testsuite/20_util/auto_ptr/1.cc: Remove dg-options -std=c++03 and add

[committed] libstdc++: Remove dg-options "-std=c++98" from TR1 tests

2023-09-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- These tests need slight adjustments to be valid in C++11 and later, but there's no reason that can't be done, so that we test them in more modes. libstdc++-v3/ChangeLog: * testsuite/tr1/6_containers/utility/pair.cc: Remove dg-options

[committed] libstdc++: Add explicit -std=gnu++98 to tests that use { target c++98_only }

2023-09-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * testsuite/23_containers/deque/requirements/explicit_instantiation/2.cc: Add dg-options to restrict the test to C++98 mode. * testsuite/23_containers/list/requirements/explicit_instantiation/2.cc:

[committed] libstdc++: Fix filenames and comments in tests [PR26142]

2023-09-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- These tests have transposed digits in the filenames and comments. libstdc++-v3/ChangeLog: PR libstdc++/26142 * testsuite/23_containers/vector/26412-1.cc: Moved to... * testsuite/23_containers/vector/26142-1.cc: ...here.

[committed] libstdc++: Add missing target selector to std::expected test

2023-09-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This test should use a target selector of c++23 so that the explicit -std=gnu++23 option can be removed, to allow testing with later standards too. libstdc++-v3/ChangeLog: * testsuite/20_util/expected/bad.cc: Add missing target

[committed] libstdc++: Add { target c++98_only } to tests

2023-09-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- These test behaviour only seen with -std=c++03 so the target selector should match. libstdc++-v3/ChangeLog: * testsuite/20_util/bitset/107037.cc: Add c++98_only selector. * testsuite/26_numerics/complex/56111.cc: Likewise. ---

Re: [PATCH v5 1/4] c++, libstdc++: Implement __is_arithmetic built-in trait

2023-09-04 Thread Jonathan Wakely via Gcc-patches
On Fri, 1 Sept 2023 at 12:25, Ken Matsui via Libstdc++ wrote: > > This patch implements built-in trait for std::is_arithmetic. The libstdc++-v3 parts are OK for trunk. > > gcc/cp/ChangeLog: > > * cp-trait.def: Define __is_arithmetic. > * constraint.cc (diagnose_trait_expr):

Re: [PING][PATCH v2 2/2] libstdc++: Use new built-in trait __is_signed

2023-09-04 Thread Jonathan Wakely via Gcc-patches
On Fri, 1 Sept 2023 at 14:01, Ken Matsui wrote: > > Ping for the use of __is_signed built-in. > > Sincerely, > Ken Matsui > > > On Wed, Jul 12, 2023 at 6:45 PM Ken Matsui wrote: > > > > This patch lets libstdc++ use new built-in trait __is_signed. OK for trunk after the built-in is approved for

[committed] libstdc++: Fix debug-mode tests for constexpr algorithms

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- These tests started failing at some point: FAIL: 25_algorithms/copy/debug/constexpr_neg.cc (test for errors, line 49) FAIL: 25_algorithms/copy/debug/constexpr_neg.cc (test for excess errors) FAIL: 25_algorithms/equal/debug/constexpr_neg.cc (test

[committed] libstdc++: Add -Wno-self-move to two filesystem tests

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * testsuite/27_io/filesystem/iterators/91067.cc: Add -Wno-self-move to options. * testsuite/27_io/filesystem/path/assign/copy.cc: Likewise. ---

Re: [PATCH] libstdc++: fix memory clobbering in std::vector [PR110879]

2023-09-01 Thread Jonathan Wakely via Gcc-patches
At Marek and Jason's suggestion I've moved the new test to a subdir: c++: Move new test to 'opt' sub-directory gcc/testsuite/ChangeLog: * g++.dg/pr110879.C: Moved to... * g++.dg/opt/pr110879.C: ...here.

Re: [RFC] libstdc++: Make --enable-libstdcxx-backtrace=auto default to yes

2023-09-01 Thread Jonathan Wakely via Gcc-patches
On Fri, 1 Sept 2023 at 12:16, Jonathan Wakely wrote: > > On Wed, 23 Aug 2023 at 17:03, Jonathan Wakely via Libstdc++ > wrote: > > > > Any objections to this? It's a C++23 feture, so should be enabled by > > default. > > I've pushed this to trunk, so let's see

Re: [committed] libstdc++: Fix compare_exchange_padding.cc test for std::atomic_ref

2023-09-01 Thread Jonathan Wakely via Gcc-patches
On Mon, 31 Oct 2022 at 15:34, Eric Botcazou wrote: > > > The test was only failing for me with -m32 (and not -m64), so I didn't > > notice until now. That probably means we should make the test fail more > > reliably if the padding isn't being cleared. > > The tests fail randomly for me on

Re: [PATCH] libstdc++: fix memory clobbering in std::vector [PR110879]

2023-09-01 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 08:43, Vladimir Palevich wrote: > > On Thu, 17 Aug 2023 at 01:51, Jonathan Wakely wrote: > > > > On 09/08/23 01:34 +0300, Vladimir Palevich wrote: > > >Because of the recent change in _M_realloc_insert and _M_default_append, > > >call

[committed] libstdc++: Use std::string::__resize_and_overwrite in std::filesystem

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- There are a few places in the std::filesystem code that use a string as a buffer for OS APIs to write to. We can use the new extension __resize_and_overwrite to avoid redundant initialization of those buffers. libstdc++-v3/ChangeLog: *

[committed] libstdc++: Use a loop in atomic_ref::compare_exchange_strong [PR111077]

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 needed too. -- >8 -- We need to use a loop in std::atomic_ref::compare_exchange_strong in order to properly implement the C++20 requirement that padding bits do not participate when checking the value for equality. The variable being

Re: [RFC] libstdc++: Make --enable-libstdcxx-backtrace=auto default to yes

2023-09-01 Thread Jonathan Wakely via Gcc-patches
On Wed, 23 Aug 2023 at 17:03, Jonathan Wakely via Libstdc++ wrote: > > Any objections to this? It's a C++23 feture, so should be enabled by > default. I've pushed this to trunk, so let's see what breaks! > > -- >8 -- > > This causes libstdc++_libbacktrace.a to be buil

[committed] libstdc++: Use dg-require-filesystem-ts in link test

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This test expects to be able to link, which fails if there are undefined references to chdir, mkdir etc. in fs_ops.o in the libstdc++.a archive. libstdc++-v3/ChangeLog: * testsuite/27_io/filesystem/path/108636.cc: Add dg-require for

[committed] libstdc++: Avoid useless dependency on read_symlink from tzdb

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- chrono::tzdb::current_zone uses filesystem::read_symlink, which creates a dependency on the fs_ops.o object in libstdc++.a, which then creates dependencies on several OS functions if --gc-sections isn't used. For more details see PR libstdc++/104167

[committed] libstdc++: Fix how chrono::parse handles errors for time-of-day values

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- We fail to diagnose an error and extract an incorrect time for cases like "25:59" >> parse("%H:%M", mins). The bad "25" hour value gets ignored (on the basis that we might not care about it if trying to extract something like a weekday or a month

[committed] libstdc++: Simplify __format::_Sink::_M_reset

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- Using an offset as the second argument instead of an iterator makes it easier for callers, as they don't need to create an lvalue span in order to get an iterator from it for the _M_reset call. libstdc++-v3/ChangeLog: * include/std/format

[committed] libstdc++: Do not allow chrono::parse to overflow for %C [PR111162]

2023-09-01 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/62 * include/bits/chrono_io.h (_Parser::Operator()): Check %C values are in range of year::min() to year::max(). * testsuite/std/time/parse.cc: Check out of range centuries.

Re: [PATCH][Hashtable] Performance optimization through use of insertion hint

2023-09-01 Thread Jonathan Wakely via Gcc-patches
On Tue, 29 Aug 2023 at 20:52, François Dumont via Libstdc++ wrote: > > Hi > > Any feedback regarding this patch ? This is a fairly large patch and before we make any more changes to unordered containers we have an ABI break to fix: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111050 > >

Re: [PATCH][Hashtable] Performance optimization through use of insertion hint

2023-09-01 Thread Jonathan Wakely via Gcc-patches
On Fri, 1 Sept 2023 at 09:59, Jonathan Wakely wrote: > > On Tue, 29 Aug 2023 at 20:52, François Dumont via Libstdc++ > wrote: > > > > Hi > > > > Any feedback regarding this patch ? > > This is a fairly large patch and before we make any more changes to >

Re: [PATCH] libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238)

2023-08-31 Thread Jonathan Wakely via Gcc-patches
On Thu, 31 Aug 2023 at 18:42, Jonathan Wakely wrote: > > On Thu, 31 Aug 2023 at 16:26, Christophe Lyon > wrote: > > > > As discussed in PR104167 (comments #8 and below), and PR111238, using > > -Wl,-gc-sections in the libstdc++ testsuite for arm-eabi > > (cros

Re: [PATCH] libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238)

2023-08-31 Thread Jonathan Wakely via Gcc-patches
On Thu, 31 Aug 2023, 18:43 Jonathan Wakely via Libstdc++, < libstd...@gcc.gnu.org> wrote: > On Thu, 31 Aug 2023 at 16:26, Christophe Lyon > wrote: > > > > As discussed in PR104167 (comments #8 and below), and PR111238, using > > -Wl,-gc-sections in the libstdc++ tes

Re: [PATCH] libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238)

2023-08-31 Thread Jonathan Wakely via Gcc-patches
es to chdir, > mkdir, chmod, pathconf, ... so maybe it's better to keep the status > quo and not apply this patch? I'm undecided about this for now, but let's wait for HP's cris-elf testing anyway. commit eea73ea3bdd44a8f7d8c0f54b15bfba9058f6ce8 Author: Jonathan Wakely Date: Thu Aug 31 18

[committed] libstdc++: Add test for illegal pointer arithmetic in format [PR111102]

2023-08-24 Thread Jonathan Wakely via Gcc-patches
From: Paul Dreik Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/02 * testsuite/std/format/string.cc: Check wide character format strings with out-of-range widths. --- libstdc++-v3/testsuite/std/format/string.cc | 15

Re: [PATCH] Fix for bug libstdc++/111102 pointer arithmetic on nullptr

2023-08-24 Thread Jonathan Wakely via Gcc-patches
On Wed, 23 Aug 2023 at 19:48, Paul Dreik via Libstdc++ wrote: > > This fixes pointer arithmetic made on a null pointer, which I found > through fuzzing. > Tested on debian/amd64. > > Thanks, Paul Thanks. Pushed to trunk, backport to gcc-13 to follow. I also added your testcase from the bug

[committed] libstdc++: Tweak some preprocessor conditions for feature tests

2023-08-24 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- Update a preprocessor condition using __cplusplus and _GLIBCXX_HOSTED to use the relevant feature test macro for . Also add comments to some conditions saying which C++ standard revision the check corresponds to. libstdc++-v3/ChangeLog: *

[committed] libstdc++: Fix -Wunused-but-set-variable in std::format_to test

2023-08-24 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * testsuite/std/format/functions/format_to.cc: Avoid warning for unused variables. --- libstdc++-v3/testsuite/std/format/functions/format_to.cc | 8 1 file changed, 4 insertions(+), 4 deletions(-)

[committed] libstdc++: Implement new SI prefixes in for C++23 (P2734R0)

2023-08-24 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This is a no-op for libstdc++, because our intmax_t is a 64-bit type and so is incapable of representing the largest and smallest ratios from C++11, let alone the new ones. I've added them to the file anyway (and defined the feature test macro) so

[committed] libstdc++: Add pretty printer for std::locale

2023-08-24 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Maybe worth backporting. -- >8 -- Print the locale's name, except when it uses the same named C locale for all categories except one, in which case print something like: std::locale = "en_GB.UTF-8" with "LC_CTYPE=en_US.UTF-8" libstdc++-v3/ChangeLog:

[committed] libstdc++: Declutter std::optional and std:variant pretty printers [PR110944]

2023-08-24 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- As the PR says, including the template arguments in the GDB output of these class templates can result in very long names, especially for std::variant. You can use 'whatis' or other GDB commands to get details of the type, we don't need to include

Re: [committed] i386: Fix grammar typo in diagnostic

2023-08-24 Thread Jonathan Wakely via Gcc-patches
On Thu, 24 Aug 2023, 04:38 Hongtao Liu, wrote: > On Wed, Aug 23, 2023 at 4:08 PM Hongtao Liu wrote: > > > > On Wed, Aug 23, 2023 at 3:02 PM Jonathan Wakely > wrote: > > > > > > > > > > > > On Wed, 23 Aug 2023, 06:15 Hongt

[RFC] libstdc++: Make --enable-libstdcxx-backtrace=auto default to yes

2023-08-23 Thread Jonathan Wakely via Gcc-patches
Any objections to this? It's a C++23 feture, so should be enabled by default. -- >8 -- This causes libstdc++_libbacktrace.a to be built by default. This might fail on some targets, in which case we can make the 'auto' choice expand to either 'yes' or 'no' depending on the target.

Re: [committed] i386: Fix grammar typo in diagnostic

2023-08-23 Thread Jonathan Wakely via Gcc-patches
On Wed, 23 Aug 2023, 06:15 Hongtao Liu via Libstdc++, wrote: > On Wed, Aug 23, 2023 at 7:28 AM Hongtao Liu wrote: > > > > On Tue, Aug 8, 2023 at 5:22 AM Marek Polacek via Libstdc++ > > wrote: > > > > > > On Mon, Aug 07, 2023 at 10:12:35PM +0100,

Re: [PATCH] Fix tests sensitive to internal library allocations

2023-08-21 Thread Jonathan Wakely via Gcc-patches
On Mon, 21 Aug 2023 at 21:20, François Dumont wrote: > > Here is the updated and tested patch. OK for trunk, thanks. We could consider it for the branches too (I'm going to remove the global strings on the gcc-13 branch tomorrow). > > On 21/08/2023 20:07, Jonathan Wakely wrote: &g

Re: [PATCH 0/2] libstdc++: Documentation fixes.

2023-08-21 Thread Jonathan Wakely via Gcc-patches
On Mon, 21 Aug 2023, 21:33 Bruno Victal, wrote: > This small patch-series fixes the 'doc-install-info' rule > and updates the URI used for docbook-xsl. > Thanks! I'll get these committed tomorrow. > Bruno Victal (2): > libstdc++: Fix 'doc-install-info' rule. > libstdc++: Update docbook

Re: [PATCH] Fix tests sensitive to internal library allocations

2023-08-21 Thread Jonathan Wakely via Gcc-patches
On Mon, 21 Aug 2023 at 18:05, François Dumont via Libstdc++ wrote: > > Hi > > Here is a propocal to fix tests sensitive to libstdc++ internal allocations. Surely the enter() and exit() calls should be a constructor and destructor? The constructor could use count() to get the count, and then

[committed] libstdc++: Remove reliance on unspecified behaviour in std::rethrow_if_nested test

2023-08-21 Thread Jonathan Wakely via Gcc-patches
This is the patch resolving the non-portable test that Iain raised in: https://gcc.gnu.org/pipermail/libstdc++/2023-August/056534.html Tested x86_64-linux. Pushed to trunk. Backports would be OK, but I don't think they are needed. -- >8 -- This test case calls std::set_terminate while there is

Re: [committed] libstdc++: Fix std::format("{:F}", inf) to use uppercase

2023-08-19 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 13:22, Jonathan Wakely via Libstdc++ wrote: > > Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 will follow. Re the backport, I forgot to say that this changes the order/values of the enumerators for _Pres_type. In theory that could cause incompatibilities b

[committed] libstdc++: Revert pre-C++23 support for 16-bit float types [PR111060]

2023-08-18 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux (--with-arch-32=i686). Pushed to trunk. -- >8 -- In r14-3304-g1a566fddea212a and r14-3305-g6cf214b4fc97f5 I tried to enable std::format for 16-bit float types before C++23. This causes errors for targets where the types are defined but can't actually be used, e.g. i686

[committed] libstdc++: Replace non-type-dependent uses of wchar_t in and

2023-08-18 Thread Jonathan Wakely via Gcc-patches
This should be really fixed now! Tested x86_64-linux. Pushed to trunk. -- >8 -- This is one more piece of the rework to make wchar_t support in std::format depend on _GLIBCXX_USE_WCHAR_T. In the __to_wstring_numeric function is called with arguments that aren't type-dependent, so a

[committed] libstdc++: Fix incomplete rework of wchar_t support in std::format

2023-08-18 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- r14-3300-g023a62b77f999b left make_wformat_args and some uses of std::wformat_context unguarded by _GLIBCXX_USE_WCHAR_T. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (operator<<): Use __format_context. * include/std/format

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 20:44, Jonathan Wakely wrote: > > On Thu, 17 Aug 2023 at 20:37, Jonathan Wakely wrote: > > > > On Thu, 17 Aug 2023 at 19:59, Jonathan Wakely wrote: > > > > > > On Thu, 17 Aug 2023 at 18:40, François Dumont > > > wrote

Re: [committed] libstdc++: Reuse double overload of __convert_to_v if possible

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Fri, 18 Aug 2023 at 00:20, Hans-Peter Nilsson wrote: > > > Date: Thu, 17 Aug 2023 21:32:29 +0100 > > From: Jonathan Wakely via Gcc-patches > > > Tested x86_64-linux. Pushed to trunk. > > Does the below typo imply that for x86_64-linux, > "__DBL_MAN

[committed] libstdc++: Replace global std::string objects in tzdb.cc

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- When the library is built with --disable-libstdcxx-dual-abi the only type of std::string supported is the COW string, and the two global std::string objects in tzdb.cc have to allocate memory. I added them thinking they would fit in the SSO string

[committed] libstdc++: Add std::formatter specializations for extended float types

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This makes it possible to format _Float32, _Float64 etc. in C++20 mode. Previously it was only possible to format them in C++23 when the typedefs and the std::to_chars overloads were defined. Instead of relying on std::to_chars for those types, we

[committed] libstdc++: Define std::numeric_limits<_FloatNN> before C++23

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- The extended floating-point types such as _Float32 are supported by GCC prior to C++23, you just can't use the standard-conforming names from to refer to them. This change defines the specializations of std::numeric_limits for those types for older

[committed] libstdc++: Reuse double overload of __convert_to_v if possible

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- For targets where double and long double have the same representation we can reuse the same __convert_to_v code for both types. This will slightly reduce the size of the compiled code in the library. libstdc++-v3/ChangeLog: *

[committed] libstdc++: Make __cmp_cat::__unseq constructor consteval

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Probably good to backport. -- >8 -- This constructor should only ever be used with a literal 0 as the argument, so we can make it consteval. This has the nice advantage that it is expanded immediately in the front end, and so GDB will never step into the

[committed] libstdc++: Micro-optimize construction of named std::locale

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This shaves about 100ns off the std::locale constructor for named locales (which is only about 1% of the total time). Using !*s instead of !strcmp(s, "") doesn't make any difference as GCC optimizes that already even at -O1. !strcmp(s, "C") is

[committed] libstdc++: Simplify chrono::__units_suffix using std::format

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. -- >8 -- For std::chrono formatting we can simplify __units_suffix by using std::format_to to generate the "[n/m]s" suffix with the correct character type and write directly to the output iterator, so it doesn't need to be

[committed] libstdc++: Rework std::format support for wchar_t

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This changes how std::format creates wide strings, by replacing uses of std::ctype::widen with the recently-added __to_wstring_numeric helper function. This removes the dependency on the locale, which should only be used for locale-specific formats

[committed] libstdc++: Optimize std::string::assign(Iter, Iter) [PR110945]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- Calling string::assign(Iter, Iter) with "foreign" iterators (not the string's own iterator or pointer types) currently constructs a temporary string and then calls replace to copy the characters from it. That means we copy from the iterators twice,

[committed] libstdc++: Fix -Wunused-parameter in

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/experimental/internet (address_v4::to_string): Remove unused parameter name. --- libstdc++-v3/include/experimental/internet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[committed] libstdc++: Implement std::to_string in terms of std::format (P2587R3)

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This change for C++26 affects std::to_string for floating-point arguments, so that they should be formatted using std::format("{}", v) instead of using sprintf. The modified specification in the standard also affects integral arguments, but there's

[committed] libstdc++: Optimize std::to_string using std::string::resize_and_overwrite

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This uses std::string::__resize_and_overwrite to avoid initializing the string buffer with characters that are immediately overwritten. This results in about 6% better performance for the std_to_string case in int-benchmark.cc from

[committed] libstdc++: Define std::string::resize_and_overwrite for C++11 and COW string

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- There are several places in the library where we can improve performance using resize_and_overwrite so it's inconvenient only being able to use it in C++23 mode, and only for cxx11 strings. This adds it for COW strings, and also adds

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 20:37, Jonathan Wakely wrote: > > On Thu, 17 Aug 2023 at 19:59, Jonathan Wakely wrote: > > > > On Thu, 17 Aug 2023 at 18:40, François Dumont wrote: > > > > > > > > > On 17/08/2023 19:22, Jonathan Wakely wrote: > > &g

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 19:59, Jonathan Wakely wrote: > > On Thu, 17 Aug 2023 at 18:40, François Dumont wrote: > > > > > > On 17/08/2023 19:22, Jonathan Wakely wrote: > > > On Sun, 13 Aug 2023 at 14:27, François Dumont via Libstdc++ > > > wrote: >

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Thu, 17 Aug 2023 at 18:40, François Dumont wrote: > > > On 17/08/2023 19:22, Jonathan Wakely wrote: > > On Sun, 13 Aug 2023 at 14:27, François Dumont via Libstdc++ > > wrote: > >> Here is the fixed patch tested in all 3 modes: >

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-17 Thread Jonathan Wakely via Gcc-patches
On Sun, 13 Aug 2023 at 14:27, François Dumont via Libstdc++ wrote: > > Here is the fixed patch tested in all 3 modes: > > - _GLIBCXX_USE_DUAL_ABI > > - !_GLIBCXX_USE_DUAL_ABI && !_GLIBCXX_USE_CXX11_ABI > > - !_GLIBCXX_USE_DUAL_ABI && _GLIBCXX_USE_CXX11_ABI > > I don't know what you have in mind

[committed] libstdc++: Fix std::format("{:F}", inf) to use uppercase

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 will follow. -- >8 -- std::format was treating {:f} and {:F} identically on the basis that for the fixed 1.234567 format there are no alphabetical characters that need to be in uppercase. But that's wrong for infinities and NaNs, which

[committed] libstdc++: Regenerate Makefile.in

2023-08-17 Thread Jonathan Wakely via Gcc-patches
This target in include/Makefile.am was supposed to ensure that nobody building gcc would need autogen to regenerate the bits/version.h header, but it didn't make it in to include/Makefile.in. Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/Makefile.in:

[committed] libstdc++: Disable PCH for tests that rely on include order

2023-08-17 Thread Jonathan Wakely via Gcc-patches
Now that no_pch works, I can use it to fix this test that was failing with PCH enabled and run with -std=gnu++23. Tested x86_64-linux. Pushed to trunk. -- >8 -- These tests expect to be able to #undef a feature test macro and then include to get it redefined. But if has already been included

[committed] libstdc++: Fix testsuite no_pch directive

2023-08-17 Thread Jonathan Wakely via Gcc-patches
A new test I added was failing with -std=gnu++23 because that flag was removed from the test options (but only after checking if it met the c++20 effective target). Tested x86_64-linux. Pushed to trunk. -- >8 -- The { dg-add-options no_pch } directive is supposed to add a macro definition that

Re: [PATCH] libstdc++: fix memory clobbering in std::vector [PR110879]

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On 09/08/23 01:34 +0300, Vladimir Palevich wrote: Because of the recent change in _M_realloc_insert and _M_default_append, call to deallocate was ordered after assignment to class members of std::vector (in the guard destructor), which is causing said members to be call-clobbered. This is

Re: [PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 22:56, Jonathan Wakely wrote: > > On Wed, 16 Aug 2023 at 22:39, David Edelsohn wrote: > > > > Hi, Arsen > > > > This patch broke bootstrap because it has introduced a new GCC build > > requirement for autogen that is not

Re: [PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 22:39, David Edelsohn wrote: > > Hi, Arsen > > This patch broke bootstrap because it has introduced a new GCC build > requirement for autogen that is not a previous requirement to build GCC. > Previously the repository has included post-processed files. The repo does

[committed] libstdc++: Fix std::basic_string::resize_and_overwrite

2023-08-16 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. This should be backported to gcc-12 and gcc-13 too (without the std::format test changes). -- >8 -- The callable used for resize_and_overwrite was being passed the string's expanded capacity, which might be greater than the new size being requested. This is

[committed] libstdc++: Update __cplusplus value for C++23 in version.def

2023-08-16 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/bits/version.def (stds): Update value for C++23. * include/bits/version.h: Regenerate. --- libstdc++-v3/include/bits/version.def | 2 +- libstdc++-v3/include/bits/version.h | 72

Re: [PATCH] libstdc++: fix memory clobbering in std::vector [PR110879]

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On 09/08/23 01:34 +0300, Vladimir Palevich wrote: Because of the recent change in _M_realloc_insert and _M_default_append, call to deallocate was ordered after assignment to class members of std::vector (in the guard destructor), which is causing said members to be call-clobbered. This is

Re: [PATCH 1/2] libstdc++: Convert _RangeAdaptorClosure into a CRTP class [PR108827]

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 17:06, Patrick Palka via Libstdc++ wrote: > > On Sun, Apr 16, 2023 at 11:24 PM Patrick Palka wrote: > > > > On Fri, 14 Apr 2023, Patrick Palka wrote: > > > > > Using the CRTP idiom for this base class avoids bloating the size of a > > > pipeline when adding distinct empty

Re: [PATCH] libstdc++: Make __max_size_type and __max_diff_type structural

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 17:07, Patrick Palka via Libstdc++ wrote: > > On Mon, Apr 24, 2023 at 12:23 PM Patrick Palka wrote: > > > > This patch makes these integer-class type structural types by changing > > their private data members into public ones, which allows them to be > > used as NTTP

Re: [PATCH] libstdc++: Implement P2770R0 changes to join_view / join_with_view

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Wed, 16 Aug 2023 at 17:05, Patrick Palka via Libstdc++ wrote: > > On Mon, Apr 17, 2023 at 9:39 AM Patrick Palka wrote: > > > > This C++23 paper fixes a bug in these views when adapting a certain kind > > of non-forward range, and we treat it as a DR against C++20. > > > > Tested on

[committed] libstdc++: Fix comment naming upstream PSTL test file

2023-08-16 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk. -- >8 -- These tests were derived from set.pass.cpp not set.pass.cc, specifically pstl/test/std/algorithms/alg.sorting/alg.set.operations/set.pass.cpp in the LLVM repo. libstdc++-v3/ChangeLog: * testsuite/25_algorithms/pstl/alg_sorting/set_difference.cc: Fix

Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Fri, 21 Jul 2023 at 22:23, Paul M. Bendixen via Libstdc++ wrote: > > P1642 includes the header cstdarg to the freestanding implementation. > This was probably left out by accident, this patch puts it in. > Since this is one of the headers that go in whole cloth, there should be no > further

Re: [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Sun, 13 Aug 2023 at 21:16, Arsen Arsenović via Libstdc++ wrote: > > libstdc++-v3/ChangeLog: > > * libsupc++/typeinfo: Switch to bits/version.h for > __cpp_lib_constexpr_typeinfo. > * libsupc++/new: Switch to bits/version.h for >

Re: [PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-16 Thread Jonathan Wakely via Gcc-patches
On Sun, 13 Aug 2023 at 21:15, Arsen Arsenović via Libstdc++ wrote: > > This commit replaces the ad-hoc logic in with an AutoGen > database that (mostly) declaratively generates a version.h bit which > combines all of the FTM logic across all headers together. > > This generated header defines

Re: [PATCH] Fix for bug libstdc++/110860

2023-08-14 Thread Jonathan Wakely via Gcc-patches
On Mon, 14 Aug 2023 at 10:58, Paul Dreik via Libstdc++ < libstd...@gcc.gnu.org> wrote: > The patch below fixes an issue with the fix already committed for > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110860 which unfortunately > was not sufficient for small magnitude floating point values. > >

Re: [PATCH] x86: Update model values for Raptorlake.

2023-08-14 Thread Jonathan Wakely via Gcc-patches
On 14/08/23 15:19 +0100, Jonathan Wakely wrote: On 14/08/23 04:37 +, Pan Li via Gcc-patches wrote: Committed as obvious, and backported to GCC13. Did you try building it on gcc-13? case 0x97: case 0x9a: case 0xbf: /* Alder Lake. */ case 0xb7: case 0xba: case 0xbf

Re: [PATCH] x86: Update model values for Raptorlake.

2023-08-14 Thread Jonathan Wakely via Gcc-patches
On 14/08/23 04:37 +, Pan Li via Gcc-patches wrote: Committed as obvious, and backported to GCC13. Did you try building it on gcc-13? case 0x97: case 0x9a: case 0xbf: /* Alder Lake. */ case 0xb7: case 0xba: case 0xbf: /* Raptor Lake. */ This fails:

[committed] libstdc++: Fix std::format_to_n return value [PR110990]

2023-08-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 also needed. -- >8 -- When writing to a contiguous iterator, std::format_to_n(out, n, ...) always returns out + n, even if it wrote fewer than n characters to the iterator. The problem is in the _M_finish() member function of the

[committed] libstdc++: Implement C++20 std::chrono::parse [PR104167]

2023-08-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. This is a pure addition that only affects C++20 mode, so I'm considering backporting it to gcc-13 at some point (once any dust has settled from landing it on trunk). -- >8 -- This adds the missing C++20 features to . I've implemented my proposed

[committed] libstdc++: Do not call log10(0.0) in std::format [PR110860]

2023-08-11 Thread Jonathan Wakely via Gcc-patches
Second attempt to fix this PR. Tested x86_64-linux, pushed to trunk. -- >8 -- Calling log10(0.0) returns -inf which has undefined behaviour when converted to an integer. We only need to use log10 for large values anyway. If the value is zero then the larger buffer is only needed due to a large

[committed] libstdc++: Handle invalid values in std::chrono pretty printers

2023-08-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, Pushed to trunk. I'll backport this to gcc-13 too. -- >8 -- This avoids an IndexError exception when printing invalid chrono::month or chrono::weekday values. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdChronoCalendarPrinter): Check for

[committed] libstdc++: Revert accidentally committed change to bits/stl_iterator.h

2023-08-11 Thread Jonathan Wakely via Gcc-patches
As promised yesterday, this reverts the part of the change I didn't mean to commit. Tested x86_64-linux. Pushed to trunk. -- >8 -- In commit r14-3134-g9cb2a7c8d54b1f I only meant to change some uses of __clamp_iter_cat to use __iter_category_t, I didn't mean to commit the additional change

Re: [PATCH] sso-string@gnu-versioned-namespace [PR83077]

2023-08-11 Thread Jonathan Wakely via Gcc-patches
On Fri, 11 Aug 2023, 06:44 François Dumont via Libstdc++, < libstd...@gcc.gnu.org> wrote: > I hadn't tested the most basic default configuration and it is failing, I did wonder about that when you said which configurations you had tested :) > I need some more time yet. > OK, no problem. I

Re: [committed] libstdc++: Use alias template for iterator_category [PR110970]

2023-08-10 Thread Jonathan Wakely via Gcc-patches
On Thu, 10 Aug 2023 at 23:34, Jonathan Wakely via Libstdc++ < libstd...@gcc.gnu.org> wrote: > Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. > > -- >8 -- > > This renames __iterator_category_t to __iter_category_t, for consistency >

[committed] libstdc++: Fix out-of-bounds read in format string "{:{}." [PR110974]

2023-08-10 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/110974 * include/std/format (_Spec::_S_parse_width_or_precision): Check for empty range before dereferencing iterator. *

[committed] libstdc++: Use alias template for iterator_category [PR110970]

2023-08-10 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. -- >8 -- This renames __iterator_category_t to __iter_category_t, for consistency with std::iter_value_t, std::iter_difference_t and std::iter_reference_t in C++20. Then use __iter_category_t in , which fixes the problem of the

[committed] libstdc++: Fix std::format for localized floats [PR110968]

2023-08-10 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 to follow. -- >8 -- The __formatter_fp::_M_localize function just returns an empty string if the formatting locale is the C locale, as there is nothing to do. But the caller was assuming that the returned string contains the localized

[committed] libstdc++: Suppress clang -Wc99-extensions warnings in

2023-08-09 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- This prevents Clang from warning about the use of the non-standard __complex__ keyword. libstdc++-v3/ChangeLog: * include/std/complex: Add diagnostic pragma for clang. --- libstdc++-v3/include/std/complex | 9 + 1 file changed, 9

[committed] libstdc++: Fix constexpr functions to conform to older standards

2023-08-09 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- Some constexpr functions were inadvertently relying on relaxed constexpr rules from later standards. libstdc++-v3/ChangeLog: * include/bits/chrono.h (duration_cast): Do not use braces around statements for C++11 constexpr rules.

[committed] libstdc++: Fix a -Wsign-compare warning in std::list

2023-08-09 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/bits/list.tcc (list::sort(Cmp)): Fix -Wsign-compare warning for loop condition. --- libstdc++-v3/include/bits/list.tcc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[committed] libstdc++: Fix some -Wmismatched-tags warnings

2023-08-09 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/bits/shared_ptr_atomic.h (atomic): Change class-head to struct. * include/bits/stl_tree.h (_Rb_tree_merge_helper): Change class-head to struct in friend declaration. *

[committed] libstdc++: Explicitly default some copy ctors and assignments

2023-08-09 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk. -- >8 -- The standard says that the implicit copy assignment operator is deprecated for classes that have a user-provided copy constructor, and vice versa. libstdc++-v3/ChangeLog: * include/bits/new_allocator.h (__new_allocator): Define copy

<    3   4   5   6   7   8   9   10   11   12   >