From 7c1aafb6e13f557c9859d99e5ccb49e35f755d11 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 21 Nov 2019 15:14:45 -0600 Subject: [PATCH] clang: pacify clang wrt ompi use of c11 atomics The clang compiler (or at least the one used by the Cray CCE 9 and newer) doesn't like what we're doing passing non _Atomic pointers to C11 atomics. Fix the ones that keep vader from compiling using Cray CCE 9 and 10. Signed-off-by: Howard Pritchard --- opal/include/opal/sys/atomic_stdc.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/opal/include/opal/sys/atomic_stdc.h b/opal/include/opal/sys/atomic_stdc.h index 584e124114..9b98a131cd 100644 --- a/opal/include/opal/sys/atomic_stdc.h +++ b/opal/include/opal/sys/atomic_stdc.h @@ -5,6 +5,8 @@ * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2019 Google, LLC. All rights reserved. + * Copyright (c) 2019 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -99,9 +101,9 @@ static inline void opal_atomic_rmb (void) #define opal_atomic_compare_exchange_strong_acq(addr, oldval, newval) atomic_compare_exchange_strong_explicit (addr, oldval, newval, memory_order_acquire, memory_order_relaxed) #define opal_atomic_compare_exchange_strong_rel(addr, oldval, newval) atomic_compare_exchange_strong_explicit (addr, oldval, newval, memory_order_release, memory_order_relaxed) -#define opal_atomic_swap_32(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed) -#define opal_atomic_swap_64(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed) -#define opal_atomic_swap_ptr(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed) +#define opal_atomic_swap_32(addr, value) atomic_exchange_explicit ((_Atomic unsigned int *)addr, value, memory_order_relaxed) +#define opal_atomic_swap_64(addr, value) atomic_exchange_explicit ((_Atomic unsigned long *)addr, value, memory_order_relaxed) +#define opal_atomic_swap_ptr(addr, value) atomic_exchange_explicit ((_Atomic unsigned long *)addr, value, memory_order_relaxed) #define OPAL_ATOMIC_STDC_DEFINE_FETCH_OP(op, bits, type, operator) \ static inline type opal_atomic_fetch_ ## op ##_## bits (opal_atomic_ ## type *addr, type value) \