Re: [PATCH 1/2] libstdc++: Atomic wait/notify ABI stabilization

2023-12-11 Thread Jonathan Wakely
CCing Tom's current address, as he's not @redhat.com now. On Mon, 11 Dec 2023, 19:24 Nate Eldredge, wrote: > On Mon, 11 Dec 2023, Nate Eldredge wrote: > > > To fix, we need something like `__args._M_old = __val;` inside the loop > in > > __atomic_wait_address(), so that we always wait on the

Re: [PATCH v5] libstdc++: Remove UB from month and weekday additions and subtractions.

2023-12-10 Thread Jonathan Wakely
On Sat, 25 Nov 2023 at 13:52, Cassio Neri wrote: > > The following invoke signed integer overflow (UB) [1]: > > month + months{MAX} // where MAX is the maximum value of months::rep > month + months{MIN} // where MIN is the maximum value of months::rep > month - months{MIN} // where MIN

[committed] libstdc++: Fix value of __cpp_lib_format macro [PR111826]

2023-12-09 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. I'll check, but I think should be backported to gcc-13 too. -- >8 -- As noted in the PR, we support both features required for the 202110L value, so we should define it with that value. libstdc++-v3/ChangeLog: PR libstdc++/111826 *

[committed] libstdc++: Fix resolution of LWG 4016 for std::ranges::to [PR112876]

2023-12-09 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- What I implemented in r14-6199-g45630fbcf7875b does not match what I proposed for LWG 4016, and it imposes additional, unwanted requirements on the emplace and insert member functions of the container being populated. libstdc++-v3/ChangeLog:

[committed] libstdc++: Fix misleading typedef name in

2023-12-07 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- This local typedef for uintptr_t was accidentally named uint64_t, probably from a careless code completion shortcut. We don't need the typedef at all since it's only used once. Just use __UINTPTR_TYPE__ directly instead. libstdc++-v3/ChangeLog:

[committed] libstdc++: Use instead of in

2023-12-07 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. I'll backport this too. -- >8 -- In r14-5922-g6c8f2d3a08bc01 I added to , so that uintptr_t is declared if that header is compiled as a header unit. I used because that's what already includes, so it seemed simpler to be consistent. However, this means

[committed] libstdc++: Fix recent changes to __glibcxx_assert [PR112882]

2023-12-07 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- The changes in r14-6198-g5e8a30d8b8f4d7 were broken, as I used _GLIBCXX17_CONSTEXPR for the 'if _GLIBCXX17_CONSTEXPR (true)' condition, forgetting that it would also be used for the is_constant_evaluated() check. Using 'if constexpr

Re: [PATCH] Reimplement __gnu_cxx::__ops operators

2023-12-07 Thread Jonathan Wakely
On Thu, 7 Dec 2023 at 13:41, Jonathan Wakely wrote: > > On Wed, 6 Dec 2023 at 20:55, François Dumont wrote: > > > > I think I still got no feedback about this cleanup proposal. > > Can you remind me why we have all those different functions in > predefined_ops.h

Re: [PATCH] Reimplement __gnu_cxx::__ops operators

2023-12-07 Thread Jonathan Wakely
On Wed, 6 Dec 2023 at 20:55, François Dumont wrote: > > I think I still got no feedback about this cleanup proposal. Can you remind me why we have all those different functions in predefined_ops.h in the first place? I think it was to avoid having two versions of every algorithm, one that does

Re: [PATCH] libsupc++: try cxa_thread_atexit_impl at runtime

2023-12-06 Thread Jonathan Wakely
On Wed, 6 Dec 2023 at 13:53, Jonathan Wakely wrote: > > On Wed, 6 Dec 2023 at 12:30, Thomas Schwinge wrote: > > > > Hi Alexandre! > > > > On 2023-12-06T02:28:42-0300, Alexandre Oliva wrote: > > > libsupc++: try cxa_thread_atexit_impl at runtime > > &

[PATCH] libstdc++: Make __gnu_debug::vector usable in constant expressions [PR109536]

2023-12-06 Thread Jonathan Wakely
Any comments on this approach? -- >8 -- This makes constexpr std::vector (mostly) work in Debug Mode. All safe iterator instrumentation and checking is disabled during constant evaluation, because it requires mutex locks and calls to non-inline functions defined in libstdc++.so. It should be OK

Re: [PATCH] libsupc++: try cxa_thread_atexit_impl at runtime

2023-12-06 Thread Jonathan Wakely
On Wed, 6 Dec 2023 at 12:30, Thomas Schwinge wrote: > > Hi Alexandre! > > On 2023-12-06T02:28:42-0300, Alexandre Oliva wrote: > > libsupc++: try cxa_thread_atexit_impl at runtime > > > > g++.dg/tls/thread_local-order2.C fails when the toolchain is built for > > a platform that lacks

Re: [PATCH RFA (libstdc++)] c++: partial ordering of object parameter [PR53499]

2023-12-06 Thread Jonathan Wakely
On Wed, 6 Dec 2023 at 02:21, Jason Merrill wrote: > > Tested x86_64-pc-linux-gnu. Are the library test changes OK? Sure, they seem fine. > A reduced > example of the issue is at https://godbolt.org/z/cPxrcnKjG > > -- 8< -- > > Looks like we implemented option 1 (skip the object parameter) for

Re: [PATCH] libstdc++: implement std::generator

2023-12-05 Thread Jonathan Wakely
On Sat, 18 Nov 2023 at 19:50, Arsen Arsenović wrote: > > libstdc++-v3/ChangeLog: > > * include/Makefile.am: Install std/generator, bits/elements_of.h > as freestanding. > * include/Makefile.in: Regenerate. > * include/bits/version.def: Add __cpp_lib_generator. >

Re: [PATCH] libstdc++: Add workaround to std::ranges::subrange [PR111948]

2023-12-05 Thread Jonathan Wakely
On Thu, 30 Nov 2023 at 15:52, Jonathan Wakely wrote: > > I think I'll push this to work around the compiler bug. We can revert it > later if the front end gets fixed. > > Tested x86_64-linux. Needed on trunk and gcc-13. Pushed to trunk now. > > -- >8 -- &g

Re: [PATCH] libstdc++: Implement LGW 4016 for std::ranges::to

2023-12-05 Thread Jonathan Wakely
On Thu, 30 Nov 2023 at 15:53, Jonathan Wakely wrote: > > Before pushing I'll fix the summary to say "LWG" instead of "LGW" (the > airport code for London Gatwick!) Pushed to trunk now. > > On Thu, 30 Nov 2023 at 15:51, Jonathan Wakely wrote: > > > &g

[committed] libstdc++: Redefine __glibcxx_assert to work in C++23 constexpr

2023-12-05 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Might be worth backporting too, but it can wait. -- >8 -- The changes in r14-5979 to support unknown references in constant expressions caused some test regressions. The way that __glibcxx_assert is defined for constant evaluation no longer works when

Re: [PATCH RFC] c++: mangle function template constraints

2023-12-05 Thread Jonathan Wakely
On Wed, 22 Nov 2023 at 14:50, Jonathan Wakely wrote: > > On Mon, 20 Nov 2023 at 02:56, Jason Merrill wrote: > > > > Tested x86_64-pc-linux-gnu. Are the library bits OK? Any comments before I > > push this? > > The library parts are OK. > > The variable templa

[committed] libstdc++: Disable std::formatter::set_debug_format [PR112832]

2023-12-05 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Will backport to gcc-13 too. -- >8 -- All set_debug_format member functions should be guarded by the __cpp_lib_formatting_ranges macro (which is not defined yet). libstdc++-v3/ChangeLog: PR libstdc++/112832 * include/std/format

Re: [PATCH] libstdc++: Add test for LWG Issue 3897

2023-12-05 Thread Jonathan Wakely
On Tue, 5 Dec 2023 at 15:57, Will Hawkins wrote: > > On Tue, Dec 5, 2023 at 10:46 AM Jonathan Wakely wrote: > > > > On Mon, 4 Dec 2023 at 16:42, Will Hawkins wrote: > > > > > > Hello! > > > > > > Thank you, as always, for the great work that y

Re: [PATCH] libstdc++: Add test for LWG Issue 3897

2023-12-05 Thread Jonathan Wakely
testsuite/20_util/smartptr.adapt/inout_ptr/2.cc: Add check for LWG Issue 3897. Co-authored-by: Jonathan Wakely diff --git a/libstdc++-v3/testsuite/20_util/smartptr.adapt/inout_ptr/2.cc b/libstdc++-v3/testsuite/20_util/smartptr.adapt/inout_ptr/2.cc index ca6076209c2..

Re: [PATCH] libstdc++: Simplify ranges::to closure objects

2023-12-04 Thread Jonathan Wakely
On Thu, 30 Nov 2023 at 19:23, Patrick Palka wrote: > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? OK, thanks for simplifying it. > > -- >8 -- > > Use the existing _Partial range adaptor closure object in the > definition of ranges::to instead of essentially open coding it. > >

Re: [PATCH] driver: Fix memory leak.

2023-12-04 Thread Jonathan Wakely
On Sat, 2 Dec 2023 at 21:24, Costas Argyris wrote: > > Use std::vector instead of malloc'd pointer > to get automatic freeing of memory. You can't include there. Instead you need to define INCLUDE_VECTOR before "system.h" Shouldn't you be using resize, not reserve? Otherwise mdswitches[i] is

Re: [PATCH] libstdc++: Implement LGW 4016 for std::ranges::to

2023-11-30 Thread Jonathan Wakely
Before pushing I'll fix the summary to say "LWG" instead of "LGW" (the airport code for London Gatwick!) On Thu, 30 Nov 2023 at 15:51, Jonathan Wakely wrote: > > This hasn't been finally approved by LWG yet, but everybody seems to be > in favour of it. I think I'

[PATCH] libstdc++: Add workaround to std::ranges::subrange [PR111948]

2023-11-30 Thread Jonathan Wakely
I think I'll push this to work around the compiler bug. We can revert it later if the front end gets fixed. Tested x86_64-linux. Needed on trunk and gcc-13. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/111948 * include/bits/ranges_util.h (subrange): Add constructor to

[PATCH] libstdc++: Implement LGW 4016 for std::ranges::to

2023-11-30 Thread Jonathan Wakely
This hasn't been finally approved by LWG yet, but everybody seems to be in favour of it. I think I'll push this soon. Tested x86_64-linux. -- >8 -- This implements the proposed resolution of LWG 4016, so that std::ranges::to does not use std::back_inserter and std::inserter. Instead it inserts

Re: [committed v2] libstdc++: Define std::ranges::to for C++23 (P1206R7) [PR111055]

2023-11-30 Thread Jonathan Wakely
On Wed, 29 Nov 2023 at 16:28, Patrick Palka wrote: > > On Thu, 23 Nov 2023, Jonathan Wakely wrote: > > > Here's the finished version of the std::ranges::to patch, which I've > > pushed to trunk. > > > > Tested x86_64-linux. > > > > -- >8 -- > >

[committed] libstdc++: Fix std::ranges::to errors

2023-11-30 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- Fix some errors that Patrick noticed, and remove a #if 0 group that I didn't mean to leave in the file. libstdc++-v3/ChangeLog: * include/std/ranges (__detail::__toable): Fix incorrect use of _Range instead of _Cont.

[committed] libstdc++: Include in

2023-11-28 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Backports to follow. -- >8 -- This is needed in order to compile it as a header-unit, which might be desired because it's included by both and . libstdc++-v3/ChangeLog: * include/bits/atomic_wait.h: Include . ---

[committed] libstdc++: Fix typo in comment

2023-11-28 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/bits/stl_uninitialized.h: Fix typo in comment. --- libstdc++-v3/include/bits/stl_uninitialized.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: libstdc++: Speed up push_back

2023-11-24 Thread Jonathan Wakely
On Fri, 24 Nov 2023 at 20:07, Jan Hubicka wrote: > The vector.tcc change was regtested on x86_64-linux, OK? > > libstdc++-v3/ChangeLog: > > * include/bits/vector.tcc (reserve): Copy _M_start and _M_finish > to local variables to allow propagation across call to >

[committed v2] libstdc++: Define std::ranges::to for C++23 (P1206R7) [PR111055]

2023-11-23 Thread Jonathan Wakely
Here's the finished version of the std::ranges::to patch, which I've pushed to trunk. Tested x86_64-linux. -- >8 -- This adds the std::ranges::to functions for C++23. The rest of P1206R7 is not yet implemented, i.e. the new constructors taking the std::from_range tag, and the new insert_range,

[committed] libstdc++: Fix access error in __gnu_test::uneq_allocator

2023-11-23 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- The operator== function is only a friend of the LHS argument, so cannot access the private member of the RHS argument. Use the public accessor instead. libstdc++-v3/ChangeLog: * testsuite/util/testsuite_allocator.h (uneq_allocator): Fix

Re: libstdc++: Turn memmove to memcpy in vector reallocations

2023-11-23 Thread Jonathan Wakely
On Tue, 21 Nov 2023 at 18:11, Marc Glisse wrote: > > On Tue, 21 Nov 2023, Jonathan Wakely wrote: > > > CC Marc Glisse who added the relocation support. He might recall why > > we use memmove when all uses are for newly-allocated storage, which > > cannot overlap the

Re: libstdc++: Speed up push_back

2023-11-23 Thread Jonathan Wakely
On Thu, 23 Nov 2023 at 15:44, Jan Hubicka wrote: > > Hi, > so if I understand it right, it should be safe to simply replace memmove > by memcpy. I wonder if we can get rid of the count != 0 check at least > for glibc systems. I don't think we can do that. It's still undefined with glibc, and

Re: libstdc++: Speed up push_back

2023-11-23 Thread Jonathan Wakely
On Thu, 23 Nov 2023 at 15:34, Jan Hubicka wrote: > > > > On Sunday, 19 November 2023 22:53:37 CET Jan Hubicka wrote: > > > > Sadly it is really hard to work out this > > > > from IPA passes, since we basically care whether the iterator points to > > > > the same place as the end pointer, which

[PATCH] c++: Make g++.dg/opt/pr110879.C require C++11 [PR110879]

2023-11-23 Thread Jonathan Wakely
Jakub noted in the PR that this test fails for -std=c++98. Tested x86_64-linux. OK for trunk? -- >8 -- The _M_realloc_insert member does not have the trivial relocation optimization for C++98, which seems to be why the _M_end_of_storage member does not get optimized away. Make this test

Re: [PATCH RFC] c++: mangle function template constraints

2023-11-22 Thread Jonathan Wakely
On Wed, 22 Nov 2023 at 14:50, Jonathan Wakely wrote: > > On Mon, 20 Nov 2023 at 02:56, Jason Merrill wrote: > > > > Tested x86_64-pc-linux-gnu. Are the library bits OK? Any comments before I > > push this? > > The library parts are OK. > > The variable templa

Re: [PATCH RFC] c++: mangle function template constraints

2023-11-22 Thread Jonathan Wakely
On Mon, 20 Nov 2023 at 02:56, Jason Merrill wrote: > > Tested x86_64-pc-linux-gnu. Are the library bits OK? Any comments before I > push this? The library parts are OK. The variable template is_trivially_copyable_v just uses __is_trivially_copyable so should be just as efficient, and the

Re: libstdc++: Turn memmove to memcpy in vector reallocations

2023-11-21 Thread Jonathan Wakely
On Tue, 21 Nov 2023 at 16:24, Jan Hubicka wrote: > > Hi, > this patch turns memmove to memcpy where we can and also avoids extra > guard checking if block is non-empty. This does not show as performance > improvement in my push_back micro-benchmark because vector rellocation > does not happen

[committed] libstdc++: Do not declare strtok for C++26 freestanding (P2937R0)

2023-11-21 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- This was recently approved for C++26. We should define the __cpp_lib_freestanding_cstring macro in as well as , but we do not currently install our own for most targets. libstdc++-v3/ChangeLog: * include/bits/version.def

[committed] libstdc++: Add freestanding feature test macros (P2407R5)

2023-11-21 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- This C++26 change makes several classes "partially freestanding", but we already fully supported them in freestanding mode. All we need to do is define the new feature test macros and add tests for them. libstdc++-v3/ChangeLog: *

[committed] libstdc++: Add std::span::at for C++26 (P2821R5)

2023-11-21 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- Also define the new feature test macros from P2833R2, indicating that std::span and std::expected are supported for freestanding mode. libstdc++-v3/ChangeLog: * include/bits/version.def (freestanding_expected): New macro. (span):

[committed] libstdc++: Fix std::tr2::dynamic_bitset support for alternate characters

2023-11-21 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Backports to follow. -- >8 -- libstdc++-v3/ChangeLog: * include/tr2/dynamic_bitset (dynamic_bitset): Pass zero and one characters to _M_copy_from_string. * testsuite/tr2/dynamic_bitset/string.cc: New test. ---

Re: libstdc++: Speed up push_back

2023-11-21 Thread Jonathan Wakely
On Tue, 21 Nov 2023 at 12:50, Jan Hubicka wrote: > > > > + // RAII type to destroy initialized elements. > > > > There's only one initialized element, not "elements". > > > > > + struct _Guard_elts > > > + { > > > + pointer _M_first, _M_last; // Elements

Re: [committed] libstdc++: Fix aligned formatting of stacktrace_entry and thread::id [PR112564]

2023-11-20 Thread Jonathan Wakely
On Mon, 20 Nov 2023 at 16:18, Hans-Peter Nilsson wrote: > > > From: Jonathan Wakely > > Date: Mon, 20 Nov 2023 11:55:22 + > > > The changelog entry does say "Change compile test to run." > > Wow, it's right there. The doh:est of doh:s on me. Sor

Re: libstdc++: Speed up push_back

2023-11-20 Thread Jonathan Wakely
On Mon, 20 Nov 2023 at 15:44, Jan Hubicka wrote: > > > > + // RAII type to destroy initialized elements. > > > > There's only one initialized element, not "elements". > > > > > + struct _Guard_elts > > > + { > > > + pointer _M_first, _M_last; // Elements

Re: [pushed] wwwdocs: *: Remove unused buildstat pages

2023-11-20 Thread Jonathan Wakely
ly basis on > the http://www.w3.org/1999/xlink; > xlink:href="http://gcc.gnu.org/ml/gcc-testresults/current;>gcc-testresults Good point. I'll push the attached patch to the docs. commit fd7a339512b60545700124b21700fb86a6527f76 Author: Jonathan Wakely Date: Mon Nov 20 12:4

[wwwdocs] Add new libstdc++ features

2023-11-20 Thread Jonathan Wakely
Pushed to wwwdocs. --- htdocs/gcc-14/changes.html | 7 +++ 1 file changed, 7 insertions(+) diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html index e5d3970c..7278f753 100644 --- a/htdocs/gcc-14/changes.html +++ b/htdocs/gcc-14/changes.html @@ -138,12 +138,16 @@ a

Re: libstdc++: Speed up push_back

2023-11-20 Thread Jonathan Wakely
On Sun, 19 Nov 2023 at 21:53, Jan Hubicka wrote: > > Hi, > this patch speeds up the push_back at -O3 significantly by making the > reallocation to be inlined by default. _M_realloc_insert is general > insertion that takes iterator pointing to location where the value > should be inserted. As

Re: [committed] libstdc++: Fix aligned formatting of stacktrace_entry and thread::id [PR112564]

2023-11-20 Thread Jonathan Wakely
On Mon, 20 Nov 2023 at 02:13, Hans-Peter Nilsson wrote: > > > From: Jonathan Wakely > > Date: Thu, 16 Nov 2023 17:20:09 + > > > PR libstdc++/112564 > > * include/std/stacktrace (formatter::format): Format according > > to format-

[committed] libstdc++: Check string value_type in std::make_format_args [PR112607]

2023-11-18 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Backport to gcc-13 needed too. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/112607 * include/std/format (basic_format_arg::_S_to_arg_type): Check value_type for basic_string_view and basic_string specializations. *

[committed v2] libstdc++: Add fast path for std::format("{}", x) [PR110801]

2023-11-18 Thread Jonathan Wakely
Here's an improved version of this patch, which I've pushed to trunk. Testeed x86_64-linux. -- >8 -- This optimizes the simple case of formatting a single string, integer or bool, with no format-specifier (so no padding, alignment, alternate form etc.) libstdc++-v3/ChangeLog: PR

Re: [PATCH] LoongArch: Add libstdc++ check-abi support.

2023-11-18 Thread Jonathan Wakely
Hi, Libstdc++ patches need to be CC'd to the gcc-patches list as well. On Wed, 8 Nov 2023 at 10:26, Peng Fan wrote: > > libstdc++-v3: > > * configure.host: Add abi_baseline_pair for LoongArch. > * config/abi/post/riscv64-linux-gnu: New directory. > *

Re: [committed] libstdc++: Define C++26 saturation arithmetic functions (P0543R3)

2023-11-17 Thread Jonathan Wakely
On Fri, 17 Nov 2023 at 15:32, Jonathan Wakely wrote: > > Tested x86_64-linux. Pushed to trunk. > > GCC generates better code for add_sat if we use: > > unsigned z = x + y; > z |= -(z < x); > return z; > > If the compiler can't be improved we s

Re: [committed] libstdc++: Define C++26 saturation arithmetic functions (P0543R3)

2023-11-17 Thread Jonathan Wakely
On Fri, 17 Nov 2023 at 17:01, Daniel Krügler wrote: > > Am Fr., 17. Nov. 2023 um 16:32 Uhr schrieb Jonathan Wakely > : > > > > Tested x86_64-linux. Pushed to trunk. > > > > GCC generates better code for add_sat if we use: > > > > unsign

[PATCH 2/2] libstdc++: Ensure valid UTF-8 in std::vprint_unicode

2023-11-17 Thread Jonathan Wakely
This is a naive implementation of the UTF-8 validation algorithm, which could definitely be optimized. But it's faster than using std::codecvt_utf8 and checking the result of that, which is the only existing code we have to do it in the library. As the TODO suggests, we could do the UTF-8 to

[PATCH 1/2] libstdc++: Implement C++23 header [PR107760]

2023-11-17 Thread Jonathan Wakely
There's a TODO here about checking for invalid UTF-8, which is done by the next patch. I don't know if the Windows code actually works. I tried to test it with mingw and Wine, but I got garbled text. But I'm not sure if that's my code here, or the conversion to UTF-16, or how I'm testing, or just

[PATCH] libstdc++: Add fast path for std::format("{}", x) [PR110801]

2023-11-17 Thread Jonathan Wakely
I'll probably push this before stage 1 closes. I might move the new lambda out to a struct at namespace scope first though. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/110801 * include/std/format (_Sink_iter::_M_get_pointer) (_Sink_iter::_M_end_pointer): New functions

[PATCH] libstdc++: Define std::ranges::to for C++23 (P1206R7) [PR111055]

2023-11-17 Thread Jonathan Wakely
This needs tests, and doesn't include the changes to the standard containers to add insert_range etc. (but they work with ranges::to anyway, using the existing member functions). I plan to write the tests and push this tomorrow. I've trimmed the boring bits of the version.h changes, that are

[committed] libstdc++: Regenerate config.h.in

2023-11-17 Thread Jonathan Wakely
Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * config.h.in: Regenerate. --- libstdc++-v3/config.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index c0aa51af3f0..17da7bb9867 100644 ---

[committed] libstdc++: Define C++26 saturation arithmetic functions (P0543R3)

2023-11-17 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. GCC generates better code for add_sat if we use: unsigned z = x + y; z |= -(z < x); return z; If the compiler can't be improved we should consider using that instead of __builtin_add_overflow. -- >8 -- This was approved for C++26 last week at the WG21

[committed] libstdc++: Adjust std::in_range template parameter name

2023-11-17 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- This is more consistent with the specification in the standard. libstdc++-v3/ChangeLog: * include/std/utility (in_range): Rename _Up parameter to _Res. --- libstdc++-v3/include/std/utility | 14 +++--- 1 file changed, 7

[committed] libstdc++: Add more Doxygen comments and another test for std::out_ptr

2023-11-17 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- Improve Doxygen comments for std::out_ptr etc. and add a test for the feature test macro. Also remove a redundant preprocessor condition. Ideally the docs for std::out_ptr and std::inout_ptr would show examples of how to use them and what they do,

[committed] libstdc++: Fix Doxygen markup

2023-11-17 Thread Jonathan Wakely
Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/bits/chrono_io.h: Fix Doxygen markup. --- libstdc++-v3/include/bits/chrono_io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h

Re: [PATCH] libstdc++: Remove UB from operator+ of months and weekdays.

2023-11-17 Thread Jonathan Wakely
On Fri, 17 Nov 2023 at 01:34, Cassio Neri wrote: > > The following functions invoke signed integer overflow (UB) for some extreme > values of days and months [1]: > > weekday operator+(const weekday& x, const days& y); // #1 > month operator+(const month& x, const months& y); // #2 > > For

Re: [committed] libstdc++: Implement std::out_ptr and std::inout_ptr for C++23 [PR111667]

2023-11-17 Thread Jonathan Wakely
On Fri, 17 Nov 2023 at 04:44, Hans-Peter Nilsson wrote: > > > From: Jonathan Wakely > > Date: Thu, 16 Nov 2023 08:12:39 + > > > PR libstdc++/111667 > > * include/Makefile.am: Add new header. > > * include/Makefile.in: Regenerate. > >

Re: [PATCH 1/2] libstdc++: Atomic wait/notify ABI stabilization

2023-11-16 Thread Jonathan Wakely
On Thu, 16 Nov 2023 at 13:49, Jonathan Wakely wrote: > > From: Thomas Rodgers > > These two patches were written by Tom earlier this year, before he left > Red Hat. We should finish reviewing them for GCC 14 (and probably squash > them into one?) > > Tom, you mentioned f

[committed] libstdc++: Fix aligned formatting of stacktrace_entry and thread::id [PR112564]

2023-11-16 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- The formatter for std::thread::id should default to right-align, and the formatter for std::stacktrace_entry should not just ignore the fill-and-align and width from the format-spec! libstdc++-v3/ChangeLog: PR libstdc++/112564 *

[PATCH 1/2] libstdc++: Atomic wait/notify ABI stabilization

2023-11-16 Thread Jonathan Wakely
From: Thomas Rodgers These two patches were written by Tom earlier this year, before he left Red Hat. We should finish reviewing them for GCC 14 (and probably squash them into one?) Tom, you mentioned further work that changes the __platform_wait_t* to uintptr_t, is that ready, or likely to be

[PATCH 2/2] libstdc++: Pass __wait_args to internal API by const pointer

2023-11-16 Thread Jonathan Wakely
From: Thomas Rodgers Tested x86_64-linux, testing underway on powerpc-aix and sparc-solaris. -- >8 -- This change splits the __wait_args data members to a new struct __wait_args_base and then passes that type by const pointer to the low level implementation functions. libstdc++-v3/ChangeLog:

[committed] libstdc++: Implement std::out_ptr and std::inout_ptr for C++23 [PR111667]

2023-11-16 Thread Jonathan Wakely
Tested x86_64-linux. Pushe to trunk. -- >8 -- This implements that changes from P1132R8, including optimized paths for std::shared_ptr and std::unique_ptr. For std::shared_ptr we pre-allocate a new control block in the std::out_ptr_t constructor so that the destructor is non-throwing. This

[committed 1/2] libstdc++: Test for feature test macros more accurately

2023-11-16 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- Tests which check for feature test macros should use the no_pch option, so that we're really testing for the definition being in the intended header, and not just testing that it's present in (which includes all the standard headers and so defines

[committed 2/2] libstdc++: Only declare feature test macros in standard headers

2023-11-16 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- This change moves the definitions of feature test macros (or strictly speaking, the requests for to define them) so that only standard headers define them. For example, will no longer define macros related to std::shared_ptr, only and will

[committed 2/2] libstdc++: Use 202100L as feature test check for C++23

2023-11-16 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- I noticed that our C++23 features were not being defined when using Clang 16 with -std=c++2b, because it only defines __cplusplus=202101L but uses 202302L since my r14-3252-g0c316669b092fb change. This changes to use 202100 instead of the final

[committed 1/2] libstdc++: Adjust feature test in and

2023-11-16 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- We don't need any library concepts to define the constraints for rvalue stream overloads, only compiler support. So change the test from using __cpp_lib_concepts to __cpp_concepts >= 201907L. libstdc++-v3/ChangeLog: * include/std/istream

[committed] libstdc++: Fix std::deque::operator[] Xmethod [PR112491]

2023-11-15 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Backports to follow. -- >8 -- The Xmethod for std::deque::operator[] has the same bug that I recently fixed for the std::deque::size() Xmethod. The first node might have unused capacity at the start, which needs to be accounted for when indexing into the

[committed] libstdc++: std::stacktrace tweaks

2023-11-15 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Backports to follow. The new hash.cc test was failing for armv8l-unknown-linux-gnueabihf according to Linaro CI. This should fix it (but there are still other failures for std::stacktrace, so I opened PR 112541). -- >8 -- Fix a typo in a string literal and

Re: [PATCH] libstdc++: Improve operator-(weekday x, weekday y).

2023-11-14 Thread Jonathan Wakely
On Tue, 14 Nov 2023 at 00:27, Cassio Neri wrote: > > The current implementation calls __detail::__modulo which is relatively > expensive. > > A better implementation is possible if we assume that x.ok() && y.ok() == > true, > so that n = x.c_encoding() - y.c_encoding() is in [-6, 6]. In this

Re: [PATCH] Fix UB in weekday::weekday(sys_days) and add test.

2023-11-14 Thread Jonathan Wakely
On Sun, 12 Nov 2023 at 01:34, Cassio Neri wrote: > > The following has undefined behaviour (signed overflow) [1]: > weekday max{sys_days{days{numeric_limits::max()}}}; > > The issue is in this line when __n is very large and __n + 4 overflows: > return weekday(__n >= -4 ? (__n + 4) % 7 :

Re: [PATCH v3] libstdc++: Simplify year::is_leap().

2023-11-14 Thread Jonathan Wakely
On Sat, 11 Nov 2023 at 23:00, Cassio Neri wrote: > > The current implementation returns > (_M_y & (__is_multiple_of_100 ? 15 : 3)) == 0; > where __is_multiple_of_100 is calculated using an obfuscated algorithm which > saves one ror instruction when compared to _M_y % 100 == 0 [1]. > > In leap

Re: [PATCH v4] libstdc++: Remove unnecessary "& 1" from year_month_day_last::day().

2023-11-14 Thread Jonathan Wakely
On Sat, 11 Nov 2023 at 16:46, Cassio Neri wrote: > > When year_month_day_last::day() was implemented, Dr. Matthias Kretz realised > that the operation "& 1" wasn't necessary but we did not patch it at that > time. This patch removes the unnecessary operation. > > libstdc++-v3/ChangeLog: > >

[committed] libstdc++: Fix uses of signed types with functions

2023-11-14 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Backports needed too. -- >8 -- In we pass the int __base parameter to our internal versions of functions, __bit_width and __countr_zero. Those functions are only defined for unsigned types, so we need to convert the base to unsigned. The base must be in

[committed] libstdc++: Fix std::hash [PR112348]

2023-11-14 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Backports needed too. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/112348 * include/std/stacktrace (hash>): Fix type of hash functio nfor entries. * testsuite/19_diagnostics/stacktrace/hash.cc: New test. ---

[committed] libstdc++: Fix std::deque::size() Xmethod [PR112491]

2023-11-14 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. Backports to follow. -- >8 -- The Xmethod for std::deque::size() assumed that the first element would be at the start of the first node. That's only true if elements are only added at the back. If an element is inserted at the front, or removed from the

[committed] libstdc++: Add dg-timeout-factor to remaining IO tests

2023-11-13 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- I meant to add these changes as part of r14-4959-g7d06b29f814580 but missed these files out. libstdc++-v3/ChangeLog: * testsuite/std/time/clock/file/io.cc: Double timeout using dg-timeout-factor. *

[committed] libstdc++: Micro-optimization for std::optional [PR112480]

2023-11-13 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- This small change removes a branch when clearing a std::optional for types with no-op destructors. For types where the destructor can be optimized away (e.g. because it's trivial, or empty and can be inlined) the _M_destroy() function does nothing

[PATCH] c++: Link extended FP conversion pedwarns to -Wnarrowing [PR111842]

2023-11-13 Thread Jonathan Wakely
Tested x86_64-linux. Does this make sense for trunk? These forbidden conversions are defined as narrowing conversions, and we already use -Wnarrowing to control other "ill-formed, but only warn by default" diagnostics required by the standard. -- >8 -- Several users have been confused by the

Re: [committed] libstdc++: Reformat Python code

2023-11-13 Thread Jonathan Wakely
On Mon, 13 Nov 2023 at 14:41, Romain GEISSLER wrote: > > > Le 28 sept. 2023 à 22:21, Jonathan Wakely a écrit : > > > > Tested x86_64-linux (GDB 13.2, Python 3.11). Pushed to trunk. > > > > -- >8 -- > > > > Some of these changes were suggest

[committed] libstdc++: Do not use assume attribute for Clang [PR112467]

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux (-m32 and -m64). Pushed to trunk. -- >8 -- Clang has an 'assume' attribute, but it's a function attribute not a statement attribute. The recently-added use of the statement form causes an error with Clang. libstdc++-v3/ChangeLog: PR libstdc++/112467 *

[committed] libstdc++: Simplify std::string_view comparisons (LWG 3950)

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- LWG 3950 points out that the comparisons of std::basic_string_view can be simplified to just a single overload of operator== and a single overload of operator<=>. Those overloads work fine for homogeneous comparisons of two string view objects.

[committed] libstdc++: Add static_assert to std::integer_sequence [PR112473]

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- C++20 allows class types as non-type template parameters, but std::integer_sequence explicitly disallows them. Enforce that. libstdc++-v3/ChangeLog: PR libstdc++/112473 * include/bits/utility.h (integer_sequence): Add

[committed] libstdc++: Fix broken tests for

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- When I added these tests I gave them .h file extensions, so they've never been run. They need to use the no_pch option, so that they only test the header and don't get via . libstdc++-v3/ChangeLog: *

[committed] libstdc++: Deprecate std::atomic_xxx overloads for std::shared_ptr

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- These overloads are deprecated in C++20 (and likely to be removed for C++26). The std::atomic> specialization should be preferred in new code. libstdc++-v3/ChangeLog: * include/bits/shared_ptr_atomic.h (atomic_is_lock_free)

[committed] libstdc++: Fix test that fails with -ffreestanding

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- The -ffreestanding option disables Debug Mode, forcibly #undef'ing _GLIBCXX_DEBUG. This means that the dangling checks in std::pair are disabled for -ffreestanding in C++17 and earlier, because they depend on _GLIBCXX_DEBUG. Adjust the target

[committed] libstdc++: Add [[nodiscard]] to std::span members

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- All std::span member functions are pure functions that have no side effects. They are only useful for their return value, so they should all warn if that value is not used. libstdc++-v3/ChangeLog: * include/std/span (span, as_bytes,

[committed] libstdc++: Add [[nodiscard]] to lock types

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- Adding this attribute means users get a warning when they accidentally create a temporary lock instead of creating an automatic variable with block scope. For std::lock_guard both constructors have side effects (they both take a mutex and so both

[committed] libstdc++: Remove handling for underscore-prefixed libm functions [PR111638]

2023-11-10 Thread Jonathan Wakely
Tested x86_64-linux. Pushed to trunk. -- >8 -- The checks in linkage.m4 try to support math functions prefixed with underscores, like _acosf and _isinf. However, that doesn't work because they're renamed to the standard names using a macro, but then undefines that macro again. This simply

Re: [Ping][PATCH] libstdc++: Add missing functions to [PR79700]

2023-11-10 Thread Jonathan Wakely
the patch to trunk - thanks for the work on it! On Wed, 17 May 2023 at 11:07, Jonathan Wakely wrote: > > > > On Wed, 17 May 2023 at 10:38, Nathaniel Shead > wrote: >> >> On Wed, May 17, 2023 at 10:05:59AM +0100, Jonathan Wakely wrote: >> > On Wed, 17 May

Re: [PATCH 1/2] libstdc++: declare std::allocator in !HOSTED as an extension

2023-11-09 Thread Jonathan Wakely
On Thu, 9 Nov 2023 at 19:32, Arsen Arsenović wrote: > > This allows us to add features to freestanding which allow specifying > non-default allocators (generators, collections, ...) without having to > modify them. > > libstdc++-v3/ChangeLog: > > * include/bits/memoryfwd.h: Remove HOSTED

<    1   2   3   4   5   6   7   8   9   10   >