From e68010573fb2b4149b48324bf305a1f13e490750 Mon Sep 17 00:00:00 2001 From: Trout Zhang Date: Sun, 23 Apr 2023 21:39:20 +0800 Subject: [PATCH] Fix ATOMIC_VAR_INIT deprecation warnings for C17 --- include/mimalloc/atomic.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/mimalloc/atomic.h b/include/mimalloc/atomic.h index d0226029..bd95dd5f 100644 --- a/include/mimalloc/atomic.h +++ b/include/mimalloc/atomic.h @@ -39,7 +39,11 @@ terms of the MIT license. A copy of the license can be found in the file #include #define mi_atomic(name) atomic_##name #define mi_memory_order(name) memory_order_##name -#define MI_ATOMIC_VAR_INIT(x) ATOMIC_VAR_INIT(x) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201710L) // c17, see issue #735 + #define MI_ATOMIC_VAR_INIT(x) x +#else + #define MI_ATOMIC_VAR_INIT(x) ATOMIC_VAR_INIT(x) +#endif #endif // Various defines for all used memory orders in mimalloc