aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2014-09-26 02:28:52 +0200
committerAndres Freund <andres@anarazel.de>2014-09-26 02:28:52 +0200
commit88bcdf9da5aa67da11ada0921703432ef2b7c21c (patch)
tree9b546f7adc702b1e9a56dd04f2865699c5f12fe6 /src
parentb64d92f1a5602c55ee8b27a7ac474f03b7aee340 (diff)
downloadpostgresql-88bcdf9da5aa67da11ada0921703432ef2b7c21c.tar.gz
postgresql-88bcdf9da5aa67da11ada0921703432ef2b7c21c.zip
Fix atomic ops for x86 gcc compilers that don't understand atomic intrinsics.
Per buildfarm animal locust.
Diffstat (limited to 'src')
-rw-r--r--src/include/port/atomics/generic-gcc.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/include/port/atomics/generic-gcc.h b/src/include/port/atomics/generic-gcc.h
index 23fa2a6ebb8..57e3bcaf716 100644
--- a/src/include/port/atomics/generic-gcc.h
+++ b/src/include/port/atomics/generic-gcc.h
@@ -108,8 +108,11 @@ typedef struct pg_atomic_uint64
*/
#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-#if !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && \
- (defined(HAVE_GCC__SYNC_CHAR_TAS) || defined(HAVE_GCC__SYNC_INT32_TAS))
+#ifdef PG_HAVE_ATOMIC_FLAG_SUPPORT
+
+#if defined(HAVE_GCC__SYNC_CHAR_TAS) || defined(HAVE_GCC__SYNC_INT32_TAS)
+
+#ifndef PG_HAVE_ATOMIC_TEST_SET_FLAG
#define PG_HAVE_ATOMIC_TEST_SET_FLAG
static inline bool
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)
/* some platform only support a 1 here */
return __sync_lock_test_and_set(&ptr->value, 1) == 0;
}
-#endif /* !defined(PG_HAVE_ATOMIC_TEST_SET_FLAG) && defined(HAVE_GCC__SYNC_*_TAS) */
+#endif
+
+#endif /* defined(HAVE_GCC__SYNC_*_TAS) */
#ifndef PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
#define PG_HAVE_ATOMIC_UNLOCKED_TEST_FLAG
@@ -153,6 +158,8 @@ pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
}
#endif
+#endif /* defined(PG_HAVE_ATOMIC_FLAG_SUPPORT) */
+
/* prefer __atomic, it has a better API */
#if !defined(PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32) && defined(HAVE_GCC__ATOMIC_INT32_CAS)
#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32