diff options
author | Daan Leijen <daan@microsoft.com> | 2022-04-08 16:37:08 -0700 |
---|---|---|
committer | Daan Leijen <daan@microsoft.com> | 2022-04-08 16:37:08 -0700 |
commit | 5c7ada4b202a196dcc8c2456bc57a526534f84a5 (patch) | |
tree | 152f6401f9c75c571f35ddd238518e9cd40d1723 /include/mimalloc-atomic.h | |
parent | 185f296513da2bfcdb413f7c4821bf238c35e035 (diff) | |
parent | 674ee63fa741449d348b277eef6d06c268c6f925 (diff) |
Merge branch 'dev' of https://github.com/microsoft/mimalloc into dev
Diffstat (limited to 'include/mimalloc-atomic.h')
-rw-r--r-- | include/mimalloc-atomic.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/mimalloc-atomic.h b/include/mimalloc-atomic.h index e07df84..7ad5da5 100644 --- a/include/mimalloc-atomic.h +++ b/include/mimalloc-atomic.h @@ -23,10 +23,15 @@ terms of the MIT license. A copy of the license can be found in the file #define _Atomic(tp) std::atomic<tp> #define mi_atomic(name) std::atomic_##name #define mi_memory_order(name) std::memory_order_##name +#if !defined(ATOMIC_VAR_INIT) || (__cplusplus >= 202002L) // c++20, see issue #571 + #define MI_ATOMIC_VAR_INIT(x) x +#else + #define MI_ATOMIC_VAR_INIT(x) ATOMIC_VAR_INIT(x) +#endif #elif defined(_MSC_VER) // Use MSVC C wrapper for C11 atomics #define _Atomic(tp) tp -#define ATOMIC_VAR_INIT(x) x +#define MI_ATOMIC_VAR_INIT(x) x #define mi_atomic(name) mi_atomic_##name #define mi_memory_order(name) mi_memory_order_##name #else @@ -34,6 +39,7 @@ terms of the MIT license. A copy of the license can be found in the file #include <stdatomic.h> #define mi_atomic(name) atomic_##name #define mi_memory_order(name) memory_order_##name +#define MI_ATOMIC_VAR_INIT(x) ATOMIC_VAR_INIT(x) #endif // Various defines for all used memory orders in mimalloc |