* include/bits/atomic_base.h (__atomic_flag_base): Define _M_i
based on the value of __GCC_ATOMIC_TEST_AND_SET_TRUEVAL.
(ATOMIC_FLAG_INIT): Initialize with 0, not false.
(atomic_flag::atomic_flag): Use __GCC_ATOMIC_TEST_AND_SET_TRUEVAL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183582
138bc75d-0d04-0410-961f-
82ee72b054a4
+2012-01-27 Richard Henderson <rth@redhat.com>
+
+ * include/bits/atomic_base.h (__atomic_flag_base): Define _M_i
+ based on the value of __GCC_ATOMIC_TEST_AND_SET_TRUEVAL.
+ (ATOMIC_FLAG_INIT): Initialize with 0, not false.
+ (atomic_flag::atomic_flag): Use __GCC_ATOMIC_TEST_AND_SET_TRUEVAL.
+
2012-01-26 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/51985
struct __atomic_flag_base
{
+ /* The target's "set" value for test-and-set may not be exactly 1. */
+#if __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1
bool _M_i;
+#else
+ unsigned char _M_i;
+#endif
};
_GLIBCXX_END_EXTERN_C
-#define ATOMIC_FLAG_INIT { false }
+#define ATOMIC_FLAG_INIT { 0 }
/// atomic_flag
struct atomic_flag : public __atomic_flag_base
atomic_flag& operator=(const atomic_flag&) volatile = delete;
// Conversion to ATOMIC_FLAG_INIT.
- atomic_flag(bool __i) noexcept : __atomic_flag_base({ __i }) { }
+ constexpr atomic_flag(bool __i) noexcept
+ : __atomic_flag_base({ __i ? __GCC_ATOMIC_TEST_AND_SET_TRUEVAL : 0 })
+ { }
bool
test_and_set(memory_order __m = memory_order_seq_cst) noexcept