Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88bcdf9

Browse files
committed
Fix atomic ops for x86 gcc compilers that don't understand atomic intrinsics.
Per buildfarm animal locust.
1 parent b64d92f commit 88bcdf9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/include/port/atomics/generic-gcc.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,11 @@ typedef struct pg_atomic_uint64
108108
*/
109109
#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
110110

111-
#if !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && \
112-
(defined(HAVE_GCC__SYNC_CHAR_TAS) || defined(HAVE_GCC__SYNC_INT32_TAS))
111+
#ifdef PG_HAVE_ATOMIC_FLAG_SUPPORT
112+
113+
#if defined(HAVE_GCC__SYNC_CHAR_TAS) || defined(HAVE_GCC__SYNC_INT32_TAS)
114+
115+
#ifndef PG_HAVE_ATOMIC_TEST_SET_FLAG
113116
#define PG_HAVE_ATOMIC_TEST_SET_FLAG
114117
static inline bool
115118
pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
@@ -118,7 +121,9 @@ pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
118121
/* some platform only support a 1 here */
119122
return __sync_lock_test_and_set(&ptr->value, 1) == 0;
120123
}
121-
#endif /* !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && defined(HAVE_GCC__SYNC_*_TAS) */
124+
#endif
125+
126+
#endif /* defined(HAVE_GCC__SYNC_*_TAS) */
122127

123128
#ifndef PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
124129
#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
@@ -153,6 +158,8 @@ pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
153158
}
154159
#endif
155160

161+
#endif /* defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) */
162+
156163
/* prefer __atomic, it has a better API */
157164
#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) && defined(HAVE_GCC__ATOMIC_INT32_CAS)
158165
#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32

0 commit comments

Comments
 (0)