libstdc++: Make atomic<T*>::wait() const [PR102994]
Commit Message
Comments
OK, thanks.
On Fri, 5 Nov 2021 at 21:46, Thomas Rodgers via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:
>
>
On Fri, 5 Nov 2021 at 21:51, Jonathan Wakely via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> OK, thanks.
Actually, we should really have a test to verify it can be called on a
const object. Please add something when you commit, it can be dumb and
simple, it just needs to verify that it can be called.
>
>
> On Fri, 5 Nov 2021 at 21:46, Thomas Rodgers via Libstdc++ <
> libstdc++@gcc.gnu.org> wrote:
>
> >
> >
Revised patch attached.
On Fri, Nov 5, 2021 at 4:46 PM Jonathan Wakely <jwakely.gcc@gmail.com>
wrote:
> On Fri, 5 Nov 2021 at 21:51, Jonathan Wakely via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
> >
> > OK, thanks.
>
> Actually, we should really have a test to verify it can be called on a
> const object. Please add something when you commit, it can be dumb and
> simple, it just needs to verify that it can be called.
>
>
> >
> >
> > On Fri, 5 Nov 2021 at 21:46, Thomas Rodgers via Libstdc++ <
> > libstdc++@gcc.gnu.org> wrote:
> >
> > >
> > >
>
>
On Tue, 9 Nov 2021 at 18:09, Thomas Rodgers wrote:
> Revised patch attached.
>
OK for trunk and gcc-11, thanks.
> On Fri, Nov 5, 2021 at 4:46 PM Jonathan Wakely <jwakely.gcc@gmail.com>
> wrote:
>
>> On Fri, 5 Nov 2021 at 21:51, Jonathan Wakely via Libstdc++
>> <libstdc++@gcc.gnu.org> wrote:
>> >
>> > OK, thanks.
>>
>> Actually, we should really have a test to verify it can be called on a
>> const object. Please add something when you commit, it can be dumb and
>> simple, it just needs to verify that it can be called.
>>
>>
>> >
>> >
>> > On Fri, 5 Nov 2021 at 21:46, Thomas Rodgers via Libstdc++ <
>> > libstdc++@gcc.gnu.org> wrote:
>> >
>> > >
>> > >
>>
>>
const qualification was also missing in the free functions for
wait/wait_explicit/notify_one/notify_all. Revised patch attached.
On Tue, Nov 9, 2021 at 11:40 AM Jonathan Wakely <jwakely@redhat.com> wrote:
> On Tue, 9 Nov 2021 at 18:09, Thomas Rodgers wrote:
>
>> Revised patch attached.
>>
>
> OK for trunk and gcc-11, thanks.
>
>
>
>> On Fri, Nov 5, 2021 at 4:46 PM Jonathan Wakely <jwakely.gcc@gmail.com>
>> wrote:
>>
>>> On Fri, 5 Nov 2021 at 21:51, Jonathan Wakely via Libstdc++
>>> <libstdc++@gcc.gnu.org> wrote:
>>> >
>>> > OK, thanks.
>>>
>>> Actually, we should really have a test to verify it can be called on a
>>> const object. Please add something when you commit, it can be dumb and
>>> simple, it just needs to verify that it can be called.
>>>
>>>
>>> >
>>> >
>>> > On Fri, 5 Nov 2021 at 21:46, Thomas Rodgers via Libstdc++ <
>>> > libstdc++@gcc.gnu.org> wrote:
>>> >
>>> > >
>>> > >
>>>
>>>
On Wed, 24 Nov 2021 at 01:27, Thomas Rodgers wrote:
>
> const qualification was also missing in the free functions for wait/wait_explicit/notify_one/notify_all. Revised patch attached.
Please tweak the whitespace in the new test:
> +test1(const std::atomic<char*> &a, char*p)
The '&' should be on the type not the variable, and there should be a
space before 'p':
> +test1(const std::atomic<char*>& a, char* p)
OK for trunk and gcc-11 with that tweak, thanks!
Tested uild-x86_64-pc-linux-gnu, pushed to trunk and gcc-11.
On Thu, Nov 25, 2021 at 1:24 PM Jonathan Wakely <jwakely@redhat.com> wrote:
> On Wed, 24 Nov 2021 at 01:27, Thomas Rodgers wrote:
> >
> > const qualification was also missing in the free functions for
> wait/wait_explicit/notify_one/notify_all. Revised patch attached.
>
> Please tweak the whitespace in the new test:
>
> > +test1(const std::atomic<char*> &a, char*p)
>
> The '&' should be on the type not the variable, and there should be a
> space before 'p':
>
> > +test1(const std::atomic<char*>& a, char* p)
>
> OK for trunk and gcc-11 with that tweak, thanks!
>
>
From 360c094a0725bb0cc444115c0377db10e5e9ae1f Mon Sep 17 00:00:00 2001
From: Thomas Rodgers <rodgert@twrodgers.com>
Date: Fri, 5 Nov 2021 14:30:24 -0700
Subject: [PATCH] libstdc++: Make atomic<T*>::wait() const [PR102994]
This was an oversight in the original commit adding wait/notify
to atomic<T>.
libstdc++-v3/ChangeLog:
PR libstdc++/102994
* include/bits/atomic_base.h (__atomic_base<_PTp*>::wait())
add const qualifier.
---
libstdc++-v3/include/bits/atomic_base.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -893,7 +893,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(__pointer_type __old,
- memory_order __m = memory_order_seq_cst) noexcept
+ memory_order __m = memory_order_seq_cst) const noexcept
{
std::__atomic_wait_address_v(&_M_p, __old,
[__m, this]
--
2.31.1