Re: [PATCH] Hashtable PR96088

2021-05-20 Thread Jonathan Wakely via Gcc-patches
On Fri, 21 May 2021, 07:31 François Dumont via Libstdc++, < libstd...@gcc.gnu.org> wrote: > On 20/05/21 6:44 pm, Jonathan Wakely wrote: > > On 06/05/21 22:03 +0200, François Dumont via Libstdc++ wrote: > >> Hi > >> > >> Considering your feedback on backtrace in debug mode is going to > >> take

Re: [PATCH] Hashtable PR96088

2021-05-20 Thread Jonathan Wakely via Gcc-patches
On Fri, 21 May 2021, 07:48 Jonathan Wakely, wrote: > > > On Fri, 21 May 2021, 07:31 François Dumont via Libstdc++, < > libstd...@gcc.gnu.org> wrote: > >> On 20/05/21 6:44 pm, Jonathan Wakely wrote: >> > On 06/05/21 22:03 +0200, François Dumont via Libstdc++ wrote: >> >> Hi >> >> >> >> Conside

Re: [PATCH] Hashtable PR96088

2021-05-24 Thread Jonathan Wakely via Gcc-patches
On 24/05/21 11:31 +0200, François Dumont wrote: On 20/05/21 6:44 pm, Jonathan Wakely wrote: On 06/05/21 22:03 +0200, François Dumont via Libstdc++ wrote: Hi     Considering your feedback on backtrace in debug mode is going to take me some time so here is another one.     Compared to latest

Re: [PATCH] Hashtable PR96088

2021-05-24 Thread Jonathan Wakely via Gcc-patches
On 22/05/21 18:35 +0200, François Dumont wrote: This was indeed the right approach.     The only minor drawback is that __is_noexcept_invocable<> combines noexcept qualification of the conversion and of the hash functor. So if the hash functor is not noexcept we could end up creating temporar

[committed] libstdc++: Qualify functions used in tests

2021-05-24 Thread Jonathan Wakely via Gcc-patches
These tests rely on ADL for some functions, probably unintentionally. The calls only work because the iterator wrappers derive from std::iterator and so namespace std is an associated namespace. libstdc++-v3/ChangeLog: * testsuite/25_algorithms/inplace_merge/constrained.cc: Qualify

Re: [PATCH] libstdc++: Fix iterator caching inside range adaptors [PR100479]

2021-05-24 Thread Jonathan Wakely via Gcc-patches
On 18/05/21 00:53 -0400, Patrick Palka via Libstdc++ wrote: On Mon, 17 May 2021, Tim Song wrote: On Mon, May 17, 2021 at 2:59 PM Patrick Palka wrote: > > + constexpr _CachedPosition& > + operator=(_CachedPosition&& __other) noexcept > + { > + if (std::__addressof(__ot

Re: [PATCH] c++tools: Include for exit [PR100731]

2021-05-25 Thread Jonathan Wakely via Gcc-patches
On 25/05/21 10:37 +0200, Jakub Jelinek wrote: Hi! This TU uses exit, but doesn't include or and relies on some other header to include it indirectly, which apparently doesn't happen on reporter's host. The other headers aren't guarded either and we rely on a compiler capable of C++11, so may

Re: [_GLIBCXX_DEBUG] Enhance rendering of assert message

2021-05-25 Thread Jonathan Wakely via Gcc-patches
On 22/05/21 22:08 +0200, François Dumont via Libstdc++ wrote: Here is the part of the libbacktrace patch with the enhancement to the rendering of assert message. It only contains one real fix, the rendering of address. In 2 places it was done with "0x%p", so resulting in something like: 0x0x01

Re: [_GLIBCXX_DEBUG] Enhance rendering of assert message

2021-05-25 Thread Jonathan Wakely via Gcc-patches
On 25/05/21 23:01 +0200, François Dumont wrote: On 25/05/21 11:58 am, Jonathan Wakely wrote: On 22/05/21 22:08 +0200, François Dumont via Libstdc++ wrote: Here is the part of the libbacktrace patch with the enhancement to the rendering of assert message. It only contains one real fix, the ren

Re: [PATCH] libstdc++: Avoid hard error in ranges::unique_copy [PR100770]

2021-05-26 Thread Jonathan Wakely via Gcc-patches
On Wed, 26 May 2021 at 18:00, Patrick Palka via Libstdc++ wrote: > > When input_iterator<_Out> isn't satisfied, we need to avoid substituting > into iter_value_t<_Out> because the latter isn't necessarily > well-formed in that case. To that end, this patch rewrites the > problematic condition in

[committed] libstdc++: Change [range.iter.op] functions to function objects [PR 100768]

2021-05-26 Thread Jonathan Wakely via Gcc-patches
The standard specifies std::ranges::distance etc as function templates, but it also requires them to not be found by ADL, and to suppress ADL when normal unqualified lookup does find them. That means they need to be function objects. libstdc++-v3/ChangeLog: PR libstdc++/100768 * i

Re: [PATCH] libstdc++: Avoid hard error in ranges::unique_copy [PR100770]

2021-05-26 Thread Jonathan Wakely via Gcc-patches
On Wed, 26 May 2021 at 20:11, Patrick Palka via Libstdc++ wrote: > > On Wed, 26 May 2021, Tim Song wrote: > > > I noticed that output_iterator_wrapper still has a (non-void) > > value_type. Perhaps we can get better coverage if it doesn't have one? > > The existing tests should have caught this ca

[committed] libstdc++: Fix installation of python hooks [PR 99453]

2021-06-01 Thread Jonathan Wakely via Gcc-patches
When no shared library is installed, the new code to determine the name of the -gdb.py file yields an empty string. Use the name of the static library in that case. libstdc++-v3/ChangeLog: PR libstdc++/99453 * python/Makefile.am: Use archive name for printer hook if no dyn

[committed] libstdc++: Fix return value of std::ranges::advance [PR 100833]

2021-06-01 Thread Jonathan Wakely via Gcc-patches
The three-argument form of ranges::advance is supposed to return the difference between the second argument and the distance the iterator was advanced. When a non-random-access iterator is not advanced (because it already equals the sentinel) we were returning 0 rather than n - 0. libstdc++-v3/Cha

Re: [PATCH] Hashtable PR96088

2021-06-01 Thread Jonathan Wakely via Gcc-patches
On 22/05/21 18:35 +0200, François Dumont wrote: diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc new file mode 100644 index 000..53bb754dab6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unor

Re: [PATCH] Hashtable PR96088

2021-06-01 Thread Jonathan Wakely via Gcc-patches
On 01/06/21 18:45 +0100, Jonathan Wakely wrote: On 22/05/21 18:35 +0200, François Dumont wrote: diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc new file mode 100644 index 000..53bb754dab6 --- /dev/nul

Re: [PATCH] PR libstdc++/89728 diagnose some missuses of [locale.convenience] functions

2021-06-01 Thread Jonathan Wakely via Gcc-patches
On 17/05/21 18:14 +0100, Jonathan Wakely wrote: On 12/05/21 17:16 +0100, Jonathan Wakely wrote: On 12/05/21 18:51 +0300, Antony Polukhin via Libstdc++ wrote: ср, 12 мая 2021 г. в 18:38, Antony Polukhin : ср, 12 мая 2021 г. в 17:44, Jonathan Wakely : On 12/05/21 12:58 +0300, Antony Polukhin

Re: [PATCH] Hashtable PR96088

2021-06-01 Thread Jonathan Wakely via Gcc-patches
On 01/06/21 18:47 +0100, Jonathan Wakely wrote: On 01/06/21 18:45 +0100, Jonathan Wakely wrote: On 22/05/21 18:35 +0200, François Dumont wrote: diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc new file mode 1

[committed] libstdc++: Improve punctuation in implementation status docs

2021-06-02 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * doc/xml/manual/status_cxxis29124.xml: Improve punctuation. * doc/xml/manual/status_cxxtr1.xml: Likewise. * doc/xml/manual/status_cxxtr24733.xml: Likewise. * doc/html/*: Regenerate. Committed to trunk. comm

Re: [PATCH] Hashtable PR96088

2021-06-02 Thread Jonathan Wakely via Gcc-patches
On 01/06/21 19:10 +0100, Jonathan Wakely wrote: On 01/06/21 18:47 +0100, Jonathan Wakely wrote: On 01/06/21 18:45 +0100, Jonathan Wakely wrote: On 22/05/21 18:35 +0200, François Dumont wrote: diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/96088.cc b/libstdc++-v3/testsuite/23_

[committed] libstdc++: Value-initialize objects held by EBO helpers [PR 100863]

2021-06-02 Thread Jonathan Wakely via Gcc-patches
The allocator, hash function and equality function should all be value-initialized by the default constructor of an unordered container. Do it in the EBO helper, so we don't have to get it right in multiple places. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: PR libstdc++/1008

Re: [PATCH] libstdc++: Avoid hard error in ranges::unique_copy [PR100770]

2021-06-03 Thread Jonathan Wakely via Gcc-patches
On 27/05/21 09:50 -0400, Patrick Palka via Libstdc++ wrote: On Wed, 26 May 2021, Tim Song wrote: On Wed, May 26, 2021 at 1:43 PM Patrick Palka wrote: > > On Wed, 26 May 2021, Tim Song wrote: > > > > On Wed, May 26, 2021 at 12:00 PM Patrick Palka via Libstdc++ > > wrote: > > > > > > - el

Re: [PATCH] libstdc++: Simplify range adaptors' forwarding of bound args when possible

2021-06-03 Thread Jonathan Wakely via Gcc-patches
On 14/05/21 14:27 -0400, Patrick Palka via Libstdc++ wrote: r11-8053 rewrote the range adaptor implementation in conformance with P2281, making partial application act like a SFINAE-friendly perfect forwarding call wrapper. Making SFINAE-friendliness coexist with perfect forwarding here requires

Re: [PATCH] Use _GLIBCXX_ASSERTIONS as _GLIBCXX_DEBUG light

2021-06-03 Thread Jonathan Wakely via Gcc-patches
On 27/05/21 19:37 +0200, François Dumont via Libstdc++ wrote: We have been talking for a long time of a debug mode with less impact on performances. We already have it, that's what _GLIBCXX_ASSERTIONS already is :-) I propose to simply use the existing _GLIBCXX_ASSERTIONS macro.     libstdc+

Re: [PATCH] wwwdocs: Do not rewrite the page titles

2021-06-03 Thread Jonathan Wakely via Gcc-patches
Ping. Is this OK now? On 18/04/21 23:45 +0100, Jonathan Wakely wrote: Remove GNU and FSF attribution from HTML page titles. I don't see why we should have to "comply with the GNU style" if we're truly an independent project run by the GCC developers and aided by the steering committee. OK f

Re: [PATCH] wwwdocs: Do not rewrite the page titles

2021-06-03 Thread Jonathan Wakely via Gcc-patches
On 03/06/21 16:50 +0100, Jonathan Wakely wrote: Ping. Is this OK now? On 18/04/21 23:45 +0100, Jonathan Wakely wrote: Remove GNU and FSF attribution from HTML page titles. I don't see why we should have to "comply with the GNU style" if we're truly an independent project run by the GCC deve

[committed] libstdc++: Add feature test macro for heterogeneous lookup in unordered containers

2021-06-04 Thread Jonathan Wakely via Gcc-patches
Also update the C++20 status docs. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * doc/xml/manual/status_cxx2020.xml: * doc/html/*: Regenerate. * include/bits/hashtable.h (__cpp_lib_generic_unordered_lookup): Define. * include/std/version (__cpp_

[committed] libstdc++: Fix value categories used by ranges access CPOs [PR 100824]

2021-06-04 Thread Jonathan Wakely via Gcc-patches
The implementation of P2091R0 was incomplete, so that some range access CPOs used perfect forwarding where they should not. This fixes it by consistently operating on lvalues. Some additional changes that are not necessary to fix the bug: Modify the __as_const helper to simplify its usage. Instea

Re: [committed] libstdc++: Optimize std::any_cast by replacing indirect call

2021-06-04 Thread Jonathan Wakely via Gcc-patches
Apparently my mailer decided to sent this email as From: Tim, rather than me. Sorry for any confusion. The patch is from Tim, but the email to the lists was sent by me (jwakely). Hopefully this one will have the right From: header on it! On 04/06/21 18:02 +0100, Tim Adye wrote: This significan

Re: [committed] libstdc++: Add feature test macro for heterogeneous lookup in unordered containers

2021-06-04 Thread Jonathan Wakely via Gcc-patches
On 04/06/21 16:01 +0100, Jonathan Wakely wrote: Also update the C++20 status docs. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * doc/xml/manual/status_cxx2020.xml: * doc/html/*: Regenerate. * include/bits/hashtable.h (__cpp_lib_generic_unordered_lookup):

Re: [PATCH] [libstdc++] Remove unused hasher instance.

2021-06-04 Thread Jonathan Wakely via Gcc-patches
On Fri, 4 Jun 2021 at 20:54, Thomas Rodgers wrote: > This is a remnant of poorly executed refactoring. > OK for trunk and gcc-11, thanks. > libstdc++-v3/ChangeLog: > > * include/std/barrier (__tree_barrier::_M_arrive): Remove > unnecessary hasher instantiation. > --- > libstdc

Re: [PATCH] PR libstdc++/98842: Fixed Constraints on operator<=>(optional, U)

2021-06-04 Thread Jonathan Wakely via Gcc-patches
On Thu, 3 Jun 2021 at 17:27, Seija K. via Libstdc++ wrote: > The original operator was underconstrained. _Up needs to fulfill > compare_three_way_result, > as mentioned in this bug report > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98842 > Thanks, I'll get the patch applied next week. > di

Re: [committed] libstdc++: Fix value categories used by ranges access CPOs [PR 100824]

2021-06-04 Thread Jonathan Wakely via Gcc-patches
On 04/06/21 18:03 +0100, Jonathan Wakely wrote: The implementation of P2091R0 was incomplete, so that some range access CPOs used perfect forwarding where they should not. This fixes it by consistently operating on lvalues. Some additional changes that are not necessary to fix the bug: Modify t

Re: [committed] libstdc++: Fix value categories used by ranges access CPOs [PR 100824]

2021-06-04 Thread Jonathan Wakely via Gcc-patches
On 04/06/21 21:44 +0100, Jonathan Wakely wrote: On 04/06/21 18:03 +0100, Jonathan Wakely wrote: The implementation of P2091R0 was incomplete, so that some range access CPOs used perfect forwarding where they should not. This fixes it by consistently operating on lvalues. Some additional changes

Re: [PATCH] PR libstdc++/100889: Fix wrong param type in atomic_ref<_Tp*>::wait

2021-06-04 Thread Jonathan Wakely via Gcc-patches
On Sat, 5 Jun 2021, 00:05 Thomas Rodgers, wrote: > Fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100889 > > libstdc++-v3/ChangeLog: > > * include/bits/atomic_base.h (atomic_ref<_Tp*>::wait): > Change parameter type from _Tp to _Tp*. > * testsuite/29_atomics/atomic_ref

Re: [committed] libstdc++: Fix value categories used by ranges access CPOs [PR 100824]

2021-06-05 Thread Jonathan Wakely via Gcc-patches
On 04/06/21 21:46 +0100, Jonathan Wakely wrote: On 04/06/21 21:44 +0100, Jonathan Wakely wrote: On 04/06/21 18:03 +0100, Jonathan Wakely wrote: The implementation of P2091R0 was incomplete, so that some range access CPOs used perfect forwarding where they should not. This fixes it by consistent

[wwwdocs] Document libstdc++ support for generic unordered lookup

2021-06-07 Thread Jonathan Wakely via Gcc-patches
This should have been in the GCC 11 release notes, pushed now. commit bbbf05e7f3d3e7a74d23e8cc252ebae895158abe Author: Jonathan Wakely Date: Mon Jun 7 10:27:00 2021 +0100 Document libstdc++ support for generic unordered lookup diff --git a/htdocs/gcc-11/changes.html b/htdocs/gcc-11/change

[wwwdocs] Add HTML anchors to GCC 5 "porting to" notes

2021-06-07 Thread Jonathan Wakely via Gcc-patches
This adds id attributes to the heading elements of https://gcc.gnu.org/gcc-5/porting_to.html (so that I can link directly to the section on inline functions). All later porting_to.html notes have anchors like this. OK for wwwdocs? commit 9f1723bc1d6b52fcfcfc4a8aee93eada98412e78 Author: Jonathan

Re: [PATCH] libstdc++: add missing typename for dependent type in std::ranges::elements_view [PR100900]

2021-06-07 Thread Jonathan Wakely via Gcc-patches
The patch is approved, if Patrick doesn't do it I'll push it later today. Thanks!

Re: [PATCH] PR libstdc++/98842: Fixed Constraints on operator<=>(optional, U)

2021-06-07 Thread Jonathan Wakely via Gcc-patches
On Fri, 4 Jun 2021 at 21:41, Jonathan Wakely wrote: > > On Thu, 3 Jun 2021 at 17:27, Seija K. via Libstdc++ > wrote: > > > The original operator was underconstrained. _Up needs to fulfill > > compare_three_way_result, > > as mentioned in this bug report > > https://gcc.gnu.org/bugzilla/show_bug.cg

[committed] libstdc++: Finish implementing LWG 3413 for propagate_const

2021-06-08 Thread Jonathan Wakely via Gcc-patches
We already have conditional noexcept so this just constrains the non-member swap overload. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/experimental/propagate_const (swap): Constrain. * testsuite/experimental/propagate_const/swap/lwg3413.cc: New test. Tested

Re: [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]

2021-06-08 Thread Jonathan Wakely via Gcc-patches
On Tue, 8 Jun 2021 at 01:29, Thomas Rodgers wrote: > This time without the repeatred [PR] in the subject line. > > Fixes libstdc++/100889 > This should be part of the ChangeLog entry instead, preceded by PR so it updates bugzilla, i.e. > libstdc++-v3/ChangeLog: > PR libstdc++/100889 >

[committed] libstdc++: Add warnings for some C++23 deprecations

2021-06-09 Thread Jonathan Wakely via Gcc-patches
LWG 3036 deprecates std::pmr::polymorphic_allocator::destroy in favour of the equivalent member of std::allocator_traits. LWG 3170 deprecates std::allocator::is_always_equal in favour of the equivalent member of std::allocator_traits. This also updates a comment to note that we support the LWG 35

[committed] libstdc++: Fix constraint on std::optional assignment [PR 100982]

2021-06-09 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: PR libstdc++/100982 * include/std/optional (optional::operator=(const optional&)): Fix value category used in is_assignable check. * testsuite/20_util/optional/assignment/100982.cc: New test. Tested powerpc64le-linux. Committed to trunk. co

Re: [PATCH] libstdc++: Fix Wrong param type in :atomic_ref<_Tp*>::wait [PR100889]

2021-06-09 Thread Jonathan Wakely via Gcc-patches
For other tests that don't link to libatomic we use if-constexpr to limit which types we test e.g. --- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc @@ -33,14 +33,17 @@ template S aa{ va }; S bb{ vb }; st

Re: [PATCH] c++: Add C++23 consteval if support - P1938R3 [PR100974]

2021-06-10 Thread Jonathan Wakely via Gcc-patches
On Thu, 10 Jun 2021 at 09:34, Jakub Jelinek wrote: > Also, the paper doesn't contain the exact __cpp_if_consteval value, Right, proposals aren't supposed to, because the value gets set when the proposal is voted into the working draft (which the proposal author doesn't control). > but https://git

Re: [PATCH] c++: Add C++23 consteval if support - P1938R3 [PR100974]

2021-06-10 Thread Jonathan Wakely via Gcc-patches
On Thu, 10 Jun 2021 at 11:34, Jakub Jelinek wrote: > > On Thu, Jun 10, 2021 at 11:24:43AM +0100, Jonathan Wakely wrote: > > > And I'm not changing the libstdc++ side, where perhaps we could change > > > std::is_constant_evaluated definition for > > > #ifdef __cpp_if_consteval > > > case to if const

Re: [Patch] contrib/gcc-changelog: Check that PR in subject in in changelog

2021-06-10 Thread Jonathan Wakely via Gcc-patches
On Thu, 10 Jun 2021 at 15:08, Tobias Burnus wrote: > > (Moved to gcc-patches, missed this when I replied to the initial email) > > Regarding patch at: https://gcc.gnu.org/pipermail/gcc/2021-June/236357.html > > On 10.06.21 14:45, Jonathan Wakely wrote: > > > As well as the "contrig" typo that Flori

[committed] libstdc++: Fix filesystem::path comparisons for C++23

2021-06-11 Thread Jonathan Wakely via Gcc-patches
In C++23 there is a basic_string_view(Range&&) constructor, which is constrained to take a range (specifically, a contiguous_range). When the filesystem::path comparison operators call lhs.compare(rhs) the overload taking a string_view is considered, which means checking whether path satisfies the

[committed] libstdc++: Replace try-catch in std::list::merge to avoid O(N) size

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The current std::list::merge code calls size() before starting to merge any elements, so that the _M_size members can be updated after the merge finishes. The work is done in a try-block so that the sizes can still be updated in an exception handler if any element comparison throws. The _M_size me

[committed] libstdc++: Fix _ForwardIteratorConcept for __gnu_debug::vector

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The recent changes to the _GLIBCXX_CONCEPT_CHECKS checks for forward iterators don't work for vector iterators in debug mode, because the _Safe_iterator specializations don't match the special cases I added for _Bit_iterator and _Bit_const_iterator. This refactors the _ForwardIteratorReferenceConc

[committed] libstdc++: Add noexcept to istream_iterator and ostream_iterator

2021-10-01 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * include/bits/stream_iterator.h (istream_iterator): Add noexcept to constructors and non-throwing member functions and friend functions. (ostream_iterator): Likewise. Tested x86_64-linux. Committed to trunk. commit 901fa4cc27ce693b36122081

[committed] libstdc++: Add missing header to test

2021-10-01 Thread Jonathan Wakely via Gcc-patches
We need to include (or one of the containers) to get a definition for std::begin. libstdc++-v3/ChangeLog: * testsuite/25_algorithms/is_permutation/2.cc: Include . Tested x86_64-linux. Committed to trunk. commit 94311bf34704ebecf745043fe2df03df201052fe Author: Jonathan Wakely Date: F

[committed] libstdc++: Define basic_regex::multiline for non-strict modes

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The regex_constants::multiline constant is defined for non-strict C++11 and C++14 modes, on the basis that the feature is a DR (even though it was really a new feature addition to C++17 and probably shouldn't have gone through the issues list). This makes the basic_regex::multiline constant define

[committed] libstdc++: Reduce header dependencies for C++20 std::erase [PR92546]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
This reduces the preprocessed size of , and by not including for std::remove and std::remove_if. Also unwrap iterators using __niter_base, to avoid redundant debug mode checks. PR libstdc++/92546 * include/bits/erase_if.h (__erase_nodes_if): Use __niter_base to unwrap d

[committed] libstdc++: Implement std::clamp with std::min and std::max [PR 96733]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The compiler doesn't know about the precondition of std::clamp that (hi < lo) is false, and so can't optimize as well as we'd like. By using std::min and std::max we help the compiler. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: PR libstdc++/96733 * include/bits/stl_a

[committed] libstdc++: Do not allocate a zero-size vector [PR 100153]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The vector::shrink_to_fit() implementation will allocate new storage even if the vector is empty. That then leads to the end-of-storage pointer being non-null and equal to the _M_start._M_p pointer, which means that _M_end_addr() has undefined behaviour. The fix is to stop doing a useless zero-siz

[committed] libstdc++: Use conditional noexcept in std::reverse_iterator [PR 94418]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
This adds a noexcept-specifier to each constructor and assignment operator of std::reverse_iterator so that they are noexcept when the corresponding operation on the underlying iterator is noexcept. The std::reverse_iterator class template already requires that the operations on the underlying typ

[committed] libstdc++: Add noexcept to common_iterator proxy operators

2021-10-01 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/stl_iterator.h (common_iterator::__arrow_proxy) (common_iterator::__postfix_proxy): Add noexcept. Tested powerpc64le-linux. Committed to trunk. commit ce709ad3dc0ed5d7ea48a116311d4441225446f0 Author: Jonathan

[committed] libstdc++: Make move ctor noexcept for fully-dynamic string

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The move constructor for the "fully-dynamic" COW string is not noexcept, because it allocates a new empty string rep for the moved-from string. However, there is no need to do that, because the moved-from string does not have to be left empty. Instead, implement move construction for the fully-dyna

[committed] libstdc++: Simplify __normal_iterator converting constructor

2021-10-01 Thread Jonathan Wakely via Gcc-patches
This uses C++11 features to simplify the definition of the __normal_iterator constructor that allows converting from iterator to const_iterator. The previous definition relied on _Container::pointer which is present in std::vector and std::basic_string, but is not actually part of the container req

[committed] libstdc++: Allow visiting inherited variants [PR 90943]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
Implement the changes from P2162R2 (as a DR for C++17). Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: PR libstdc++/90943 * include/std/variant (__cpp_lib_variant): Update value. (__detail::__variant::__as): New helpers implementing the as-variant exposit

[committed] libstdc++: Optimize std::visit for the common case [PR 78113]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
GCC does not do a good job of optimizing the table of function pointers used for variant visitation. This avoids using the table for the common case of visiting a single variant with a small number of alternative types. Instead we use: switch(v.index()) { case 0: return visitor(get<0>(v));

[committed] libstdc++: Add utility for creating std::error_code from OS errors

2021-10-01 Thread Jonathan Wakely via Gcc-patches
This adds a helper function to encapsulate obtaining an error code for errors from OS calls. For Windows we want to use GetLastError() and the system error category, but otherwise just use errno and the generic error category. This should not be used to replace existing uses of ec.assign(errno, ge

[committed] libstdc++: Add std::__conditional_t alias template

2021-10-01 Thread Jonathan Wakely via Gcc-patches
This change is inspired by the suggestion in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1715r0.html The new std::__conditional_t alias template is functionally equivalent to std::conditional_t but should be more efficient to compile, due to only ever instantiating two specializations

[committed] libstdc++: Avoid unconditional use of errc::not_supported [PR 99327]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The errc::not_supported constant is only defined if ENOTSUP is defined, which is not true for all targets. Many uses of errc::not_supported in the filesystem library do not actually match the intended meaning of ENOTSUP described by POSIX. They should be using ENOSYS instead (i.e. errc::function_no

[committed] libstdc++: Fix narrowing conversion in std::visit

2021-10-01 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/std/variant (__do_visit): Use variant_npos instead of literal -1 that requires a narrowing conversion. Tested powerpc64le-linux. Committed to trunk. commit dc1b29508d765b874372f4b1737ac6dc86962506 Author: Jonathan

[committed] libstdc++: Simplify __throw_out_of_range_fmt for freestanding

2021-10-01 Thread Jonathan Wakely via Gcc-patches
There is no point expanding the format string if we're just going to abort instead of throw an exception. And for freestanding or non-verbose builds we shouldn't do it either, to reduce the binary size. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * src/c++11/functexcept.cc (_

[committed] libstdc++: Remove useless base classes in pb_db tests

2021-10-01 Thread Jonathan Wakely via Gcc-patches
These function objects do not need to be adaptable, so stop deriving from deprecated classes. Also the 'inline' keyword is redundant on member functions defined in the class body. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/ext/pb_ds/example/basic_multimap.cc: Rem

[committed] libstdc++: Remove unary_function base classes from std::thread tests

2021-10-01 Thread Jonathan Wakely via Gcc-patches
std::thread does not care if a function object is adaptable, so there is no need to derive from the deprecated std::unary_function class in these tests. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/30_threads/thread/cons/3.cc: Remove derivation from std::un

[committed] libstdc++: Implement LWG 3392 for std::ranges::distance

2021-10-01 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * include/bits/ranges_base.h (ranges::distance): Split overload into two (LWG 3392). * testsuite/24_iterators/range_operations/lwg3392.cc: New test. Tested powerpc64le-linux. Committed to trunk. commit 20751fad19e1b0fb4272309dd6d7fde182b08dc1 Autho

[committed] libstdc++: Implement LWG 3522 for std::priority_queue

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The LWG 3522 issue constrains all constructors of container adaptors that have InputIterator parameters. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/stl_queue.h (priority_queue): Constrain constructors with InputIterator parameters (LWG 3522). *

[committed] libstdc++: Implement LWG 3529 for std::priority_queue

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The LWG 3529 issue changes to use two overloads instead of one with a default argument, so that the sequence can be initialized directly with the iterator range when no sequence argument is provided. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/stl_queue.h (prio

[committed] libstdc++: Implement LWG 3506 for std::priority_queue

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The LWG 3506 issue ads allocator-extended versions of the constructors that take iterator arguments. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/stl_queue.h (priority_queue): Add allocator-extended overloads for constructors taking iterator. * t

[committed] libstdc++: Add container adaptor constructors taking iterators (P1425R4)

2021-10-01 Thread Jonathan Wakely via Gcc-patches
This adds a feature that was recently added to the C++23 working draft. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/stl_queue.h (__cpp_lib_adaptor_iterator_pair_constructor): Define for C++23, as per P1425R4. (queue(InputIterator, InputI

[committed] libstdc++: Make std::jthread support pointers to member functions [PR 100612]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
This adds a non-standard extension to support initializing a std::jthread with a pointer to a member function that expects a stop_token to be added to the arguments. That use case is not supported by C++20, because the stop_token would get added as the first argument, which is where the object argu

[committed] libstdc++: Allow stateful allocators in std::list::sort [PR 66742]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
The temporary lists used by std::list::sort are default constructed, which means they use default constructed allocators. The sort operation is defined in terms of merge and splice operations, which have undefined behaviour (and abort) if the allocators do not compare equal. This means it is not po

[committed] libstdc++: Restore printing of assertion messages [PR102100]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
My changes for PR 101429 broke the _-replacement_assert function, because we now always just abort without printing anything. That's because I added checks for _GLIBCXX_HOSTED and _GLIBCXX_VERBOSE, but the checks are done before those get defined. This adds a new macro which is set by the sed comm

Re: [committed] libstdc++: Make std::jthread support pointers to member functions [PR 100612]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
On Fri, 1 Oct 2021 at 21:26, Ville Voutilainen wrote: > > On Fri, 1 Oct 2021 at 23:19, Jonathan Wakely via Libstdc++ > wrote: > > > > This adds a non-standard extension to support initializing a > > std::jthread with a pointer to a member function that expects a > > stop_token to be added to the a

[PATCH] c++: Do not warn about lifetime of std::initializer_list& [PR102482]

2021-10-01 Thread Jonathan Wakely via Gcc-patches
An initializer-list constructor taking a non-const lvalue cannot be called with a temporary, so the array's lifetime probably doesn't end with the full expression. -Winit-list-lifetime should not warn for that case. PR c++/102482 gcc/cp/ChangeLog: * init.c (maybe_warn_list_ctor):

Re: [committed] libstdc++: Specialize std::pointer_traits<__normal_iterator>

2021-10-01 Thread Jonathan Wakely via Gcc-patches
On Thu, 30 Sept 2021 at 21:27, François Dumont via Libstdc++ wrote: > > Here is the _Safe_iterator one. > > Doing so I noticed that pointer_traits rebind for __normal_iterator was > wrong and added tests on it. Oops, thanks! > For _Safe_iterator maybe I should specialize only when instantiated w

Re: [committed] libstdc++: Specialize std::pointer_traits<__normal_iterator>

2021-10-02 Thread Jonathan Wakely via Gcc-patches
On Sat, 2 Oct 2021 at 18:27, François Dumont wrote: > > I would like to propose this alternative approach. > > In this patch I make __normal_iterator and random iterator > _Safe_iterator compatible for pointer_traits primary template. > > Regarding pointer_traits I wonder if it shouldn't check for

Re: [committed] libstdc++: Specialize std::pointer_traits<__normal_iterator>

2021-10-02 Thread Jonathan Wakely via Gcc-patches
On Sat, 2 Oct 2021 at 14:08, François Dumont wrote: > > On 02/10/21 12:29 am, Jonathan Wakely wrote: > > On Thu, 30 Sept 2021 at 21:27, François Dumont via Libstdc++ > > wrote: > >> Here is the _Safe_iterator one. > >> > >> Doing so I noticed that pointer_traits rebind for __normal_iterator was >

[committed] libstdc++: Fix typos in std::filesystem code

2021-10-02 Thread Jonathan Wakely via Gcc-patches
There were a couple of typos in r12-4070 and r12-4071 which don't show up when building for POSIX targets. libstdc++-v3/ChangeLog: * src/c++17/fs_ops.cc (create_directory): Fix typo in enum name. * src/filesystem/ops-common.h (__last_system_error): Add explicit cast to avo

Re: [committed] libstdc++: Allow visiting inherited variants [PR 90943]

2021-10-03 Thread Jonathan Wakely via Gcc-patches
On Sat, 2 Oct 2021, 13:50 Daniel Krügler via Libstdc++, < libstd...@gcc.gnu.org> wrote: > Am Fr., 1. Okt. 2021 um 21:57 Uhr schrieb Jonathan Wakely via > Libstdc++ : > > > > Implement the changes from P2162R2 (as a DR for C++17). > > > > Signed-off-by: Jonathan Wakely > > > > libstdc++-v3/ChangeL

[committed] libstdc++: Disable std::string{, _view} construction from nullptr (P2166R1)

2021-10-04 Thread Jonathan Wakely via Gcc-patches
Implement this C++23 feature. Because construction from a null pointer is undefined, we can implement it for C++11 and up, turning undefined behaviour into a compilation error. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (basic_string(nullptr_t)): Define as deleted.

[committed] libstdc++: Implement P1518R2 for container deduction guides

2021-10-04 Thread Jonathan Wakely via Gcc-patches
This implements the C++23 P1518R2 proposal "Stop overconstraining allocators in container deduction guides" as a fix for C++17 and C++20 too. The changes allow class template argument deduction to ignore the type of a constructor argument that initializes an allocator_type parameter if the type sh

Re: [committed] libstdc++: Allow visiting inherited variants [PR 90943]

2021-10-04 Thread Jonathan Wakely via Gcc-patches
On Sun, 3 Oct 2021 at 10:07, Jonathan Wakely wrote: > > > > On Sat, 2 Oct 2021, 13:50 Daniel Krügler via Libstdc++, > wrote: >> >> Am Fr., 1. Okt. 2021 um 21:57 Uhr schrieb Jonathan Wakely via >> Libstdc++ : >> > >> > Implement the changes from P2162R2 (as a DR for C++17). >> > >> > Signed-off-by

Re: [committed] libstdc++: Specialize std::pointer_traits<__normal_iterator>

2021-10-04 Thread Jonathan Wakely via Gcc-patches
On Mon, 4 Oct 2021 at 21:28, François Dumont via Libstdc++ wrote: > > On 04/10/21 10:05 pm, François Dumont wrote: > > On 02/10/21 10:24 pm, Jonathan Wakely wrote: > >> On Sat, 2 Oct 2021 at 18:27, François Dumont wrote: > >>> I would like to propose this alternative approach. > >>> > >>> In this

[committed] libstdc++: Update __cpp_lib_adaptor_iterator_pair_constructor value

2021-10-05 Thread Jonathan Wakely via Gcc-patches
On 01/10/21 20:43 +0100, Jonathan Wakely wrote: This adds a feature that was recently added to the C++23 working draft. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/stl_queue.h (__cpp_lib_adaptor_iterator_pair_constructor): Define for C++23, as

[committed] libstdc++: Support printing volatile pointers (P1147R1)

2021-10-05 Thread Jonathan Wakely via Gcc-patches
To avoid needing to export a new symbol from the library (for now) the new member function uses __attribute__((always_inline)). libstdc++-v3/ChangeLog: * include/std/ostream (operator<<(const volatile void*)): Add new overload, as per P1147R1. * testsuite/27_io/basic_ostre

[committed] libstdc++: Add noexcept to some std::function internals

2021-10-05 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * include/bits/std_function.h (_Any_data::_M_access): Add noexcept. (_Function_base::_Base_manager::_M_get_pointer): Likewise. (_Function_base::_Base_manager::_M_not_empty_function): Likewise. Tested powerpc64le-linux. Committed to t

[committed] libstdc++: Fix testcase for newly-implemented C++20 semantics [PR102535]

2021-10-05 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: PR c++/102535 * testsuite/20_util/is_trivially_constructible/value.cc: Adjust expected value for C++20. Tested powerpc64le-linux. Committed to trunk. commit 7646847df71e57edca5ec5b8c3c3dc4550dcb49d Author: Jonathan Wakely Date: Tue Oct 5 09:32:1

[committed] libstdc++: Simplify constraints for std::any construction

2021-10-05 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * include/bits/utility.h (__is_in_place_type_v): Define variable template to detect in_place_type_t specializations. (__is_in_place_type): Replace class template with alias template using __is_in_place_type_v. * include/std/any (any(T

[committed] libstdc++: Add test for std::cmp_greater

2021-10-05 Thread Jonathan Wakely via Gcc-patches
This was omitted from the commit that added these comparisons. libstdc++-v3/ChangeLog: * testsuite/20_util/integer_comparisons/greater.cc: New test. Tested powerpc64le-linux. Committed to trunk. commit 824e0855732c601e0866d0e8a9264a85f758213e Author: Jonathan Wakely Date: Tue Oct 5 1

Re: [committed] libstdc++: Support printing volatile pointers (P1147R1)

2021-10-05 Thread Jonathan Wakely via Gcc-patches
On Tue, 5 Oct 2021 at 10:29, Daniel Krügler wrote: > > Am Di., 5. Okt. 2021 um 10:55 Uhr schrieb Jonathan Wakely via > Libstdc++ : > > > > To avoid needing to export a new symbol from the library (for now) the > > new member function uses __attribute__((always_inline)). > > > > libstdc++-v3/ChangeL

[committed] libstdc++: Ensure std::span and std::string_view are trivially copyable (P2251R1)

2021-10-05 Thread Jonathan Wakely via Gcc-patches
The recently approved P2251R1 paper requires these types to be trivially copyable. They always have been in libstdc++, but add tests to check it. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string_view/requirements/trivially_copyable.cc: New test. * testsuite/23_

[committed] libstdc++: Implement std::move_only_function for C++23 (P0288R9)

2021-10-06 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * include/Makefile.am: Add new headers. * include/Makefile.in: Regenerate. * include/std/functional: Include . * include/std/version (__cpp_lib_move_only_function): Define. * include/bits/mofunc_impl.h: New file. * include/bit

[committed] libstdc++: Avoid use of hardware interference non-constant [PR102377]

2021-10-07 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: PR libstdc++/102377 * include/bits/atomic_wait.h (__waiter_pool_base:_S_align): Hardcode to 64 instead of using non-constant constant. Tested x86_64-linux. Committed to trunk. commit 0e90799071ee78f712f3b58fca7000bc0a258ade Author: Jonathan Wakely

[committed] libstdc++: Move C++14 components to new header

2021-10-07 Thread Jonathan Wakely via Gcc-patches
This moves the "classic" contents of to a new header, so that , etc. can get use durations and clocks without calendar types, time zones, and chrono I/O. libstdc++-v3/ChangeLog: * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/std/chron

<    12   13   14   15   16   17   18   19   20   21   >