diff options
author | Daan <daanl@outlook.com> | 2022-04-08 14:09:38 -0700 |
---|---|---|
committer | Daan <daanl@outlook.com> | 2022-04-08 14:09:38 -0700 |
commit | b7677b6f8482daad8374b2cf5430be2156308063 (patch) | |
tree | c627436efec3138f2577ea06636f999b0973a137 /include | |
parent | 25ecec3c3b77a85f1344bacb6c9538c555b49e12 (diff) |
fix atomic warnings on clang14 (issue #571)
Diffstat (limited to 'include')
-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 |