From: Jakub Jelinek Date: Mon, 11 Mar 2019 11:49:13 +0000 (+0100) Subject: re PR libstdc++/89641 (std::atomic no longer works) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8b9482b2d77da5b8db979845b49b3b91bcf898e9;p=gcc.git re PR libstdc++/89641 (std::atomic no longer works) PR libstdc++/89641 * include/std/atomic (atomic::store, atomic::load, atomic::exchange, atomic::compare_exchange_weak, atomic::compare_exchange_strong): Cast __m or __s and __f to int. * include/bits/atomic_base.h (__atomic_base::operator++, __atomic_base::operator--, __atomic_base::operator+=, __atomic_base::operator-=, __atomic_base::operator&=, __atomic_base::operator|=, __atomic_base::operator^=, __atomic_base::operator++, __atomic_base::operator--, __atomic_base::operator+=, __atomic_base::operator-=): Cast memory_order_seq_cst to int. From-SVN: r269582 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7da25945a8c..cee2c9d1d57 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,17 @@ +2019-03-11 Jakub Jelinek + + PR libstdc++/89641 + * include/std/atomic (atomic::store, atomic::load, + atomic::exchange, atomic::compare_exchange_weak, + atomic::compare_exchange_strong): Cast __m or __s and __f to int. + * include/bits/atomic_base.h (__atomic_base::operator++, + __atomic_base::operator--, __atomic_base::operator+=, + __atomic_base::operator-=, __atomic_base::operator&=, + __atomic_base::operator|=, __atomic_base::operator^=, + __atomic_base::operator++, __atomic_base::operator--, + __atomic_base::operator+=, __atomic_base::operator-=): Cast + memory_order_seq_cst to int. + 2019-03-08 Jonathan Wakely * doc/xml/manual/using.xml: Use link element instead of xref. diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index 6c1703aa11a..e30caef91bf 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -316,59 +316,59 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __int_type operator++() noexcept - { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } + { return __atomic_add_fetch(&_M_i, 1, int(memory_order_seq_cst)); } __int_type operator++() volatile noexcept - { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } + { return __atomic_add_fetch(&_M_i, 1, int(memory_order_seq_cst)); } __int_type operator--() noexcept - { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); } + { return __atomic_sub_fetch(&_M_i, 1, int(memory_order_seq_cst)); } __int_type operator--() volatile noexcept - { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); } + { return __atomic_sub_fetch(&_M_i, 1, int(memory_order_seq_cst)); } __int_type operator+=(__int_type __i) noexcept - { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_add_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator+=(__int_type __i) volatile noexcept - { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_add_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator-=(__int_type __i) noexcept - { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_sub_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator-=(__int_type __i) volatile noexcept - { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_sub_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator&=(__int_type __i) noexcept - { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_and_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator&=(__int_type __i) volatile noexcept - { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_and_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator|=(__int_type __i) noexcept - { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_or_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator|=(__int_type __i) volatile noexcept - { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_or_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator^=(__int_type __i) noexcept - { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_xor_fetch(&_M_i, __i, int(memory_order_seq_cst)); } __int_type operator^=(__int_type __i) volatile noexcept - { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); } + { return __atomic_xor_fetch(&_M_i, __i, int(memory_order_seq_cst)); } bool is_lock_free() const noexcept @@ -652,42 +652,42 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __pointer_type operator++() noexcept { return __atomic_add_fetch(&_M_p, _M_type_size(1), - memory_order_seq_cst); } + int(memory_order_seq_cst)); } __pointer_type operator++() volatile noexcept { return __atomic_add_fetch(&_M_p, _M_type_size(1), - memory_order_seq_cst); } + int(memory_order_seq_cst)); } __pointer_type operator--() noexcept { return __atomic_sub_fetch(&_M_p, _M_type_size(1), - memory_order_seq_cst); } + int(memory_order_seq_cst)); } __pointer_type operator--() volatile noexcept { return __atomic_sub_fetch(&_M_p, _M_type_size(1), - memory_order_seq_cst); } + int(memory_order_seq_cst)); } __pointer_type operator+=(ptrdiff_t __d) noexcept { return __atomic_add_fetch(&_M_p, _M_type_size(__d), - memory_order_seq_cst); } + int(memory_order_seq_cst)); } __pointer_type operator+=(ptrdiff_t __d) volatile noexcept { return __atomic_add_fetch(&_M_p, _M_type_size(__d), - memory_order_seq_cst); } + int(memory_order_seq_cst)); } __pointer_type operator-=(ptrdiff_t __d) noexcept { return __atomic_sub_fetch(&_M_p, _M_type_size(__d), - memory_order_seq_cst); } + int(memory_order_seq_cst)); } __pointer_type operator-=(ptrdiff_t __d) volatile noexcept { return __atomic_sub_fetch(&_M_p, _M_type_size(__d), - memory_order_seq_cst); } + int(memory_order_seq_cst)); } bool is_lock_free() const noexcept diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index 7acc2462bfb..699431e9727 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -240,18 +240,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void store(_Tp __i, memory_order __m = memory_order_seq_cst) noexcept - { __atomic_store(std::__addressof(_M_i), std::__addressof(__i), __m); } + { __atomic_store(std::__addressof(_M_i), std::__addressof(__i), int(__m)); } void store(_Tp __i, memory_order __m = memory_order_seq_cst) volatile noexcept - { __atomic_store(std::__addressof(_M_i), std::__addressof(__i), __m); } + { __atomic_store(std::__addressof(_M_i), std::__addressof(__i), int(__m)); } _Tp load(memory_order __m = memory_order_seq_cst) const noexcept { alignas(_Tp) unsigned char __buf[sizeof(_Tp)]; _Tp* __ptr = reinterpret_cast<_Tp*>(__buf); - __atomic_load(std::__addressof(_M_i), __ptr, __m); + __atomic_load(std::__addressof(_M_i), __ptr, int(__m)); return *__ptr; } @@ -260,7 +260,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { alignas(_Tp) unsigned char __buf[sizeof(_Tp)]; _Tp* __ptr = reinterpret_cast<_Tp*>(__buf); - __atomic_load(std::__addressof(_M_i), __ptr, __m); + __atomic_load(std::__addressof(_M_i), __ptr, int(__m)); return *__ptr; } @@ -270,7 +270,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION alignas(_Tp) unsigned char __buf[sizeof(_Tp)]; _Tp* __ptr = reinterpret_cast<_Tp*>(__buf); __atomic_exchange(std::__addressof(_M_i), std::__addressof(__i), - __ptr, __m); + __ptr, int(__m)); return *__ptr; } @@ -281,7 +281,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION alignas(_Tp) unsigned char __buf[sizeof(_Tp)]; _Tp* __ptr = reinterpret_cast<_Tp*>(__buf); __atomic_exchange(std::__addressof(_M_i), std::__addressof(__i), - __ptr, __m); + __ptr, int(__m)); return *__ptr; } @@ -292,7 +292,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __atomic_compare_exchange(std::__addressof(_M_i), std::__addressof(__e), std::__addressof(__i), - true, __s, __f); + true, int(__s), int(__f)); } bool @@ -302,7 +302,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __atomic_compare_exchange(std::__addressof(_M_i), std::__addressof(__e), std::__addressof(__i), - true, __s, __f); + true, int(__s), int(__f)); } bool @@ -324,7 +324,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __atomic_compare_exchange(std::__addressof(_M_i), std::__addressof(__e), std::__addressof(__i), - false, __s, __f); + false, int(__s), int(__f)); } bool @@ -334,7 +334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __atomic_compare_exchange(std::__addressof(_M_i), std::__addressof(__e), std::__addressof(__i), - false, __s, __f); + false, int(__s), int(__f)); } bool