Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Jonathan Wakely via Gcc-patches
On Thu, 31 Mar 2022 at 17:03, Marc Glisse via Libstdc++ wrote: > > On Thu, 31 Mar 2022, Matthias Kretz via Gcc-patches wrote: > > > I like it. But I'd like it even more if we could have > > > > #elif defined _UBSAN > >__ubsan_invoke_ub("reached std::unreachable()"); > > > > But to my knowledge

[committed] libstdc++: Fix filenames in Doxygen @file comments

2022-04-01 Thread Jonathan Wakely via Gcc-patches
From: Timm Bäder Pushed to trunk. -- >8 -- Reviewed-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/fs_ops.h: Fix filename in Doxygen comment. * include/experimental/bits/fs_ops.h: Likewise. --- libstdc++-v3/include/bits/fs_ops.h | 2 +- libstdc++-v3/

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-04-01 Thread Jonathan Wakely via Gcc-patches
On Thu, 31 Mar 2022 at 19:21, Marc Glisse wrote: > > On Thu, 31 Mar 2022, Jonathan Wakely wrote: > > > On Thu, 31 Mar 2022 at 17:03, Marc Glisse via Libstdc++ > > wrote: > >> > >> On Thu, 31 Mar 2022, Matthias Kretz via Gcc-patches wrote: > >> > >>> I like it. But I'd like it even more if we could

[committed] libstdc++: Fix mismatched noexcept-specifiers in Filesystem TS

2022-04-01 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. -- >8 -- The copy_file fix should have been part of r12-7063-gda72e0fd20f87b. The path::begin() fix should have been part of r12-3930-gf2b7f56a15d9cb. Thanks to Timm Bäder for reporting this one. libstdc++-v3/ChangeLog: * include/experimental/

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-04-01 Thread Jonathan Wakely via Gcc-patches
On Fri, 1 Apr 2022 at 12:56, Matthias Kretz wrote: > > On Friday, 1 April 2022 13:33:42 CEST Jonathan Wakely wrote: > > Matthias didn't like my Princess Bride easter egg :-) > > Would the attached be better? > > LGTM. OK, thanks to everybody who commented. I've pushed that to trunk now.

Re: [PATCH] libstdc++: Tweak source_location for clang trunk [PR105128]

2022-04-02 Thread Jonathan Wakely via Gcc-patches
On Sat, 2 Apr 2022, 10:32 Jakub Jelinek via Libstdc++, < libstd...@gcc.gnu.org> wrote: > Hi! > > Apparently clang trunk implemented __builtin_source_location(), but the > using __builtin_ret_type = decltype(__builtin_source_location()); > which has been added for it isn't enough, they also need th

Re: [PATCH] libstdc++: Add pretty printer for std::span

2022-04-04 Thread Jonathan Wakely via Gcc-patches
On Mon, 4 Apr 2022 at 11:54, Philipp Fent via Libstdc++ wrote: > > This improves the debug output for C++20 spans. > Before: > {static extent = 18446744073709551615, _M_ptr = 0x7fffb9a8, > _M_extent = {_M_extent_value = 2}} > Now with StdSpanPrinter: > std::span of length 2 = {1, 2} Nice, tha

Re: [PATCH] libstdc++-v3 expected: Don't test ABI-variant properties in requirements.cc

2022-04-05 Thread Jonathan Wakely via Gcc-patches
On Tue, 5 Apr 2022, 17:44 Hans-Peter Nilsson via Libstdc++, < libstd...@gcc.gnu.org> wrote: > Ok to commit? > -- 8< -- > > Without this, for a target where alignment and structure-sizes are by > default byte-aligned, such as cris-elf, you'll see, in libstdc++.log: > > /X/gc

Re: [PATCH] libstdc++-v3 expected: Don't test ABI-variant properties in requirements.cc

2022-04-06 Thread Jonathan Wakely via Gcc-patches
Thanks! On Wed, 6 Apr 2022, 15:42 Hans-Peter Nilsson, wrote: > > From: Jonathan Wakely > > Date: Tue, 5 Apr 2022 20:47:58 +0200 > > > On Tue, 5 Apr 2022, 17:44 Hans-Peter Nilsson via > > Libstdc++, > > mailto:libstdc%2b...@gcc.gnu.org>> > > wrote: > > Ok to commit? > > -- 8< ---

[committed 1/3] libstdc++: Fix std::bad_expected_access constructor [PR105146]

2022-04-08 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/105146 * include/std/expected (bad_expected_access): Move constructor parameter. * testsuite/20_util/expected/bad.cc: New test. --- libstdc++-v3/include/std/expected

[committed 2/3] libstdc++: Fix std::expected::swap(expected&) [PR105154]

2022-04-08 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/105154 * include/std/expected (expected::swap): Set _M_has_value to false for objects that previously had a value. * testsuite/20_util/expected/swap.cc: Fix test to check void

[committed 3/3] libstdc++: Fix constraints on std::expected constructor [PR105153]

2022-04-08 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/105153 * include/std/expected (expected::expected(expected&&)): Fix constraints. * testsuite/20_util/expected/cons.cc: Check constructor. --- libstdc++-v3/include/std/expected

[committed] libstdc++: Move Filesystem TS path definitions out of class body

2022-04-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- This fixes some errors with clang caused by instantiating vector<_Cmpt> before the _Cmpt type is complete. libstdc++-v3/ChangeLog: * include/experimental/bits/fs_path.h (path): Define special members after path::_Cmpt is complete. -

[committed] libstdc++: Move stacktrace tests to 19_diagnostics directory

2022-04-11 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk. -- >8 -- This matches where the feature is defined in the current draft. libstdc++-v3/ChangeLog: * testsuite/20_util/stacktrace/entry.cc: Moved to... * testsuite/19_diagnostics/stacktrace/entry.cc: ...here. * testsuite/20_util/stacktrace/synopsis.cc: Mov

[committed] libstdc++: Improve behaviour of std::stacktrace::current

2022-04-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- This prevents inlining the current() function to guarantee that it is present in the stacktrace, then tells libbacktrace to skip that frame. To avoid overflow in the int argument to __glibcxx_backtrace_simple, we need to check if the skip parameter

[committed] libstdc++: Fix std::basic_stacktrace special members [PR105031]

2022-04-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- The PR points out that there is a non-constant condition used for an if-constexpr statement, but there are several other problems with the copy, move and swap members of std::basic_stacktrace. libstdc++-v3/ChangeLog: PR libstdc++/105031

Re: [committed] libstdc++: Improve behaviour of std::stacktrace::current

2022-04-11 Thread Jonathan Wakely via Gcc-patches
On Mon, 11 Apr 2022 at 18:03, Jonathan Wakely via Libstdc++ wrote: > // Precondition: _M_frames == nullptr > pointer > _M_allocate(allocator_type& __alloc, size_type __n) noexcept > { > __try > { > - _M_frames = __n ? __alloc.alloca

[committed 1/5] libstdc++: Reduce memory usage in std::stacktrace::current

2022-04-12 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64-linux, pushed to trunk. -- >8 -- This adds an alternative callback for use in the overload of basic_stacktrace::current that takes a max_depth parameter. The new callback will not allow the container to grow past the initial capacity, which is set to the specified maximum depth.

[committed 2/5] libstdc++: Use nothrow new in std::stacktrace

2022-04-12 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64-linux, pushed to trunk. -- >8 -- We can avoid the overhead of handling a bad_alloc exception from std::allocator::allocate by just calling the nothrow operator new instead. libstdc++-v3/ChangeLog: * include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate):

[committed 3/5] libstdc++: Use allocator to construct std::stacktrace_entry objects

2022-04-12 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64-linux, pushed to trunk. -- >8 -- Because std::basic_stacktrace is an allocator-aware container its elements should be initialized using allocator_traits::construct and destroyed using allocator_traits::destroy. This adds new _M_clone and _M_assign helper functions to construct e

[committed 4/5] libstdc++: shrink-to-fit in std::basic_stacktrace::current(skip, max)

2022-04-12 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64-linux, pushed to trunk. -- >8 -- If a large stacktrace is reduced to a max depth that is less than half the capacity it will now be reallocated to remove the unused capacity. libstdc++-v3/ChangeLog: * include/std/stacktrace (basic_stacktrace::current): Reallocate

[committed 5/5] libstdc++: Prefer to use mmap instead of malloc in libbacktrace

2022-04-12 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64-linux, pushed to trunk. -- >8 -- As reported in PR libbacktrace/105240, libbacktrace leaks memory when using malloc for allocations. I originally thought it would be simpler to just use malloc unconditionally (because it's supported on all targets) but the leaks make that problem

[PATCH] libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602]

2022-04-13 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, without libiconv installed, with libiconv installed, with libiconv installed but using an in-tree libiconv, with libiconv.a installed and using --with-libiconv-type=static, and with libiconv.so installed and using --without-libiconv-prefix (which still fails). I'm not entirely

[PATCH] libstdc++: Update incorrect statement about mainline in docs

2022-04-14 Thread Jonathan Wakely via Gcc-patches
This fixes some misleading text in the libstdc++ manual that says the docs for the gcc-11 branch refer to mainline. Richi, is this OK for the gcc-11 branch now? It's been wrong for 11.1 and 11.2, but it would still be nice to fix. -- >8 -- libstdc++-v3/ChangeLog: * doc/xml/manual/status

Re: [PATCH] libstdc++: Update incorrect statement about mainline in docs

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Apr 2022 at 11:36, Richard Biener wrote: > > On Thu, 14 Apr 2022, Jonathan Wakely wrote: > > > This fixes some misleading text in the libstdc++ manual that says the > > docs for the gcc-11 branch refer to mainline. > > > > Richi, is this OK for the gcc-11 branch now? It's been wrong for

[committed] libstdc++: Add new headers to PCH

2022-04-14 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/precompiled/stdc++.h: Include and for C++23. --- libstdc++-v3/include/precompiled/stdc++.h | 4 1 file changed, 4 insertions(+) diff --git a/libstdc++-v3/include/precompiled/stdc++.h b

[committed] libstdc++: Fix missing and incorrect feature test macros [PR105269]

2022-04-14 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: PR libstdc++/105269 * include/bits/stl_vector.h (__cpp_lib_constexpr_vector): Define. * include/c_compatibility/stdatomic.h (__cpp_lib_stdatomic_h): Define. * include/std/o

Re: [wwwdocs] Add Ada's changelog entry

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On 05/04/22 06:05 +, Arnaud Charlet wrote: Thank you for the feedback. Should I remove it and resuply the patch or can you/GCC maintainers do the modification before merging? Can you please resubmit it? I'll let others comment on the need to sign a contributor agreement, my understanding i

Re: [PATCH v1] libstdc++: Default to mutex-based atomics on RISC-V

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On 07/04/22 11:46 -0700, Palmer Dabbelt wrote: The RISC-V port requires libatomic to be linked in order to resolve various atomic functions, which results in builds that have "--with-libstdcxx-lock-policy=auto" defaulting to mutex-based locks. Changing this to direct atomics breaks the ABI, this

Re: [PATCH] libstdc++: Optimize integer std::from_chars

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Apr 2022 at 13:32, Patrick Palka via Libstdc++ wrote: > > This applies the following optimizations to the integer std::from_chars > implementation: > > 1. Use a lookup table for converting an alphanumeric digit to its > base-36 value instead of using a range test (for 0-9) and sw

Re: [PATCH v1] libstdc++: Default to mutex-based atomics on RISC-V

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Apr 2022 at 16:18, Palmer Dabbelt wrote: > > On Thu, 14 Apr 2022 08:08:17 PDT (-0700), jwak...@redhat.com wrote: > > On 07/04/22 11:46 -0700, Palmer Dabbelt wrote: > >>The RISC-V port requires libatomic to be linked in order to resolve > >>various atomic functions, which results in build

Re: [PATCH] libstdc++: Avoid double-deref of __first in ranges::minmax [PR104858]

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Apr 2022 at 16:21, Patrick Palka via Libstdc++ wrote: > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk and 11/10 > once the branch is unfrozen? > > PR libstdc++/104858 > > libstdc++-v3/ChangeLog: > > * include/bits/ranges_algo.h (__minmax_fn): Avoid derefer

Re: [PATCH] libstdc++: Add pretty printer for std::span

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On Mon, 4 Apr 2022 at 11:54, Philipp Fent via Libstdc++ wrote: > > This improves the debug output for C++20 spans. > Before: > {static extent = 18446744073709551615, _M_ptr = 0x7fffb9a8, > _M_extent = {_M_extent_value = 2}} > Now with StdSpanPrinter: > std::span of length 2 = {1, 2}

Re: [PATCH] libstdc++: Update incorrect statement about mainline in docs

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Apr 2022 at 11:55, Richard Biener wrote: > > On Thu, 14 Apr 2022, Jonathan Wakely wrote: > > > On Thu, 14 Apr 2022 at 11:36, Richard Biener wrote: > > > > > > On Thu, 14 Apr 2022, Jonathan Wakely wrote: > > > > > > > This fixes some misleading text in the libstdc++ manual that says the

[committed] libstdc++: Fix incorrect IS number in doc comment

2022-04-14 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * doc/xml/manual/intro.xml: Fix comment. --- libstdc++-v3/doc/xml/manual/intro.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml index 86ed6964b6a..548b632b6e4 1006

Re: [PATCH v1] libstdc++: Default to mutex-based atomics on RISC-V

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Apr 2022 at 16:24, Palmer Dabbelt wrote: > > On Thu, 14 Apr 2022 08:22:05 PDT (-0700), jwak...@redhat.com wrote: > > On Thu, 14 Apr 2022 at 16:18, Palmer Dabbelt wrote: > >> > >> On Thu, 14 Apr 2022 08:08:17 PDT (-0700), jwak...@redhat.com wrote: > >> > On 07/04/22 11:46 -0700, Palmer D

Re: [PATCH] libstdc++: Optimize std::has_single_bit

2022-04-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Apr 2022 at 19:17, Patrick Palka via Libstdc++ wrote: > > This reimplements std::has_single_bit using the well-known bit-twiddilng > trick[1], which is much faster than popcount on x86_64. Is that always true for all microarchitectures? We have https://gcc.gnu.org/PR97759 on this topic

Re: [PATCH] libstdc++: Micro-optimize __from_chars_pow2_base

2022-04-18 Thread Jonathan Wakely via Gcc-patches
On Mon, 18 Apr 2022, 15:39 Patrick Palka via Libstdc++, < libstd...@gcc.gnu.org> wrote: > At the first iteration of __from_chars_pow2_base's main loop, we need > to remember the value of the leading significant digit for sake of the > overflow check at the end of the function (for bases other than

Re: [PATCH] libstdc++: Add pretty printer for std::span

2022-04-19 Thread Jonathan Wakely via Gcc-patches
On Tue, 19 Apr 2022 at 10:34, Philipp Fent wrote: > > On 04.04.22 13:39, Jonathan Wakely wrote: > > Nice, thanks. I'll get this committed in time for GCC 12 (and backport > > it to release branches too). > > I've attached a rebased patch for trunk and tested it on x86_64-linux. > I also backported

Re: [PATCH] libstdc++: Update incorrect statement about mainline in docs

2022-04-19 Thread Jonathan Wakely via Gcc-patches
On Tue, 19 Apr 2022 at 08:01, Richard Biener wrote: > > On Thu, 14 Apr 2022, Jonathan Wakely wrote: > > > On Thu, 14 Apr 2022 at 11:55, Richard Biener wrote: > > > > > > On Thu, 14 Apr 2022, Jonathan Wakely wrote: > > > > > > > On Thu, 14 Apr 2022 at 11:36, Richard Biener wrote: > > > > > > > >

Re: [PATCH] libstdc++: Stop defining _GLIBCXX_ASSERTIONS in floating_to_chars.cc

2022-04-19 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Apr 2022 at 20:48, Patrick Palka via Libstdc++ wrote: > > Assertions were originally enabled in the compiled-in floating-point > std::to_chars implementation to help shake out any bugs, but they > apparently impose a significant performance penalty, in particular for > the hex formattin

[committed] libstdc++: Fix syntax error in libbacktrace configuration

2022-04-19 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- Using == instead of = causes a configuration error with dash as the shell: checking whether to build libbacktrace support... /home/devel/building/work/src/gcc-12-20220417/libstdc++-v3/configure: 77471: test: auto: unexpected operator /home/devel/b

Re: [PATCH] libstdc++: Add pretty printer for std::span

2022-04-19 Thread Jonathan Wakely via Gcc-patches
On Tue, 19 Apr 2022 at 12:33, Philipp Fent via Libstdc++ wrote: > > On 19.04.22 12:28, Jonathan Wakely wrote: > > Thanks, but we still need the DCO sign-off as I mailed about last week. > > Thanks for the clarification, your last mail didn't appear to have > content, so I might have missed that pa

[PATCH] libgo: Fix non-portable sed commands

2022-04-19 Thread Jonathan Wakely via Gcc-patches
This fixes the libgo build if /usr/bin/sed is found before /usr/xpg4/bin/sed on Solaris. Tested sparc-sun-solaris2.11, OK for trunk? -- >8 -- Solaris sed does not allow '^' and '$' anchors inside groups, and does not support the '+' meta-character. ChangeLog: * libgo/Makefile.am (check

[committed] libstdc++: Fix macro checked by test

2022-04-20 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. -- >8 -- The macro being tested here is wrong, but just happens to have the same value as the one supposed to be tests. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc: Check correct featur

Re: [PATCH] libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602]

2022-04-20 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk now. On Wed, 13 Apr 2022 at 15:24, Jonathan Wakely via Libstdc++ wrote: > > Tested x86_64-linux, without libiconv installed, with libiconv installed, > with libiconv installed but using an in-tree libiconv, with libiconv.a > installed and using --with-libiconv-type=static, and wit

Re: [PATCH] libstdc++: Work around modules ICE in [PR105297]

2022-04-21 Thread Jonathan Wakely via Gcc-patches
On Thu, 21 Apr 2022 at 04:38, Patrick Palka via Libstdc++ wrote: > > This makes the initializer for __table in __from_chars_alnum_to_val > dependent in an artificial way, which works around the modules testsuite > ICE reported in PR105297 by preventing the initializer from getting > evaluated at p

Re: [PATCH] libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602]

2022-04-21 Thread Jonathan Wakely via Gcc-patches
On Thu, 21 Apr 2022 at 11:14, Yubin Ruan wrote: > > Hi, > > Will this be in GCC12? Unless the patch gets reverted, yes. GCC 12 hasn't branched from trunk yet, so everything on trunk will be in GCC 12. > > -- > Yubin > > On Wed, Apr 20, 2022 at 8:58 PM Jonathan Wakely via Libstdc++ > wrote: > > >

[committed] libstdc++: Remove bogus assertion in std::from_chars [PR105324]

2022-04-21 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. Backport to gcc-11 to follow. -- >8 -- I'm not sure what I was thinking when I added this assertion, maybe it was supposed to be alignment == 1 (which is what the pmr::string actually uses). The simplest fix is to just remove the assertion. The assertion is

Re: [PATCH] libstdc++: Avoid ASCII assumptions in floating_from_chars.cc

2022-04-21 Thread Jonathan Wakely via Gcc-patches
On Thu, 21 Apr 2022 at 15:38, Patrick Palka via Libstdc++ wrote: > > In starts_with_ci and in __floating_from_chars_hex's inf/nan handling, > we were assuming that the letters are contiguous and that 'A' + 32 == 'a' > which is true for ASCII but not for other character encodings. This > patch fix

[committed] libstdc++: Improve comments describing --enable-fully-dynamic-string

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING): Improve comments. * configure: Regenerate. --- libstdc++-v3/acinclude.m4 | 17 +++-- libstdc++-v3/configure| 4 ++-- 2 files changed, 13 insertions(+), 8 delet

[committed] libstdc++: Update status tables in manual

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk. libstdc++-v3/ChangeLog: * doc/xml/manual/status_cxx2017.xml: Update C++17 status. * doc/xml/manual/status_cxx2020.xml: Use 12.1 instead of 12 for upcoming release. * doc/html/manual/status.html: Regenerate. --- libstdc++-v3/doc/html/manual/status

[committed 1/2] libstdc++: Fix deduction failure for std::min call [PR104080]

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. Reported upstream as https://github.com/fastfloat/fast_float/pull/122 libstdc++-v3/ChangeLog: PR libstdc++/104080 * src/c++17/fast_float/LOCAL_PATCHES: UPDATE. * src/c++17/fast_float/fast_float.h (round): Use explicit template

[committed 2/2] libstdc++: Use GCC's predefined macro for endianness [PR104080]

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. Instead of hardcoded preprocessor conditionals with explicit target checks, just rely on the fact that __BYTE_ORDER__ is always defined by GCC. libstdc++-v3/ChangeLog: PR libstdc++/104080 * src/c++17/fast_float/LOCAL_PATCHES: Update.

Re: [PATCH 1/1] Fixed fast_float build error in NEWLIB

2022-01-18 Thread Jonathan Wakely via Gcc-patches
On Tue, 18 Jan 2022 at 09:05, LiaoShihua wrote: > > When I built riscv-gcc with newlib, it will be terminated with message > "fatal error: endian.h: No such file or directory". > So, fixed it in fast_float.h. > > libstdc++-v3\ChangeLog: > N.B. you need to use a forward slash here, not backslash.

[committed] libstdc++: Fix ambiguous std::pair constructors [PR101124]

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. The deprecated non-standard std::pair constructors that allow constructing std::pair from an rvalue and a literal zero where not sufficiently constrained. They were viable when constructing std::pair, and that case should work fine using the standard con

[committed] libstdc++: Use __cpp_lib_concepts in std::reverse_iterator [PR104098]

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. We should not assume that std::iter_value_t etc. are defined unconditionally for C++20 mode. libstdc++-v3/ChangeLog: PR libstdc++/104098 * include/bits/stl_iterator.h (reverse_iterator): Check __cpp_lib_concepts instead of __cpl

[committed] libstdc++: Declare std::c8rtomb and std::mbrtoc8 if provided by the C library

2022-01-18 Thread Jonathan Wakely via Gcc-patches
From: Tom Honermann Tested powerpc64le-linux, pushed to trunk. This patch completes implementation of the C++20 proposal P0482R6 [1] by adding declarations of std::c8rtomb() and std::mbrtoc8() in if provided by the C library in . This patch addresses feedback provided in response to a previou

[committed] libstdc++: Define for C++23

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. This adds the C++23 header, as proposed by P0943R6, for compatibility with C code. There are still some ABI differences between atomic_xxx in C and C++ std::atomic_xxx in C++, so this only provides source compatibility, not binary compatibility. libst

[committed] libstdc++: Fix suggested alternative to std::ptr_fun

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. libstdc++-v3/ChangeLog: * include/bits/stl_function.h (ptr_fun): Fix suggestion for non-deprecated alternative. --- libstdc++-v3/include/bits/stl_function.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc

[committed] libstdc++: Limit new basic_string(nullptr_t) constructor to C++23 [PR104099]

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. The new deleted constructors added by P2166R1 are a breaking change, making previously valid code ill-formed in C++23. As a result, they should only be defined for C++23 and not for C++11 and up. libstdc++-v3/ChangeLog: PR libstdc++/104099

Re: [committed 2/2] libstdc++: Use GCC's predefined macro for endianness [PR104080]

2022-01-18 Thread Jonathan Wakely via Gcc-patches
On Tue, 18 Jan 2022 at 20:01, Patrick Palka wrote: > On Tue, 18 Jan 2022, Patrick Palka wrote: > > > On Tue, Jan 18, 2022 at 5:12 AM Jonathan Wakely > wrote: > > > > > > Tested x86_64-linux, pushed to trunk. > > > > > > > > > Instead of hardcoded preprocessor conditionals with explicit target >

Re: [PATCH] libstdc++: Clear padding bits in atomic compare_exchange

2022-01-18 Thread Jonathan Wakely via Gcc-patches
On Tue, 2 Nov 2021 at 01:26, Thomas Rodgers wrote: > This should address Jonathan's feedback and adds support for atomic_ref > >This change implements P0528 which requires that padding bits not >participate in atomic compare exchange operations. All arguments to the >generic template are 'sanit

[committed] libstdc++: Fix std::atomic> for AIX [PR104101]

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, powerpc-aix, pushed to trunk. This fixes a testsuite failure on AIX. The lock function currently just spins, which should be changed to use back-off, and maybe then _M_val.wait(__current) when supported. libstdc++-v3/ChangeLog: PR libstdc++/104101 * in

[committed] libstdc++: Remove unused std::pair helper function

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux. pushed to trunk. This function is no longer used since r12-6691 and can be removed. libstdc++-v3/ChangeLog: * include/bits/stl_pair.h (_PCC::_DeprConsPair): Remove unused function. --- libstdc++-v3/include/bits/stl_pair.h | 14 -- 1 file ch

[committed] libstdc++: Fix deprecated attribute for std::get_temporary_buffer

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. This was deprecated in C++17, not C++14. libstdc++-v3/ChangeLog: * include/bits/stl_tempbuf.h (get_temporary_buffer): Change _GLIBCXX14_DEPRECATED to _GLIBCXX17_DEPRECATED. --- libstdc++-v3/include/bits/stl_tempbuf.h | 2 +- 1 file cha

[committed] libstdc++: Update documentation for C++17 deprecations

2022-01-18 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk. libstdc++-v3/ChangeLog: * doc/xml/manual/evolution.xml: Document deprecations. * doc/xml/manual/status_cxx2017.xml: Update status. * doc/html/*: Regenerate. --- libstdc++-v3/doc/html/manual/api.html | 10 ++ libstdc++-v3/doc/html/manual/

Re: [PATCH] libstdc++: Fix for non-constexpr math_errhandling

2022-01-19 Thread Jonathan Wakely via Gcc-patches
On Wed, 19 Jan 2022 at 08:10, Matthias Kretz wrote: > Follow-up to my last patch. This one is a more thorough fix. Tested on > x86_64- > linux. OK for trunk? > > 8< > > Use SFINAE magic to support: "It is unspecified whether math_errhandling > is a macro or an identifier with external li

[committed] libstdc++: Fix libbacktrace build files

2022-01-19 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. This makes it possible to combine --enable-libstdcxx-debug with --enable-libstdcxx-backtrace, by adding a rule to src/Makefile to copy the backtrace-supported.h header into the src/debug/libbacktrace directory. Add libbacktrace path to testsuite flags so the

Re: [PATCH] libstdc++: Fix for non-constexpr math_errhandling

2022-01-19 Thread Jonathan Wakely via Gcc-patches
On Wed, 19 Jan 2022, 12:45 Matthias Kretz, wrote: > On Wednesday, 19 January 2022 13:07:26 CET Jonathan Wakely wrote: > > On Wed, 19 Jan 2022 at 08:10, Matthias Kretz wrote: > > > Follow-up to my last patch. This one is a more thorough fix. Tested on > > > x86_64- > > > linux. OK for trunk? > > >

Re: [PATCH] libstdc++: Fix for non-constexpr math_errhandling

2022-01-19 Thread Jonathan Wakely via Gcc-patches
On Wed, 19 Jan 2022 at 15:46, Matthias Kretz wrote: > > On Wednesday, 19 January 2022 16:21:15 CET Jonathan Wakely wrote: > > On Wed, 19 Jan 2022, 12:45 Matthias Kretz, wrote: > > > On Wednesday, 19 January 2022 13:07:26 CET Jonathan Wakely wrote: > > > > So is it a macro or not? > > > > > > I ag

Re: [PATCH] libstdc++: Fix for non-constexpr math_errhandling

2022-01-19 Thread Jonathan Wakely via Gcc-patches
On Wed, 19 Jan 2022 at 16:45, Jonathan Wakely wrote: > > On Wed, 19 Jan 2022 at 15:46, Matthias Kretz wrote: > > > > On Wednesday, 19 January 2022 16:21:15 CET Jonathan Wakely wrote: > > > On Wed, 19 Jan 2022, 12:45 Matthias Kretz, wrote: > > > > On Wednesday, 19 January 2022 13:07:26 CET Jonath

[committed] libstdc++: Include for size_t and ptrdiff_t [PR104123]

2022-01-19 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. libstdc++-v3/ChangeLog: PR libstdc++/104123 * testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: Include . --- .../testsuite/29_atomics/headers/stdatomic.h/c_compat.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)

[committed] libstdc++: Remove -gdwarf-4 from flags for debug library

2022-01-19 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. Worth backporting to gcc-11 too. The default is -gdwarf-5 now, so this is hurting rather than improving things. libstdc++-v3/ChangeLog: * configure.ac (GLIBCXX_ENABLE_DEBUG_FLAGS): Remove -gdwarf-4 from default flags. * configure: R

[PATCH] libstdc++: Simplify build targets for debug library

2022-01-19 Thread Jonathan Wakely via Gcc-patches
Posting for review now, but I will wait until stage 1 to push this. This rewrites the stamp-debug and build-debug targets in src/Makefile so that each generated Makefile in the debug/$(SUBDIRS) directories is a make target, instead of being created by a loop in the stamp-debug recipe. The final a

Re: [committed] libstdc++: Fix libbacktrace build files

2022-01-20 Thread Jonathan Wakely via Gcc-patches
On Wed, 19 Jan 2022 at 15:00, Jonathan Wakely wrote: > > Tested x86_64-linux, pushed to trunk. > > > This makes it possible to combine --enable-libstdcxx-debug with > --enable-libstdcxx-backtrace, by adding a rule to src/Makefile to copy > the backtrace-supported.h header into the src/debug/libback

[committed] libstdc++: Use Clang attribute instead of __constinit

2022-01-20 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. Clang doesn't support the __constinit extension that we use pre-C++20, but it does have its own equivalent attribute that can be used instead. This makes it a little easier to use Clang to build libstdc++ (which isn't supported. but is sometimes attempt

[committed] libstdc++: Fix constexpr constructor for atomic>

2022-01-21 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. libstdc++-v3/ChangeLog: * include/bits/shared_ptr_atomic.h (_Sp_atomic::_Atomic_count): Add constexpr. (_Sp_atomic::_M_ptr): Add default member-initializer. * testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:

[PATCH] libstdc++: Fix aliasing violation in std::shared_ptr

2022-01-21 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux. Does anybody see a problem with this change? The non-atomic store that sets both reference counts to zero uses a type-punned pointer, which has undefined behaviour. We could use memset to write 8 bytes, but we don't actually need it to be a single store anyway. No other

[committed] libstdc++: Fix condition for __cpp_lib_shared_ptr_arrays

2022-01-21 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. I changed the preprocessor condition from <= to < in r12-6574 which meant the macro was not defined by for C++17. libstdc++-v3/ChangeLog: * include/std/version (__cpp_lib_shared_ptr_arrays): Fix condition for C++17 definition. --- lib

[committed] libstdc++: Ensure all feature test macros have type long [PR87193]

2022-01-21 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. This defines all the __cpp_lib_xxx macros as type long, as required by the standard. We had an inconsistent mix of int and long, sometimes even for the same macro name. The __cpp_lib_experimental_xxx macros are left as type int, because that's what it s

[committed] libstdc++: Fix typo in comment

2022-01-21 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. libstdc++-v3/ChangeLog: * testsuite/20_util/shared_ptr/cons/array.cc: Fix comment. --- libstdc++-v3/testsuite/20_util/shared_ptr/cons/array.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/testsuite/20_util/sh

Re: [PATCH] libstdc++: detect mold linker.

2022-01-21 Thread Jonathan Wakely via Gcc-patches
On Fri, 21 Jan 2022 at 16:11, Martin Liška wrote: > > Hi. > > This adds linker detection for mold in libstdc++-v3. > > Ready to be installed? Yes, OK (but please CC the libstdc++ list, not just me). > Thanks, > Martin > > libstdc++-v3/ChangeLog: > > * acinclude.m4: Detect features for

[committed] libstdc++: Restore support for unordered_map [PR104174]

2022-01-23 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. I broke this unintentionally in r12-4259. libstdc++-v3/ChangeLog: PR libstdc++/104174 * include/bits/hashtable_policy.h (_Map_base): Add partial specialization for maps with const key types. * testsuite/23_containers/uno

[committed] libstdc++: Use fast_float for long double if it uses binary64 format

2022-01-23 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. We can use the new from_chars implementation when long double and double have the same representation. libstdc++-v3/ChangeLog: * src/c++17/floating_from_chars.cc (USE_STRTOD_FOR_FROM_CHARS): Define macro for case where std::from_chars i

[committed] libstdc++: Fix std::spanstream move assignment [PR104032]

2022-01-23 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. libstdc++-v3/ChangeLog: PR libstdc++/104032 * include/std/spanstream (basic_spanbuf(basic_spanbuf&&)): Use mem-initializer for _M_buf. (basic_spanbuf::Operator=(basic_spanbuf&&)): Fix ill-formed member access.

Re: [PATCH] libstdc++: Fix aliasing violation in std::shared_ptr

2022-01-23 Thread Jonathan Wakely via Gcc-patches
I thought I'd CC'd Maged on this patch, but apparently not. I've pushed it to trunk now. On Fri, 21 Jan 2022 at 13:50, Jonathan Wakely wrote: > > Tested powerpc64le-linux. Does anybody see a problem with this change? > > > The non-atomic store that sets both reference counts to zero uses a > type-

Re: [committed] libstdc++: Use fast_float for long double if it uses binary64 format

2022-01-24 Thread Jonathan Wakely via Gcc-patches
On Mon, 24 Jan 2022 at 17:42, Patrick Palka via Libstdc++ wrote: > > On Sun, Jan 23, 2022 at 5:53 PM Jonathan Wakely via Gcc-patches > wrote: > > > > Tested powerpc64le-linux, pushed to trunk. > > > > > > We can use the new from_chars implementation when l

[committed] libstdc++: Avoid symlink race in filesystem::remove_all [PR104161]

2022-01-25 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. Backports to follow. This adds a new internal flag to the filesystem::directory_iterator constructor that makes it fail if the path is a symlink that resolves to a directory. This prevents filesystem::remove_all from following a symlink to a directory, rather

[committed] libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR104217]

2022-01-25 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, pushed to trunk. For GNU/Linux G++ defines _GNU_SOURCE automatically, but not for Cygwin. This means secure_getenv is not declared by Cygwin's , even though autoconf detected it is present in the library. Define it in the source files that want to use secure_getenv. libstdc+

[committed] libstdc++: Avoid some more warnings [PR104019]

2022-01-25 Thread Jonathan Wakely via Gcc-patches
The change to istream.tcc looks large but is just adding { and } and re-indenting everything between them. Tested x86_64-linux, pushed to trunk. With -fno-exceptions we get a -Wmisleading-indentation warning for: if (cond) __try {} __catch (...) {} This is because the __catch(...) exp

Re: [committed] libstdc++: Avoid symlink race in filesystem::remove_all [PR104161]

2022-01-26 Thread Jonathan Wakely via Gcc-patches
On Wed, 26 Jan 2022 at 22:08, Dimitar Dimitrov wrote: > > On Tue, Jan 25, 2022 at 09:09:51PM +, Jonathan Wakely via Gcc-patches > wrote: > > Tested x86_64-linux, pushed to trunk. Backports to follow. > > > > > > This adds a new internal flag to t

Re: [PATCH] libstdc++: fix typo in acinclude.m4.

2022-01-27 Thread Jonathan Wakely via Gcc-patches
On Thu, 27 Jan 2022, 13:49 Martin Liška, wrote: > Hi. > > May I install an obvious typo that causes build error (described in the > PR). > > Ready to be installed? > I have the same patch ready to push, but I'm away from the computer. Please push. Thanks, > Martin > > PR libstdc++/104

Re: [committed] libstdc++: Avoid symlink race in filesystem::remove_all [PR104161]

2022-01-27 Thread Jonathan Wakely via Gcc-patches
On Wed, 26 Jan 2022, 22:12 Jonathan Wakely via Libstdc++, < libstd...@gcc.gnu.org> wrote: > On Wed, 26 Jan 2022 at 22:08, Dimitar Dimitrov wrote: > > > > On Tue, Jan 25, 2022 at 09:09:51PM +0000, Jonathan Wakely via > Gcc-patches wrote: > > > Tested x86_64-lin

Re: [PATCH] contrib: Put gcc-descr and gcc-undescr to file.

2022-01-27 Thread Jonathan Wakely via Gcc-patches
On Thu, 27 Jan 2022, 15:06 Martin Liška, wrote: > Hello. > > I've finished Martin's work and put the 2 aliases into files. The > git-undescr.sh is basically > unchanged, while I added better option parsing for git-descr.sh script so > that it supports: > > $ git gcc-descr > r12-6895-g14f339894db6

[committed] libstdc++: Avoid overflow in ranges::advance(i, n, bound)

2022-01-27 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. Should be backported too. When (bound - i) or n is the most negative value of its type, the negative of the value will overflow. Instead of abs(n) >= abs(bound - i) use n >= (bound - i) when positive and n <= (bound - i) when negative. The function has a

[committed] libstdc++: Prevent -Wstringop-overread warning in std::deque [PR100516]

2022-01-27 Thread Jonathan Wakely via Gcc-patches
Tested powerpc64le-linux, pushed to trunk. The compiler warns about the loop in deque::_M_range_initialize because it doesn't know that the number of nodes has already been correctly sized to match the size of the input. Use __builtin_unreachable to tell it that the loop will never be entered if

Re: [PATCH] enable -Winvalid-memory-order for C++ [PR99612]

2022-01-28 Thread Jonathan Wakely via Gcc-patches
On Fri, 28 Jan 2022 at 00:59, Martin Sebor wrote: > In practice, I'd expect most calls to atomic functions to be made > with constant memory models, and code like in the test case above > to be uncommon, so I think the choice of warning at -O0 was > the right one. Some of us consider it a misfeatu

Re: [PATCH][V2] Add mold detection for libs.

2022-01-28 Thread Jonathan Wakely via Gcc-patches
On Fri, 28 Jan 2022 at 18:17, Jeff Law wrote: > > > > On 1/24/2022 4:11 AM, Martin Liška wrote: > > On 1/21/22 17:54, Jonathan Wakely wrote: > >> Yes, OK (but please CC the libstdc++ list, not just me). > > > > Hello. > > > > Sorry for that. Anyway, I would like to install the extended version > >

Re: [PATCH] libstdc++ testsuite: Increase lwg3464.cc timeout factors to 20

2022-01-30 Thread Jonathan Wakely via Gcc-patches
On Sun, 30 Jan 2022, 01:37 Hans-Peter Nilsson via Libstdc++, < libstd...@gcc.gnu.org> wrote: > These tests have always been failing for my cris-elf > autotester running a simulator; they take about 20 minutes > each, compared to the timeout of 720 seconds, doubled > because they timed out in anoth

<    5   6   7   8   9   10   11   12   13   14   >