From: Ivan Maidanski Date: Tue, 28 Nov 2017 19:11:15 +0000 (+0300) Subject: Define AO_TS_SET to true (1) if GCC atomic_test_and_set is used X-Git-Tag: v7.6.2~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8d559f5be67befec44c839809b2941295c03988;p=libatomic_ops Define AO_TS_SET to true (1) if GCC atomic_test_and_set is used (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). --- diff --git a/src/atomic_ops/sysdeps/test_and_set_t_is_char.h b/src/atomic_ops/sysdeps/test_and_set_t_is_char.h index 75df9c0..9eb250c 100644 --- a/src/atomic_ops/sysdeps/test_and_set_t_is_char.h +++ b/src/atomic_ops/sysdeps/test_and_set_t_is_char.h @@ -26,11 +26,13 @@ * 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 {