[PATCH] PR libstdc++/112682 More efficient std::basic_string move

2023-12-16 Thread Antony Polukhin
regards, Antony Polukhin diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 1b8ebca7dad..7a5e348280c 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -188,6 +188,23

Re: [PATCH] assert that deleting by pointer to base in unique_ptr does not cause UB

2021-09-22 Thread Antony Polukhin via Gcc-patches
ср, 22 сент. 2021 г. в 20:44, Jonathan Wakely : > > On Wed, 22 Sept 2021 at 18:09, Antony Polukhin wrote: > > > > std::unique_ptr allows construction from std::unique_ptr of derived > > type as per [unique.ptr.single.asgn] and [unique.ptr.single.ctor]. If > > std::d

Re: [PATCH] assert that deleting by pointer to base in unique_ptr does not cause UB

2021-09-22 Thread Antony Polukhin via Gcc-patches
ср, 22 сент. 2021 г. в 20:23, Ville Voutilainen : > > On Wed, 22 Sept 2021 at 20:09, Antony Polukhin via Libstdc++ > wrote: > > > > std::unique_ptr allows construction from std::unique_ptr of derived > > type as per [unique.ptr.single.asgn] and [unique.ptr.single.ctor].

[PATCH] assert that deleting by pointer to base in unique_ptr does not cause UB

2021-09-22 Thread Antony Polukhin via Gcc-patches
* testsuite/20_util/unique_ptr/assign/slicing_neg.cc: New test. -- Best regards, Antony Polukhin diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index 6e55375..53a68f5 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits

Re: [PATCH] Optimize seed_seq construction

2021-08-17 Thread Antony Polukhin via Gcc-patches
__detail::_Shift::__value>(*__iter)); > > The call to std::distance is well-formed for input iterators, but we > won't actually call it unless we have random access iterators. > > Unless you see a problem with this that I'm missing, I'll go with that > version. Looks much better. Thanks! -- Best regards, Antony Polukhin

[PATCH] Optimize seed_seq construction

2021-08-17 Thread Antony Polukhin via Gcc-patches
regards, Antony Polukhin diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index bf43970..816bfc1 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -3234,14 +3234,31 @@ namespace __detail template seed_seq

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

2021-05-12 Thread Antony Polukhin via Gcc-patches
ср, 12 мая 2021 г. в 18:38, Antony Polukhin : > > ср, 12 мая 2021 г. в 17:44, Jonathan Wakely : > > > > On 12/05/21 12:58 +0300, Antony Polukhin wrote: > > >ср, 12 мая 2021 г. в 12:18, Jonathan Wakely : > > ><...> > > >> Or just leave

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

2021-05-12 Thread Antony Polukhin via Gcc-patches
ср, 12 мая 2021 г. в 17:44, Jonathan Wakely : > > On 12/05/21 12:58 +0300, Antony Polukhin wrote: > >ср, 12 мая 2021 г. в 12:18, Jonathan Wakely : > ><...> > >> Or just leave it undefined, as libc++ seems to do according to your > >> comment in PR 89728:

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

2021-05-12 Thread Antony Polukhin via Gcc-patches
ср, 12 мая 2021 г. в 12:58, Antony Polukhin : <...> > Should we care about those users? Looks like the answer is "yes". There are tests for that in 22_locale/ctype/requirements/explicit_instantiation.cc and 22_locale/money_get/cons/3.cc Attaching a patch with revie

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

2021-05-12 Thread Antony Polukhin via Gcc-patches
s on libc++ Should we care about those users? -- Best regards, Antony Polukhin

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

2021-05-11 Thread Antony Polukhin via Gcc-patches
This patch provides compile time diagnostics for common misuse of [locale.convenience] functions with std::string as a character type. 2021-05-11 Antony Polukhin PR libstdc++/89728 * include/bits/locale_facets.h (ctype) Add static assert. * testsuite/22_locale/ctype/is/string

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2021-05-07 Thread Antony Polukhin via Gcc-patches
tions make sure that we detect incomplete types even if the user specialized the std::basic_common_reference. 2020-11-12 Antony Polukhin PR libstdc/71579 * include/std/type_traits (is_convertible, is_nothrow_convertible) (common_type, common_reference): Add static_asserts to make sur

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2021-01-08 Thread Antony Polukhin via Gcc-patches
On Thu, Nov 12, 2020, 21:55 Antony Polukhin wrote: > Final bits for libstdc/71579 > Gentle reminder on last patch >

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2020-11-12 Thread Antony Polukhin via Gcc-patches
f the user specialized the std::basic_common_reference. Changelog: 2020-11-12 Antony Polukhin PR libstdc/71579 * include/std/type_traits (is_convertible, is_nothrow_convertible) (common_type, common_reference): Add static_asserts to make sure that the arguments of the type trai

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2020-09-24 Thread Antony Polukhin via Gcc-patches
Looks like the last patch was not applied. Do I have to change something in it?

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2020-08-20 Thread Antony Polukhin via Gcc-patches
ср, 19 авг. 2020 г. в 14:29, Jonathan Wakely : <...> > Do we also want to check > (std::__is_complete_or_unbounded(__type_identity<_ArgTypes>{}) && ...) > for invoke_result and the is_invocable traits? Done. Changelog: 2020-08-20 Antony Polukhin PR li

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2020-08-19 Thread Antony Polukhin via Gcc-patches
aits are not > defined before C++17. Good idea. I'll try. -- Best regards, Antony Polukhin

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2020-08-12 Thread Antony Polukhin via Gcc-patches
Fixed patch for type traits hardening Changelog 2020-08-12 Antony Polukhin PR libstdc/71579 * include/std/type_traits (invoke_result, is_nothrow_invocable_r) Add static_asserts to make sure that the argument of the type trait is not misused with incomplete types

Re: [PATCH] Optimize to_chars

2019-09-08 Thread Antony Polukhin
__first[0] and __first[1] drops the function time to 7.53 cycles. Changelog: 2019-09-08 Antony Polukhin * include/bits/charconv.h (__detail::__to_chars_10_impl): Replace final offsets with constants. And that's the only optimization that improves all the usecases and reduces

Re: [PATCH] Optimize to_chars

2019-08-30 Thread Antony Polukhin
> > Also, please don't include the ChangeLog diff in the patch, because it > just makes it hard to apply the patch (the ChangeLog part will almost > always fail to apply because somebody else will have modified the > ChangeLog file since you created the patch, and so that hunk won't > apply. The ChangeLog text should be sent as a separate (plain text) > attachment, or just in the email body (as you did above). Thanks! I'll take it into account next time. -- Best regards, Antony Polukhin

[PATCH] Optimize to_chars

2019-08-30 Thread Antony Polukhin
Use __detail::__to_chars_len_2 instead of a generic __detail::__to_chars_len. * include/std/charconv (__detail::__to_chars): Remove zero termination from array of digits. * include/std/charconv (__detail::__to_chars_2): Leading digit is always '1'. -- Best regards, A

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2019-06-20 Thread Antony Polukhin
чт, 20 июн. 2019 г. в 20:57, Ville Voutilainen : > > On Thu, 20 Jun 2019 at 20:49, Antony Polukhin wrote: > > > > чт, 6 июн. 2019 г. в 15:19, Jonathan Wakely : > > > I'm removing some of these assertions again, because they are either > > > reundant

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2019-06-20 Thread Antony Polukhin
raits with variadic template arguments. I have to came up with a proper solution for providing a useful and lightweight diagnostics. -- Best regards, Antony Polukhin diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ac98c0d..9063fe5 100644 --- a/libstdc++-v3/ChangeLog +++ b/l

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2019-05-30 Thread Antony Polukhin
On Thu, May 30, 2019, 19:38 Jonathan Wakely wrote: <...> > I've attached a relative diff, to be applied on top of yours, with my > suggested tweaks. Do you see any issues with it? > > (If you're happy with those tweaks I can go ahead and apply this, > there's no need for an updated patch from you

Re: [PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2019-05-29 Thread Antony Polukhin
чт, 9 мая 2019 г. в 00:10, Jonathan Wakely : > > On 06/05/19 14:19 +0300, Antony Polukhin wrote: > >@@ -924,14 +984,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > template > > struct is_default_constructible > > : public __is_default

[PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

2019-05-06 Thread Antony Polukhin
_util/is_unbounded_array/value.cc: Likewise. * testsuite/20_util/is_union/value.cc: Likewise. * testsuite/20_util/is_void/value.cc: Likewise. * testsuite/util/testsuite_tr1.h: Add incomplete union type. -- Best regards, Antony Polukhin diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog

Re: [PATCH] PR libstdc++/87431 re-adjust never-valueless optimizations

2019-04-03 Thread Antony Polukhin
On Wed, Apr 3, 2019, 23:39 Ville Voutilainen wrote: > On Wed, 3 Apr 2019 at 23:32, Antony Polukhin wrote: > > > > Looks good. Covers most of the use cases. > > > > Please consider adding filesystem::path, pair, tuple, string_view?, > error_code, list, deque (

Re: [PATCH] PR libstdc++/87431 re-adjust never-valueless optimizations

2019-04-03 Thread Antony Polukhin
Looks good. Covers most of the use cases. Please consider adding filesystem::path, pair, tuple, string_view?, error_code, list, deque (myabe all the other containers), optional, variant itself (for cases when variant holds another variant). It would be very useful for the _Never_valueless_alt to