medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 62cf6b0264ab8fe58a4b9d89fe7f29ff178b801c
parent d92f9546e6ae27c180761290d644e7959570e444
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Thu Sep 15 02:01:43 +0100

Fix non-GCC/CLANG compare_exchange

Diffstat:
platform_atomic.h | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/platform_atomic.h b/platform_atomic.h @@ -96,28 +96,27 @@ struct atomic_u64 { #define store_relaxed( atom, x ) ( atom )->store( x, std::memory_order_relaxed ) #define fetch_add_relaxed( atom, x ) ( atom )->fetch_add( x, std::memory_order_relaxed ) #define exchange_relaxed( atom, x ) ( atom )->exchange( x, std::memory_order_relaxed ) -// TODO: check compare_exchange_strong updates before to be consistent w/ the c11 version -#define compare_exchange_relaxed( atom, before, after ) ( atom )->compare_exchange_strong( before, after, std::memory_order_relaxed, std::memory_order_relaxed ) +#define compare_exchange_relaxed( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_relaxed, std::memory_order_relaxed ) #define load_acquire( atom ) ( atom )->load( std::memory_order_acquire ) #define fetch_add_acquire( atom, x ) ( atom )->fetch_add( x, std::memory_order_acquire ) #define exchange_acquire( atom, x ) ( atom )->exchange( x, std::memory_order_acquire ) -#define compare_exchange_acquire( atom, before, after ) ( atom )->compare_exchange_strong( before, after, std::memory_order_acquire, std::memory_order_acquire ) +#define compare_exchange_acquire( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_acquire, std::memory_order_acquire ) #define store_release( atom, x ) ( atom )->store( x, std::memory_order_release ) #define fetch_add_release( atom, x ) ( atom )->fetch_add( x, std::memory_order_release ) #define exchange_release( atom, x ) ( atom )->exchange( x, std::memory_order_release ) -#define compare_exchange_release( atom, before, after ) ( atom )->compare_exchange_strong( before, after, std::memory_order_release, std::memory_order_relaxed ) +#define compare_exchange_release( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_release, std::memory_order_relaxed ) #define fetch_add_acqrel( atom, x ) ( atom )->fetch_add( x, std::memory_order_acq_rel ) #define exchange_acqrel( atom, x ) ( atom )->exchange( x, std::memory_order_acq_rel ) -#define compare_exchange_acqrel( atom, before, after ) ( atom )->compare_exchange_strong( before, after, std::memory_order_acq_rel, std::memory_order_acquire ) +#define compare_exchange_acqrel( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_acq_rel, std::memory_order_acquire ) #define load_seqcst( atom ) ( atom )->load( std::memory_order_seq_cst ) #define store_seqcst( atom, x ) ( atom )->store( x, std::memory_order_seq_cst ) #define fetch_add_seqcst( atom, x ) ( atom )->fetch_add( x, std::memory_order_seq_cst ) #define exchange_seqcst( atom, x ) ( atom )->exchange( x, std::memory_order_seq_cst ) -#define compare_exchange_seqcst( atom, before, after ) ( atom )->compare_exchange_strong( before, after, std::memory_order_seq_cst, std::memory_order_seq_cst ) +#define compare_exchange_seqcst( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_seq_cst, std::memory_order_seq_cst ) // relacy requires C++98 which doesn't have static_assert // TODO: maybe this should go somewhere else?