[PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int
Jonathan Wakely
jwakely@redhat.com
Wed Mar 3 14:34:26 GMT 2021
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/latch b/libstdc++-v3/include/std/latch
>index ef8c301e5e9..156aea5c5e5 100644
>--- a/libstdc++-v3/include/std/latch
>+++ b/libstdc++-v3/include/std/latch
>@@ -48,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> public:
> static constexpr ptrdiff_t
> max() noexcept
>- { return __gnu_cxx::__int_traits<ptrdiff_t>::__max; }
>+ { return __gnu_cxx::__int_traits<int>::__max; }
>
> constexpr explicit latch(ptrdiff_t __expected) noexcept
> : _M_a(__expected) { }
>@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> }
>
> private:
>- alignas(__alignof__(ptrdiff_t)) ptrdiff_t _M_a;
>+ alignas(__alignof__(int)) int _M_a;
> };
> _GLIBCXX_END_NAMESPACE_VERSION
> } // namespace
>--
>2.30.1
>
More information about the Gcc-patches
mailing list