On Thu, 9 Oct 2025 at 07:21, Hans-Peter Nilsson wrote:
>
> > From: Jonathan Wakely <[email protected]>
> > Date: Wed,  8 Oct 2025 21:19:25 +0100
>
> > libstdc++-v3/ChangeLog:
> >
> >       PR libstdc++/122172
> >       * include/bits/shared_ptr_base.h (_Sp_counted_base): Define
> >       _Unsigned_count_type for make_unsigned<_Atomic_word>.
> >       Replace __int_traits<_Atomic_word> with equivalent expression.
> >       * include/ext/atomicity.h (_GLIBCXX_UNSIGNED_ATOMIC_WORD):
> >       Define macro for unsigned type to use for arithmetic.
> >       (__exchange_and_add_single, __atomic_add_single): Use it.
>
> LGTM for cris-elf: tested at r16-4259-g9242a89d088f44, this
> does not yield regressions compared to...that other patch
> suggested in the PR composed of several comments. :-)

I forgot to mention that this was the 3rd or 4th different solution I
tried. I kept going round and round on the cleanest way to do it. In
the end I decided that just suppressing the warnings was fine, and
much better than "clever" tricks like
make_unsigned<decltype(+declval<_Atomic_word>())> which avoid the
warning.

GCC is correct that it's losing the alignment attribute, but it's safe
for us to silence that warning because we don't care about the
alignment. Limiting the visibility of the unsigned types (via a macro
that is undefined after use or a private member) and clearly
commenting them should avoid the problems of somebody misusing it
later.

> And thanks again for looking into this so quickly; as soon
> as I found time to write a bug-report.

I don't like causing regressions :-)

Reply via email to