From ed81649a07729dc348c31612e2acad7f5f759136 Mon Sep 17 00:00:00 2001 From: Olivier Dion Date: Mon, 2 Dec 2024 14:41:30 -0500 Subject: [PATCH] Fix compilation errors CMM_{STORE,LOAD}_SHARED() accept expressions. However, uatomic_{load,store} accept address. To pass from the latter to the former, a dereference is necessary. Furthermore, the C11 compatibility layer for x86.h on store operations was wrongly named after the `set' operation. Change-Id: Icb1468de3de4878b5744e632314aa8332ad7fe26 Signed-off-by: Olivier Dion Signed-off-by: Mathieu Desnoyers --- include/urcu/uatomic/generic.h | 4 ++-- include/urcu/uatomic/x86.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/urcu/uatomic/generic.h b/include/urcu/uatomic/generic.h index e32f179..5a81e00 100644 --- a/include/urcu/uatomic/generic.h +++ b/include/urcu/uatomic/generic.h @@ -95,7 +95,7 @@ extern "C" { # define uatomic_store_mo(addr, v, mo) \ do { \ _cmm_compat_c11_smp_mb__before_mo(uatomic_store, mo); \ - (void) CMM_STORE_SHARED(addr, v); \ + (void) CMM_STORE_SHARED(*(addr), v); \ _cmm_compat_c11_smp_mb__after_mo(uatomic_store, mo); \ } while (0) # endif /* _CMM_TOOLCHAIN_SUPPORT_C11_MM */ @@ -124,7 +124,7 @@ extern "C" { __extension__ \ ({ \ _cmm_compat_c11_smp_mb__before_mo(uatomic_load, mo); \ - __typeof__(*(addr)) _rcu_value = CMM_LOAD_SHARED(addr); \ + __typeof__(*(addr)) _rcu_value = CMM_LOAD_SHARED(*(addr)); \ _cmm_compat_c11_smp_mb__after_mo(uatomic_load, mo); \ \ _rcu_value; \ diff --git a/include/urcu/uatomic/x86.h b/include/urcu/uatomic/x86.h index 5afb447..4706458 100644 --- a/include/urcu/uatomic/x86.h +++ b/include/urcu/uatomic/x86.h @@ -693,7 +693,7 @@ static inline void _cmm_compat_c11_smp_mb__after_uatomic_load_mo(enum cmm_memord } } -static inline void _cmm_compat_c11_smp_mb__before_uatomic_set_mo(enum cmm_memorder mo) +static inline void _cmm_compat_c11_smp_mb__before_uatomic_store_mo(enum cmm_memorder mo) { /* * A SMP barrier is not necessary for CMM_SEQ_CST because the store can @@ -718,7 +718,7 @@ static inline void _cmm_compat_c11_smp_mb__before_uatomic_set_mo(enum cmm_memord } } -static inline void _cmm_compat_c11_smp_mb__after_uatomic_set_mo(enum cmm_memorder mo) +static inline void _cmm_compat_c11_smp_mb__after_uatomic_store_mo(enum cmm_memorder mo) { /* * A SMP barrier is necessary for CMM_SEQ_CST because the store can be -- 2.39.5