Re: [committed] libstdc++: Re-enable workaround for _wstat64 bug [PR 88881]

2021-02-12 Thread Jonathan Wakely via Gcc-patches
On 10/02/21 16:58 +, Jonathan Wakely wrote: This wasn't fixed upstream for mingw-w64 so we still need the workaround. libstdc++-v3/ChangeLog: PR libstdc++/1 * src/c++17/fs_ops.cc (fs::status): Re-enable workaround. Oops, the same change is needed in symlink_status as w

[committed] libstdc++: Restore in testsuite_fs.h header [PR 99096]

2021-02-14 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: PR libstdc++/99096 * testsuite/util/testsuite_fs.h: Always include . Tested x86_64-linux. Committed to trunk. commit 4e3590d06cf8a06fcc460ccda6150483a0311bae Author: Jonathan Wakely Date: Sun Feb 14 20:38:32 2021 libstdc++: Restore in testsuite_fs

[committed] libstdc++: Add missing return and use reserved name

2021-02-15 Thread Jonathan Wakely via Gcc-patches
The once_flag::_M_activate() function is only ever called immediately after a call to once_flag::_M_passive(), and so in the non-gthreads case it is impossible for _M_passive() to be true in the body of _M_activate(). Add a check for it anyway, to avoid warnings about missing return. Also replace

[committed] libstdc++: Fix __thread_yield for non-gthreads targets

2021-02-15 Thread Jonathan Wakely via Gcc-patches
The __gthread_yield() function is only defined for gthreads targets, so check _GLIBCXX_HAS_GTHREADS before using it. Also reorder __thread_relax and __thread_yield so that the former can use the latter instead of repeating the same preprocessor checks. libstdc++-v3/ChangeLog: * include/b

Re: [committed] libstdc++: Fix __thread_yield for non-gthreads targets

2021-02-19 Thread Jonathan Wakely via Gcc-patches
On 15/02/21 16:13 +, Jonathan Wakely wrote: The __gthread_yield() function is only defined for gthreads targets, so check _GLIBCXX_HAS_GTHREADS before using it. Also reorder __thread_relax and __thread_yield so that the former can use the latter instead of repeating the same preprocessor che

Re: [PATCH] doc: c: c++: Document the C/C++ extended asm empty input constraints

2021-02-22 Thread Jonathan Wakely via Gcc-patches
On 15/02/21 23:22 +, Neven Sajko wrote: There is a long-standing, but undocumented GCC inline assembly feature that's part of the extended asm GCC extension to C and C++: extended asm empty input constraints. Although I don't really use extended asm much, and I never contributed to GCC befor

Re: [PATCH 2/2] libstdc++: Fix endianness issue with IBM long double [PR98384]

2021-02-22 Thread Jonathan Wakely via Gcc-patches
On Mon, 22 Feb 2021, 22:13 Patrick Palka via Libstdc++, < libstd...@gcc.gnu.org> wrote: > The logic in std::to_chars for extracting the high- and low-order parts > of a IBM long double value does the right thing on powerpc64le, but not > on powerpc64be. This patch makes the extraction endian-agno

[committed] libstdc++: Fix failing tests due to 'u' identifier in kernel header

2021-02-24 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * testsuite/17_intro/names.cc: Undefine 'u' on powerpc*-linux*. Tested powerpc64le-linux. Committed to trunk. commit d0453cf5c68b6aa0e8c57a7a99d4285f047387b7 Author: Jonathan Wakely Date: Wed Feb 24 16:24:34 2021 libstdc++: Fix failing tests due to 'u' ide

Re: [PATCH 1/2] libstdc++: Robustify long double std::to_chars testcase [PR98384]

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 23/02/21 11:30 -0500, Patrick Palka via Libstdc++ wrote: On Mon, 22 Feb 2021, Patrick Palka wrote: This makes the hexadecimal section of the long double std::to_chars testcase more robust by avoiding false-negative FAILs due to printf using a different leading hex digit than us, and by addit

[committed] libstdc++: Define std::to_chars overloads for __ieee128 [PR 98389]

2021-02-24 Thread Jonathan Wakely via Gcc-patches
This adds overloads of std::to_chars for powerpc64's __ieee128, so that std::to_chars can be used for long double when -mabi=ieeelongdouble is in used. Eventually we'll want to extend these new overloads to work for __float128 on all targets that support that type. For now, we're only doing it for

Re: [PATCH 1/2] libstdc++: Robustify long double std::to_chars testcase [PR98384]

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 24/02/21 12:04 -0500, Patrick Palka via Libstdc++ wrote: On Wed, 24 Feb 2021, Jonathan Wakely wrote: On 23/02/21 11:30 -0500, Patrick Palka via Libstdc++ wrote: > On Mon, 22 Feb 2021, Patrick Palka wrote: > > > This makes the hexadecimal section of the long double std::to_chars > > testcase

Re: [committed] libstdc++: Define std::to_chars overloads for __ieee128 [PR 98389]

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 24/02/21 17:00 +, Jonathan Wakely via Libstdc++ wrote: libstdc++: Define std::to_chars overloads for __ieee128 [PR 98389] This adds overloads of std::to_chars for powerpc64's __ieee128, so that std::to_chars can be used for long double when -mabi=ieeelongdouble is in used.

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 23/02/21 13:24 +, Cassio Neri via Libstdc++ wrote: This patch reimplements std::chrono::year_month_day::_S_from_days() which retrieves a date from the number of elapsed days since 1970/01/01. The new implementation is based on Proposition 6.3 of Neri and Schneider, "Euclidean Affine Funct

Re: [PATCH] libstdc++: Update baseline symbols for {aarch64,ia64,m68k,riscv64}-linux

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 23/02/21 16:18 +0100, Andreas Schwab wrote: libstdc++-v3/ * config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/ia64-linux-gnu/baseline_symbols.txt: Update. * config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Update. * config/abi

Re: [PATCH 4/4] libstdc++: More efficient last day of month.

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 23/02/21 23:13 +0100, Matthias Kretz wrote: I like the idea. On Dienstag, 23. Februar 2021 14:25:10 CET Cassio Neri via Libstdc++ wrote: ((__m ^ (__m >> 3)) & 1) | 30 Note that you can drop the `& 1` part. 30 in binary is 0b0. ORing with a value in [0, 0b01101] will only toggle the las

Re: [PATCH] libstdc++: Fix __floating_to_chars_precision for __float128

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 24/02/21 17:14 -0500, Patrick Palka via Libstdc++ wrote: The code path in __floating_to_chars_precision for handling long double by going through printf now also handles __float128, so the condition that guards this code path needs to be updated accordingly. Tested on x86_64-pc-linux-gnu (i.e

Re: [committed] libstdc++: Define std::to_chars overloads for __ieee128 [PR 98389]

2021-02-24 Thread Jonathan Wakely via Gcc-patches
On 24/02/21 17:00 +, Jonathan Wakely via Libstdc++ wrote: @@ -815,6 +852,39 @@ template return result; } +namespace +{ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wabi" + template + inline int + sprintf_ld(char* buffer, const char* format_string, T value, Extra...

[committed] libstdc++: Add std::to_underlying for C++23

2021-02-25 Thread Jonathan Wakely via Gcc-patches
Implement P1682R2 as just approved for C++23. libstdc++-v3/ChangeLog: * include/std/utility (to_underlying): Define. * include/std/version (__cpp_lib_to_underlying): Define. * testsuite/20_util/to_underlying/1.cc: New test. * testsuite/20_util/to_underlying/version

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Jonathan Wakely via Gcc-patches
On 24/02/21 17:28 +, Jonathan Wakely wrote: On 23/02/21 13:24 +, Cassio Neri via Libstdc++ wrote: This patch reimplements std::chrono::year_month_day::_S_from_days() which retrieves a date from the number of elapsed days since 1970/01/01. The new implementation is based on Proposition 6

[wwwdocs] Document new libstdc++ features

2021-02-25 Thread Jonathan Wakely via Gcc-patches
Pushed to wwwdocs. commit 86937d6dfe04c81c805cfc321c62a520dfd2a59f Author: Jonathan Wakely Date: Thu Feb 25 12:54:45 2021 + Document new libstdc++ features diff --git a/htdocs/gcc-11/changes.html b/htdocs/gcc-11/changes.html index de75b8d6..6a47b0b8 100644 --- a/htdocs/gcc-11/changes

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Jonathan Wakely via Gcc-patches
On 25/02/21 13:46 +, Cassio Neri via Libstdc++ wrote: Hi Jonathan, The issue is that I didn't cast __dp.count() to uint32_t: - const auto __r0 = __dp.count() + __r2_e3; + const auto __r0 = static_cast(__dp.count()) + __r2_e3; The above would be a better fix. Indeed, __r0 belongs

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Jonathan Wakely via Gcc-patches
On 25/02/21 14:02 +, Jonathan Wakely wrote: On 25/02/21 13:46 +, Cassio Neri via Libstdc++ wrote: Hi Jonathan, The issue is that I didn't cast __dp.count() to uint32_t: - const auto __r0 = __dp.count() + __r2_e3; + const auto __r0 = static_cast(__dp.count()) + __r2_e3; The a

[committed] libstdc++: Document library versioning for GCC 11

2021-02-25 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: * doc/xml/manual/abi.xml: Document versioning for GCC 11. * doc/html/manual/abi.html: Regenerate. Committed to trunk. commit ed255fd5eda5e2530779bb69b8805c916ddfe0c2 Author: Jonathan Wakely Date: Thu Feb 25 14:09:40 2021 libstdc++: Document library

[committed] libstdc++: Do not assume std::FILE is complete [PR 99270]

2021-02-25 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog: PR libstdc++/99270 * testsuite/27_io/headers/cstdio/types_std.cc: Use pointer to FILE instead of FILE. Tested x86_64-linux. Committed to trunk. commit 31002af9040876dfb6444fabd524b11ca0739519 Author: Jonathan Wakely Date: Thu Feb 25 15:31:19 202

Re: [PATCH 1/4] libstdc++: More efficient date from days.

2021-02-25 Thread Jonathan Wakely via Gcc-patches
On 25/02/21 14:19 +, Jonathan Wakely wrote: On 25/02/21 14:02 +, Jonathan Wakely wrote: On 25/02/21 13:46 +, Cassio Neri via Libstdc++ wrote: Hi Jonathan, The issue is that I didn't cast __dp.count() to uint32_t: - const auto __r0 = __dp.count() + __r2_e3; + const auto _

Re: [PATCH/RFA] libstdc++: provide conversion from day, month to unsigned long, PR99301

2021-02-27 Thread Jonathan Wakely via Gcc-patches
On 27/02/21 12:42 +0100, Hans-Peter Nilsson via Libstdc++ wrote: Since 97d6161f6a7fa712 / r11-7370 "libstdc++: More efficient days from date" I see an additional 81 testsuite-errors for cris-elf, with this in g++.log for one randomly picked regressing test: FAIL: g++.dg/cpp1y/pr57640.C -std=c++

Re: [PATCH] libstdc++: Update Solaris baselines for GCC 11.1

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 03/03/21 13:29 +0100, Rainer Orth wrote: The following patch updates the Solaris baselines for GCC 11.1. There's only one caveat: comparing the Solaris 11.3 and 11.4 baselines, I find +FUNC:_ZSt10from_charsPKcS0_RdSt12chars_format@@GLIBCXX_3.4.29 +FUNC:_ZSt10from_charsPKcS0_ReSt12chars_forma

Re: [PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 26/02/21 07:59 -0800, Thiago Macieira via Libstdc++ wrote: ints can be used as futex on Linux. ptrdiff_t on 64-bit Linux can't. Yes, we should do this for GCC 11. libstdc++-v3/include/std/latch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std

Re: [PATCH 2/5] Atomic __platform_wait: accept any 32-bit type, not just int

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 26/02/21 07:59 -0800, Thiago Macieira via Libstdc++ wrote: The kernel doesn't care what we store in those 32 bits, only that they are comparable. This commit adds: * pointers and long on 32-bit architectures * unsigned * untyped enums and typed enums on int & unsigned int * float We're not us

Re: [PATCH 5/5] barrier: optimise by not having the hasher in a loop

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 26/02/21 07:59 -0800, Thiago Macieira via Libstdc++ wrote: Our thread's ID does not change so we don't have to get it every time and hash it every time. This looks good for GCC 11. (This one wouldn't be an ABI break to change later, but we might as well do it now, as we have the patch now).

Re: [PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 01/03/21 09:56 +0100, Richard Biener via Libstdc++ wrote: On Sun, Feb 28, 2021 at 10:53 PM Hans-Peter Nilsson wrote: On Fri, 26 Feb 2021, Thiago Macieira via Gcc-patches wrote: > On Friday, 26 February 2021 11:31:00 PST Andreas Schwab wrote: > > On Feb 26 2021, Thiago Macieira wrote: > >

Re: [PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 03/03/21 14:56 +, Jonathan Wakely wrote: On 01/03/21 09:56 +0100, Richard Biener via Libstdc++ wrote: On Sun, Feb 28, 2021 at 10:53 PM Hans-Peter Nilsson wrote: On Fri, 26 Feb 2021, Thiago Macieira via Gcc-patches wrote: On Friday, 26 February 2021 11:31:00 PST Andreas Schwab wrote

Re: [PATCH] [libstdc++] Refactor/cleanup of atomic wait implementation

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 23/02/21 13:57 -0800, Thomas Rodgers wrote: diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h index 1a0f0943ebd..fa83ef6c231 100644 --- a/libstdc++-v3/include/bits/atomic_wait.h +++ b/libstdc++-v3/include/bits/atomic_wait.h @@ -39,17 +39,16 @@ #inc

Re: [PATCH 2/5] Atomic __platform_wait: accept any 32-bit type, not just int

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 03/03/21 14:34 +, Jonathan Wakely wrote: On 26/02/21 07:59 -0800, Thiago Macieira via Libstdc++ wrote: The kernel doesn't care what we store in those 32 bits, only that they are comparable. This commit adds: * pointers and long on 32-bit architectures * unsigned * untyped enums and typed

Re: [PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 03/03/21 09:14 -0800, Thiago Macieira via Libstdc++ wrote: On Wednesday, 3 March 2021 06:34:26 PST Jonathan Wakely wrote: On 26/02/21 07:59 -0800, Thiago Macieira via Libstdc++ wrote: >ints can be used as futex on Linux. ptrdiff_t on 64-bit Linux can't. Yes, we should do this for GCC 11. W

Re: [PATCH] [libstdc++] Refactor/cleanup of atomic wait implementation

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 23/02/21 13:57 -0800, Thomas Rodgers wrote: From: Thomas Rodgers * This revises the previous version to fix std::__condvar::wait_until() usage. This is a substantial rewrite of the atomic wait/notify (and timed wait counterparts) implementation. The previous __platform_wait looped on EINTR

Re: [PATCH 2/5] Atomic __platform_wait: accept any 32-bit type, not just int

2021-03-03 Thread Jonathan Wakely via Gcc-patches
On 03/03/21 19:34 +0200, Ville Voutilainen wrote: On Wed, 3 Mar 2021 at 19:25, Jonathan Wakely via Libstdc++ wrote: Oh, except that is_scalar is surprisingly expensive to instantiate (its defined in a really expensive way) and since we control all uses I'll be more than happy to write you an

[committed] libstdc++: Fix buffer overflows in tests [PR 99382]

2021-03-04 Thread Jonathan Wakely via Gcc-patches
This seems to be a typo/thinko in the definition of the arrays used as storage. libstdc++-v3/ChangeLog: PR libstdc++/99382 * testsuite/20_util/specialized_algorithms/uninitialized_default_n/sizes.cc: Make storage larger than required. Verify no write to the last e

[wwwdocs] Add to libstdc++ header dependency changes

2021-03-04 Thread Jonathan Wakely via Gcc-patches
Committed to wwwdocs. commit ed1a8d0621f5f5dee4d869393b9155f475d360f7 Author: Jonathan Wakely Date: Thu Mar 4 20:51:52 2021 + Add to libstdc++ header dependency changes diff --git a/htdocs/gcc-11/porting_to.html b/htdocs/gcc-11/porting_to.html index 83227c74..4d27c163 100644 --- a/ht

Re: [PATCH] libstdc++: Improve std::rot[lr] [PR99396]

2021-03-06 Thread Jonathan Wakely via Gcc-patches
On Fri, 5 Mar 2021, 22:32 Jakub Jelinek via Libstdc++, < libstd...@gcc.gnu.org> wrote: > Hi! > > As can be seen on: > #include > > unsigned char f1 (unsigned char x, int y) { return std::rotl (x, y); } > unsigned char f2 (unsigned char x, int y) { return std::rotr (x, y); } > unsigned short f3 (u

Re: [PATCH] skip testing time before epoch on mips

2021-03-08 Thread Jonathan Wakely via Gcc-patches
On 08/03/21 14:35 +0800, Chen Li wrote: When execute libstdc++ testcases on mips, I notice that last_write_time alawys failed, and the failed VERIFY is "VERIFY( approx_equal(last_write_time(f.path), time) );" where testing time before than epoch. Below is the minimal case: ``` // gcc a.c int

[committed] libstc++: Add dg-error for additional error in C++11 mode

2021-08-02 Thread Jonathan Wakely via Gcc-patches
When the comparison with a nullptr_t is ill-formed, there is an additional error for C++11 mode due to the constexpr function body being invalid. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/20_util/tuple/comparison_operators/overloaded2.cc: Add dg-error fo

[committed] libstdc++: Fix filesystem::temp_directory_path [PR101709]

2021-08-02 Thread Jonathan Wakely via Gcc-patches
On 30/07/21 18:13 +0100, Jonathan Wakely wrote: This adds a configure check for the GNU extension secure_getenv and then uses it for looking up TMPDIR and similar variables. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: PR libstdc++/65018 * configure.ac: Check for sec

[committed] libstdc++: Avoid using std::unique_ptr in

2021-08-03 Thread Jonathan Wakely via Gcc-patches
std::wstring_convert and std::wbuffer_convert types are not copyable or movable, and store a plain pointer without a deleter. That means a much simpler type that just uses delete in its destructor can be used instead of std::unique_ptr. That avoids including and parsing all of in every header tha

[committed] libstdc++: Reduce header dependencies in

2021-08-03 Thread Jonathan Wakely via Gcc-patches
This reduces the size of a little. This is one of the largest and slowest headers in the library. By using and instead of we don't need to parse all the parallel algorithms and std::ranges:: algorithms that are not needed by . Similarly, by using and instead of we don't need to parse the de

[committed] libstdc++: Add testsuite proc for testing deprecated features

2021-08-03 Thread Jonathan Wakely via Gcc-patches
This change adds options to tests that explicitly use deprecated features, so that -D_GLIBCXX_USE_DEPRECATED=0 can be used to run the rest of the testsuite. The tests that explicitly/intentionally use deprecated features will still be able to use them, but they can be disabled for the majority of t

[committed] libstdc++: Deprecate std::random_shuffle for C++14

2021-08-03 Thread Jonathan Wakely via Gcc-patches
The std::random_shuffle algorithm was removed in C++14 (without deprecation). This adds the deprecated attribute for C++14 and later, so that users are warned they should not be using it in those dialects. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * doc/xml/manual/evolution

[committed] libstdc++: Remove trailing whitespace in some tests

2021-08-03 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/20_util/function_objects/binders/3113.cc: Remove trailing whitespace. * testsuite/20_util/shared_ptr/assign/auto_ptr.cc: Likewise. * testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc: Likewise.

[committed] libstdc++: Specialize allocator_traits>

2021-08-03 Thread Jonathan Wakely via Gcc-patches
This adds a partial specialization of allocator_traits, similar to what was already done for std::allocator. This means that most uses of polymorphic_allocator via the traits can avoid the metaprogramming overhead needed to deduce the properties from polymorphic_allocator. In addition, I'm changin

[committed] libstdc++: Replace TR1 components with C++11 ones in test utils

2021-08-03 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/util/testsuite_common_types.h: Replace uses of tr1::unordered_map and tr1::unordered_set with their C++11 equivalents. * testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust dg-error line

[committed] libstdc++: Suppress redundant definitions of inline variables

2021-08-03 Thread Jonathan Wakely via Gcc-patches
In C++17 the out-of-class definitions for static constexpr variables are redundant, because they are implicitly inline. This change avoids "redundant redeclaration" warnings from -Wsystem-headers -Wdeprecated. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/random.

Re: [PATCH] libstdc++: Skip atomic instructions in _Sp_counted_base::_M_release when both counts are 1

2021-08-03 Thread Jonathan Wakely via Gcc-patches
On Mon, 2 Aug 2021 at 14:29, Maged Michael wrote: > > This is the right patch. The previous one is missing noexcept. Sorry. > > > On Mon, Aug 2, 2021 at 9:23 AM Maged Michael wrote: >> >> Please find attached an updated patch after incorporating Jonathan's >> suggestions. >> >> Changes from the l

[committed 1/2] libstdc++: Add [[nodiscard]] to iterators and related utilities

2021-08-04 Thread Jonathan Wakely via Gcc-patches
This adds [[nodiscard]] throughout , as proposed by P2377R0 (with some minor corrections). The attribute is added for all modes from C++11 up, using [[__nodiscard__]] or _GLIBCXX_NODISCARD where C++17 [[nodiscard]] can't be used directly. commit 240b01b0215f9e46ecf04267c8a3faeb19d4fe3c Author: J

[committed 2/2] libstdc++: Add [[nodiscard]] to sequence containers

2021-08-04 Thread Jonathan Wakely via Gcc-patches
... and container adaptors. This adds the [[nodiscard]] attribute to functions with no side-effects for the sequence containers and their iterators, and the debug versions of those containers, and the container adaptors, Tested powerpc64le-linux, committed to trunk. commit 0d04fe49239d9178785

Re: [committed 2/2] libstdc++: Add [[nodiscard]] to sequence containers

2021-08-04 Thread Jonathan Wakely via Gcc-patches
On 04/08/21 12:56 +0100, Jonathan Wakely wrote: ... and container adaptors. This adds the [[nodiscard]] attribute to functions with no side-effects for the sequence containers and their iterators, and the debug versions of those containers, and the container adaptors, I don't plan to add any m

Re: [PATCH] libstdc++: Skip atomic instructions in _Sp_counted_base::_M_release when both counts are 1

2021-08-04 Thread Jonathan Wakely via Gcc-patches
On Tue, 3 Aug 2021 at 21:59, Jonathan Wakely wrote: > > On Mon, 2 Aug 2021 at 14:29, Maged Michael wrote: > > > > This is the right patch. The previous one is missing noexcept. Sorry. > > > > > > On Mon, Aug 2, 2021 at 9:23 AM Maged Michael > > wrote: > >> > >> Please find attached an updated pat

Re: [PATCH] libstdc++: Skip atomic instructions in _Sp_counted_base::_M_release when both counts are 1

2021-08-04 Thread Jonathan Wakely via Gcc-patches
On Wed, 4 Aug 2021 at 16:47, Maged Michael wrote: > > Thanks, Jonathan! > > On Wed, Aug 4, 2021 at 11:32 AM Jonathan Wakely wrote: >> >> On Tue, 3 Aug 2021 at 21:59, Jonathan Wakely wrote: >> > >> > On Mon, 2 Aug 2021 at 14:29, Maged Michael wrote: >> > > >> > > This is the right patch. The previ

Re: [PATCH] libstdc++: Skip atomic instructions in _Sp_counted_base::_M_release when both counts are 1

2021-08-04 Thread Jonathan Wakely via Gcc-patches
On Wed, 4 Aug 2021 at 18:19, Maged Michael wrote: > > Sorry. I totally missed the rest of your message and the patch. My fuzzy > eyesight, which usually guesses correctly 90% of the time, mistook "Secondly" > on a line by itself for "Sincerely" :-) :-) > The noinlining was based on looking at g

[committed] libstdc++: Move attributes that follow requires-clauses [PR101782]

2021-08-05 Thread Jonathan Wakely via Gcc-patches
On 04/08/21 12:55 +0100, Jonathan Wakely wrote: This adds [[nodiscard]] throughout , as proposed by P2377R0 (with some minor corrections). The attribute is added for all modes from C++11 up, using [[__nodiscard__]] or _GLIBCXX_NODISCARD where C++17 [[nodiscard]] can't be used directly. This ch

Re: [committed 2/2] libstdc++: Add [[nodiscard]] to sequence containers

2021-08-05 Thread Jonathan Wakely via Gcc-patches
On Thu, 5 Aug 2021 at 13:14, Ville Voutilainen wrote: > > On Thu, 5 Aug 2021 at 15:11, Christophe Lyon via Libstdc++ > wrote: > > > > Hi Jonathan, > > > > On Wed, Aug 4, 2021 at 2:04 PM Jonathan Wakely via Gcc-patches < > > gcc-patches@gcc.gnu.org

Re: [committed 2/2] libstdc++: Add [[nodiscard]] to sequence containers

2021-08-05 Thread Jonathan Wakely via Gcc-patches
On 04/08/21 13:00 +0100, Jonathan Wakely wrote: On 04/08/21 12:56 +0100, Jonathan Wakely wrote: ... and container adaptors. This adds the [[nodiscard]] attribute to functions with no side-effects for the sequence containers and their iterators, and the debug versions of those containers, and th

Re: [committed] libstdc++: Move attributes that follow requires-clauses [PR101782]

2021-08-05 Thread Jonathan Wakely via Gcc-patches
On 05/08/21 15:19 +0100, Jonathan Wakely wrote: On 04/08/21 12:55 +0100, Jonathan Wakely wrote: This adds [[nodiscard]] throughout , as proposed by P2377R0 (with some minor corrections). The attribute is added for all modes from C++11 up, using [[__nodiscard__]] or _GLIBCXX_NODISCARD where C++1

Re: [committed] libstdc++: Move attributes that follow requires-clauses [PR101782]

2021-08-05 Thread Jonathan Wakely via Gcc-patches
On 05/08/21 15:40 +0100, Jonathan Wakely wrote: On 05/08/21 15:19 +0100, Jonathan Wakely wrote: On 04/08/21 12:55 +0100, Jonathan Wakely wrote: This adds [[nodiscard]] throughout , as proposed by P2377R0 (with some minor corrections). The attribute is added for all modes from C++11 up, using [

Re: [committed] libstdc++: Move attributes that follow requires-clauses [PR101782]

2021-08-06 Thread Jonathan Wakely via Gcc-patches
On 05/08/21 19:02 +0100, Jonathan Wakely wrote: On 05/08/21 15:40 +0100, Jonathan Wakely wrote: On 05/08/21 15:19 +0100, Jonathan Wakely wrote: On 04/08/21 12:55 +0100, Jonathan Wakely wrote: This adds [[nodiscard]] throughout , as proposed by P2377R0 (with some minor corrections). The attrib

Re: [PATCH] libstdc++: Tweak timeout for testsuite/std/ranges/iota/max_size_type.cc

2021-08-07 Thread Jonathan Wakely via Gcc-patches
On Sun, 8 Aug 2021, 03:42 Hans-Peter Nilsson, wrote: > A simulator can easily spend more than 10 minutes running this > test-case, and the default timeout is at 5 minutes. Better allow > even slower machines; use 4 as the factor. > > Regarding relative runtime numbers (very local; mmixware simula

Re: [committed] Fix dg-prune-output

2021-08-08 Thread Jonathan Wakely via Gcc-patches
On Sun, 8 Aug 2021, 20:26 François Dumont via Libstdc++, < libstd...@gcc.gnu.org> wrote: > This is a trivial fix following a recent change on __glibcxx_assert. > > libstdc++: Fix dg-prune-output assertion message > > Since __glibcxx_assert changes in r6b42b5a the generated assertion > me

Re: trunk -D_GLIBCXX_DEBUG #include fails

2021-08-09 Thread Jonathan Wakely via Gcc-patches
On Mon, 9 Aug 2021 at 10:51, Stephan Bergmann via Libstdc++ wrote: > > Not sure why I started to experience this now with a recent > GCC/libstdc++ trunk build: > > > $ cat test.cc > > #include > > > $ gcc/trunk/inst/bin/g++ -D_GLIBCXX_DEBUG -fsyntax-only test.cc > > In file included from > > /ho

Re: [PATCH] Avoid allocator operator== in _Safe_container

2021-08-09 Thread Jonathan Wakely via Gcc-patches
On Mon, 9 Aug 2021 at 11:26, François Dumont via Libstdc++ wrote: > > Some newly introduced tests in > 23_containers/unordered_map/cons/default.cc revealed that we are forcing > the allocator type to have a operator==. All allocators are required to have operator== so that should not be a problem

Re: [PATCH] Avoid allocator operator== in _Safe_container

2021-08-09 Thread Jonathan Wakely via Gcc-patches
On Mon, 9 Aug 2021 at 11:33, Jonathan Wakely wrote: > > On Mon, 9 Aug 2021 at 11:26, François Dumont via Libstdc++ > wrote: > > > > Some newly introduced tests in > > 23_containers/unordered_map/cons/default.cc revealed that we are forcing > > the allocator type to have a operator==. > > All alloc

Re: [PATCH] Avoid allocator operator== in _Safe_container

2021-08-09 Thread Jonathan Wakely via Gcc-patches
On Mon, 9 Aug 2021 at 11:34, Jonathan Wakely wrote: > > On Mon, 9 Aug 2021 at 11:33, Jonathan Wakely wrote: > > > > On Mon, 9 Aug 2021 at 11:26, François Dumont via Libstdc++ > > wrote: > > > > > > Some newly introduced tests in > > > 23_containers/unordered_map/cons/default.cc revealed that we ar

Re: [PATCH] Avoid allocator operator== in _Safe_container

2021-08-09 Thread Jonathan Wakely via Gcc-patches
On Mon, 9 Aug 2021 at 13:08, François Dumont wrote: > > On 09/08/21 1:52 pm, François Dumont wrote: > > On 09/08/21 12:45 pm, Jonathan Wakely wrote: > >> On Mon, 9 Aug 2021 at 11:34, Jonathan Wakely wrote: > >>> On Mon, 9 Aug 2021 at 11:33, Jonathan Wakely wrote: > On Mon, 9 Aug 2021 at 11:26

Re: trunk -D_GLIBCXX_DEBUG #include fails

2021-08-09 Thread Jonathan Wakely via Gcc-patches
On Mon, 9 Aug 2021 at 15:27, Jonathan Wakely wrote: > > On Mon, 9 Aug 2021 at 13:05, François Dumont via Libstdc++ > wrote: > > > > On 09/08/21 12:05 pm, Jonathan Wakely via Libstdc++ wrote: > > > On Mon, 9 Aug 2021 at 10:51, Stephan Bergmann via Libstdc++ > > > wrote: > > >> Not sure why I start

Re: trunk -D_GLIBCXX_DEBUG #include fails

2021-08-09 Thread Jonathan Wakely via Gcc-patches
On Mon, 9 Aug 2021 at 15:42, Jonathan Wakely wrote: > > On Mon, 9 Aug 2021 at 15:27, Jonathan Wakely wrote: > > > > On Mon, 9 Aug 2021 at 13:05, François Dumont via Libstdc++ > > wrote: > > > > > > On 09/08/21 12:05 pm, Jonathan Wakely via Libstdc++ wrote: > > > > On Mon, 9 Aug 2021 at 10:51, Ste

[committed] libstdc++: Define std::is_pointer_interconvertible_base_of for C++20

2021-08-11 Thread Jonathan Wakely via Gcc-patches
Implement these traits using the new built-ins that Jakub added recently. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/std/type_traits (__cpp_lib_is_pointer_interconvertible) (is_pointer_interconvertible_base_of_v) (is_pointer_interconvertible_base_of

[committed] libstdc++: Fix test that fails randomly [PR101866]

2021-08-11 Thread Jonathan Wakely via Gcc-patches
This test assumes that the same sequence of three values cannot occur, which is incorect. It's unlikely, but not impossible. Perform the check in a loop, so that in the unlikely event of an identical sequence, we retry. If the library code is buggy it will keep producing the same sequence and the

[committed] libstdc++: Add #error to some files that depend on a specific standard mode

2021-08-12 Thread Jonathan Wakely via Gcc-patches
Give more explicit errors if these files are not built with the correct -std options. libstdc++-v3/ChangeLog: * src/c++98/locale_init.cc: Require C++11. * src/c++98/localename.cc: Likewise. * src/c++98/misc-inst.cc: Require C++98. Tested powerpc64le-linux. Committed to tr

[committed] libstdc++: Add [[nodiscard]] to experimental::randint

2021-08-12 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/experimental/random (experimental::randint): Add nodiscard attribute. Tested powerpc64le-linux. Committed to trunk. commit 20ce14c7991fbb498e32a0f5e3b01ae88c9f5e9a Author: Jonathan Wakely Date: Thu Aug 12 18:05

[committed] libstdc++: Make some #error strings consistent with other tests

2021-08-12 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/26_numerics/lerp.cc: Add header name to #error. * testsuite/26_numerics/midpoint/integral.cc: Likewise. * testsuite/26_numerics/midpoint/version.cc: New test. Tested powerpc64le-linux. Committed to trunk.

[committed] libstdc++: Add additional overload of std::lerp [PR101870]

2021-08-12 Thread Jonathan Wakely via Gcc-patches
The [cmath.syn] p1 wording about additional overloads sufficient to handle any arithmetic types also applies to std::lerp. This adds a new overload of std::lerp that does the required promotions to support arguments of arbitrary arithmetic types. A new __promoted_t alias template is added, which t

Re: What should a std::error_code pretty printer show?

2021-08-16 Thread Jonathan Wakely via Gcc-patches
On Mon, 16 Aug 2021 at 13:11, Jonathan Wakely wrote: > > > > On Mon, 16 Aug 2021, 12:55 Jonathan Wakely, wrote: >> >> I'm adding a GDB printer for std::error_code.What I have now prints >> the category name as a quoted string, followed by the error value: >> >> {"system": 0} >> {"system": 1234} >

[committed] libstdc++: Install GDB pretty printers for debug library

2021-08-16 Thread Jonathan Wakely via Gcc-patches
The additional libraries installed by --enable-libstdcxx-debug are built without optimization to aid debugging, but the Python pretty printers are not installed alongside them. This means that you can step through the unoptimized library code, but at the expense of pretty printing the library types

[committed] libstdc++: Use qualified-id for class member constant [PR101937]

2021-08-16 Thread Jonathan Wakely via Gcc-patches
The expression ctx._M_indent is not a constant expression when ctx is a reference parameter, even though _M_indent is an enumerator. Rename it to _S_indent to be consistent with our conventions, and refer to it as PrintContext::_S_indent to be valid C++ code (at least until P2280 is accepted as a D

Re: What should a std::error_code pretty printer show?

2021-08-16 Thread Jonathan Wakely via Gcc-patches
On Mon, 16 Aug 2021 at 17:51, Jonathan Wakely wrote: > > On Mon, 16 Aug 2021 at 13:11, Jonathan Wakely wrote: > > > > > > > > On Mon, 16 Aug 2021, 12:55 Jonathan Wakely, wrote: > >> > >> I'm adding a GDB printer for std::error_code.What I have now prints > >> the category name as a quoted string

[committed] libstdc++: Add pretty printer for std::error_code and std::error_condition

2021-08-17 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Define. (build_libstdcxx_dictionary): Register printer for std::error_code and std::error_condition. * testsuite/libstdc++-prettyprinters/cxx11.cc: Test

[committed] libstdc++: Add conditional noexcept to std::exchange

2021-08-17 Thread Jonathan Wakely via Gcc-patches
This is not required by the standard, but seems useful. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/std/utility (exchange): Add noexcept-specifier. * testsuite/20_util/exchange/noexcept.cc: New test. Tested powerpc64le-linux. Committed to trunk. commit 42c

[committed] libstdc++: Rename __detail::__not_same_as helper

2021-08-17 Thread Jonathan Wakely via Gcc-patches
This is done to match an editorial change in the working draft, to rename the exposition-only not-same-as helper to different-from. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/ranges_util.h (__not_same_as): Rename to __different_from. * include/

[committed] libstdc++: Only define basic_string::contains for C++23

2021-08-17 Thread Jonathan Wakely via Gcc-patches
The new contains member of the COW string is defined for non-strict gnu++20 mode as well as for C++23 modes. I think that was left in the committed patch unintentionally. It is inconsistent with the SSO string, and doesn't actually compile because it uses the basic_string_view::contains member whic

Re: [committed] libstdc++: Add pretty printer for std::error_code and std::error_condition

2021-08-17 Thread Jonathan Wakely via Gcc-patches
On Tue, 17 Aug 2021 at 14:27, Jonathan Wakely wrote: > > Signed-off-by: Jonathan Wakely > > libstdc++-v3/ChangeLog: > > * python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Define. > (build_libstdcxx_dictionary): Register printer for > std::error_code and std::error_con

[committed] libstdc++: Test std::seed_seq construction from input iterators

2021-08-17 Thread Jonathan Wakely via Gcc-patches
Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/26_numerics/random/seed_seq/cons/range.cc: Check construction from input iterators. Tested powerpc64le-linux. Committed to trunk. commit 20698ec5b681e23fa3404ed0ef78e3367b28e16d Author: Jonathan Wakely Date:

Re: [PATCH] Optimize seed_seq construction

2021-08-17 Thread Jonathan Wakely via Gcc-patches
On Tue, 17 Aug 2021 at 09:42, Antony Polukhin wrote: > > When std::seed_seq is constructed from random access iterators we can > detect the internal vector size in O(1). Reserving memory for elements > in such cases may avoid multiple memory allocations. > > libstdc++-v3/ChangeLog: > > * in

[committed] libstdc++: Optimize std::function move constructor [PR101923]

2021-08-17 Thread Jonathan Wakely via Gcc-patches
PR 101923 points out that the unconditional swap in the std::function move constructor makes it slower than copying an empty std::function. The copy constructor has to check for the empty case before doing anything, and that makes it very fast for the empty case. Adding the same check to the move

Re: [PATCH v2] libstdc++: Fix testsuite for skipping gdb tests on remote/non-native target

2021-08-17 Thread Jonathan Wakely via Gcc-patches
On Mon, 9 Aug 2021 at 12:47, Luc Michel wrote: > > This fixes an incorrect invocation of gdb on remote targets where > DejaGNU would try to run host's gdb in remote target simulator. > gdb-test skips the testing when target is remote or non native but the > gdb version check function does not. > >

Re: [PATCH] Optimize seed_seq construction

2021-08-17 Thread Jonathan Wakely via Gcc-patches
On Tue, 17 Aug 2021 at 14:40, Antony Polukhin wrote: > > вт, 17 авг. 2021 г. в 16:37, Jonathan Wakely : > <...> > > Thanks, this is a nice improvement. We can avoid tag dispatching to > > make it simpler though: > > > > @@ -3248,6 +3249,9 @@ namespace __detail > > template > > seed_seq::seed

Re: [PATCH] Avoid illegal argument to verbose in dg-test callback

2021-08-17 Thread Jonathan Wakely via Gcc-patches
On Tue, 17 Aug 2021 at 20:15, Thomas Schwinge wrote: > > Hi! > > On 2020-04-16T15:21:44+0200, Matthias Kretz wrote: > > If extra_tool_flags starts with a dash, an error like 'ERROR: verbose: > > illegal argument: -march=native -O2 -std=c++17' is printed. This is > > easily fixed by inserting a do

[committed] wwwdocs: Add missing punctuation to elements

2021-08-17 Thread Jonathan Wakely via Gcc-patches
Pushed to wwwdocs as obvious. commit 44d97225cc39f2cfbc3109c6a6473bde3886357a Author: Jonathan Wakely Date: Tue Aug 17 21:30:28 2021 +0100 Add missing punctuation to elements diff --git a/htdocs/bugs/index.html b/htdocs/bugs/index.html index 0a1b582a..99a1ddb1 100644 --- a/htdocs/bugs/i

Re: [PATCH v2] libstdc++: improve documentation for bits/stl_function.h [PR51539]

2021-08-18 Thread Jonathan Wakely via Gcc-patches
On Tue, 17 Aug 2021 at 21:39, Krzysztof Żelechowski wrote: > > PR libstdc++/PR51539 > > ChangeLog > * libstdc++-v3/include/bits/stl_function.h: Improve documentation. > > diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/ > bits/stl_function.h > index 073018d522

Re: [PATCH v2] libstdc++: improve documentation for bits/stl_function.h [PR51539]

2021-08-18 Thread Jonathan Wakely via Gcc-patches
On Wed, 18 Aug 2021 at 13:49, Jonathan Wakely wrote: > > On Tue, 17 Aug 2021 at 21:39, Krzysztof Żelechowski > wrote: > >template > > struct greater : public binary_function<_Tp, _Tp, bool> > > { > > + /// Tests whether parameter 1 is greater (`operator>`) than > > parameter

[committed] libstdc++: Fix vector printer tests to work in debug mode

2021-08-18 Thread Jonathan Wakely via Gcc-patches
This fixes a compilation error in debug mode, due to std::_Bit_reference not being defined, because it's in namespace std::__cxx1998 instead. We can refer to it as vector::reference instead, which always works. That fixes some compilation errors in debug mode, but the tests fail at run-time instea

[committed] libstdc++: Fix CTAD for debug sequence containers

2021-08-18 Thread Jonathan Wakely via Gcc-patches
This fixes some 23_containers/*/cons/deduction.cc failures seen with -std=c++17/-D_GLIBCXX_DEBUG, caused by non-immediate errors when substituting template arguments into an incorrect specialization of the std::__cxx1998 base class. This happens because the size_type member of the debug container i

[committed] libstdc++: Simplify n-ary arithmetic promotion traits

2021-08-18 Thread Jonathan Wakely via Gcc-patches
The std::complex partial specializations have been unnecessary since 774c3d8647cc7012937cfc9d2d6dacc85b6cf8e9 Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/ext/type_traits.h (__promote_2, __promote_3) (__promote_4): Redfine as alias templates using __promoted_

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