summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-10-15 15:35:22 +0400
committerIvan Maidanski <ivmai@mail.ru>2011-10-17 13:37:57 +0400
commit39aca06f98e10e593f07859dcf5ffce0c61169c4 (patch)
tree29986473a38ad808adda97539ab2141d589a52d5
parent3387faeb2170d44d7ebafa91a6eb22505a692681 (diff)
downloadlibatomic_ops-39aca06f98e10e593f07859dcf5ffce0c61169c4.tar.gz
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.
-rw-r--r--src/atomic_ops/sysdeps/gcc/s390.h4
-rw-r--r--src/atomic_ops/sysdeps/ibmc/powerpc.h24
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();