summaryrefslogtreecommitdiff
path: root/src/include/port/atomics/generic-acc.h
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2015-08-05 18:19:52 +0200
committerAndres Freund <andres@anarazel.de>2015-08-05 18:19:52 +0200
commitde6fd1c898f6eca82c2130a9dbb42d00da68d79e (patch)
tree2387db94ee7d19f19ec45dbfc31c3a6c3494a62c /src/include/port/atomics/generic-acc.h
parenta855118be3f0682a2061448db5a87dec50717af4 (diff)
downloadpostgresql-de6fd1c898f6eca82c2130a9dbb42d00da68d79e.tar.gz
Rely on inline functions even if that causes warnings in older compilers.
So far we have worked around the fact that some very old compilers do not support 'inline' functions by only using inline functions conditionally (or not at all). Since such compilers are very rare by now, we have decided to rely on inline functions from 9.6 onwards. To avoid breaking these old compilers inline is defined away when not supported. That'll cause "function x defined but not used" type of warnings, but since nobody develops on such compilers anymore that's ok. This change in policy will allow us to more easily employ inline functions. I chose to remove code previously conditional on PG_USE_INLINE as it seemed confusing to have code dependent on a define that's always defined. Blacklisting of compilers, like in c53f73879f, now has to be done differently. A platform template can define PG_FORCE_DISABLE_INLINE to force inline to be defined empty. Discussion: 20150701161447.GB30708@awork2.anarazel.de
Diffstat (limited to 'src/include/port/atomics/generic-acc.h')
-rw-r--r--src/include/port/atomics/generic-acc.h12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/include/port/atomics/generic-acc.h b/src/include/port/atomics/generic-acc.h
index c5639aadda..c224691782 100644
--- a/src/include/port/atomics/generic-acc.h
+++ b/src/include/port/atomics/generic-acc.h
@@ -49,18 +49,12 @@ typedef struct pg_atomic_uint64
volatile uint64 value;
} pg_atomic_uint64;
-#endif /* defined(HAVE_ATOMICS) */
-
-
-#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
-
-#if defined(HAVE_ATOMICS)
#define MINOR_FENCE (_Asm_fence) (_UP_CALL_FENCE | _UP_SYS_FENCE | \
_DOWN_CALL_FENCE | _DOWN_SYS_FENCE )
#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
-STATIC_IF_INLINE bool
+static inline bool
pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
uint32 *expected, uint32 newval)
{
@@ -88,7 +82,7 @@ pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
-STATIC_IF_INLINE bool
+static inline bool
pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
uint64 *expected, uint64 newval)
{
@@ -110,5 +104,3 @@ pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
#undef MINOR_FENCE
#endif /* defined(HAVE_ATOMICS) */
-
-#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */