From 1b32f3fbff3efa80320f2bb5b14a3282943aaa37 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sat, 15 Oct 2011 15:35:22 +0400 Subject: [PATCH] Fix AO_compare_and_swap() return type for s390 and PowerPC * src/atomic_ops/sysdeps/gcc/s390.h (AO_compare_and_swap_full): Change return from AO_t to int. * src/atomic_ops/sysdeps/ibmc/powerpc.h (AO_compare_and_swap_acquire, AO_compare_and_swap_release, AO_compare_and_swap_full): Likewise. --- src/atomic_ops/sysdeps/gcc/s390.h | 4 ++-- src/atomic_ops/sysdeps/ibmc/powerpc.h | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/atomic_ops/sysdeps/gcc/s390.h b/src/atomic_ops/sysdeps/gcc/s390.h index b8563e6..c05dc85 100644 --- a/src/atomic_ops/sysdeps/gcc/s390.h +++ b/src/atomic_ops/sysdeps/gcc/s390.h @@ -40,8 +40,8 @@ /* It appears that certain BCR instructions have that effect. */ /* Presumably they're cheaper than CS? */ -AO_INLINE AO_t AO_compare_and_swap_full(volatile AO_t *addr, - AO_t old, AO_t new_val) +AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, + AO_t old, AO_t new_val) { int retval; __asm__ __volatile__ ( diff --git a/src/atomic_ops/sysdeps/ibmc/powerpc.h b/src/atomic_ops/sysdeps/ibmc/powerpc.h index 3e4f539..4378dca 100644 --- a/src/atomic_ops/sysdeps/ibmc/powerpc.h +++ b/src/atomic_ops/sysdeps/ibmc/powerpc.h @@ -85,30 +85,34 @@ AO_test_and_set_full(volatile AO_TS_t *addr) { } #define AO_HAVE_test_and_set_full -/*AO_INLINE AO_t -AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { +/*AO_INLINE int +AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) +{ # error FIXME Implement me } #define AO_HAVE_compare_and_swap*/ -AO_INLINE AO_t -AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { - AO_t result = AO_compare_and_swap(addr, old, new_val); +AO_INLINE int +AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) +{ + int result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_acquire -AO_INLINE AO_t -AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { +AO_INLINE int +AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) +{ AO_lwsync(); return AO_compare_and_swap(addr, old, new_val); } #define AO_HAVE_compare_and_swap_release -AO_INLINE AO_t -AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { - AO_t result; +AO_INLINE int +AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) +{ + int result; AO_lwsync(); result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); -- 2.7.4