Define AO_TS_SET to true (1) if GCC atomic_test_and_set is used
authorIvan Maidanski <ivmai@mail.ru>
Tue, 28 Nov 2017 19:11:15 +0000 (22:11 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 30 Nov 2017 15:52:14 +0000 (18:52 +0300)
(fix commit 3315a03)

According to GCC manual about the built-in functions for memory model
aware atomic operations, __atomic_test_and_set returns bool value;
bool true is encoded as 1.

* src/atomic_ops/sysdeps/test_and_set_t_is_char.h [AO_PREFER_GENERALIZED
|| !__GCC_ATOMIC_TEST_AND_SET_TRUEVAL] (AO_TS_SET_TRUEVAL): Define to 1
(instead of 0xff).

src/atomic_ops/sysdeps/test_and_set_t_is_char.h

index 75df9c0..9eb250c 100644 (file)
  * all zeroes, and the "set" value contains all ones typically.
  */
 
-#if defined(AO_GCC_ATOMIC_TEST_AND_SET) && !defined(AO_PREFER_GENERALIZED) \
-    && defined(__GCC_ATOMIC_TEST_AND_SET_TRUEVAL)
+#ifndef AO_GCC_ATOMIC_TEST_AND_SET
+# define AO_TS_SET_TRUEVAL 0xff
+#elif defined(__GCC_ATOMIC_TEST_AND_SET_TRUEVAL) \
+      && !defined(AO_PREFER_GENERALIZED)
 # define AO_TS_SET_TRUEVAL __GCC_ATOMIC_TEST_AND_SET_TRUEVAL
 #else
-# define AO_TS_SET_TRUEVAL 0xff
+# define AO_TS_SET_TRUEVAL 1 /* true */
 #endif
 
 typedef enum {