@@ -31,11 +31,19 @@ extern "C" {
3131
3232/* -- Definitions -- */
3333
34- #if defined(__STDC_VERSION__ )
35- #if __STDC_VERSION__ - 0L >= 201112L
34+ #if defined(_WIN32 ) && defined(_MSC_VER )
35+ #if (_MSC_VER < 1930 || defined(__STDC_NO_ATOMICS__ ))
36+ /* Before Visual Studio 2022 atomics are not supported, use fallback solution */
37+ #include <threading/threading_atomic_win32.h>
38+ #define THREADING_ATOMIC 1
39+ #else
40+ #include <stdatomic.h>
41+ #define THREADING_ATOMIC 1
42+ #endif
43+ #elif defined(__STDC_VERSION__ )
44+ #if (__STDC_VERSION__ - 0L ) >= 201112L
3645 /* C11 support */
3746 #if defined(__STDC_NO_ATOMICS__ )
38- /* TODO: Using C11 but atomics not supported, check the platform and implement support if needed */
3947 #define THREADING_ATOMIC 0
4048 #error "Using C11 but atomics not supported, check the platform and implement support"
4149 #elif defined __has_include
@@ -48,19 +56,9 @@ extern "C" {
4856 #define THREADING_ATOMIC 1
4957 #endif
5058 #else
51- /* TODO: C11 is not supported, check the platform and implement support if needed */
5259 #define THREADING_ATOMIC 0
5360 #error "C11 is not supported, check the platform and implement support"
5461 #endif
55- #elif defined(_WIN32) && defined(_MSC_VER)
56- #if (_MSC_VER < 1930 )
57- /* Before Visual Studio 2022 atomics are not supported, use fallback solution */
58- #include <threading/threading_atomic_win32.h>
59- #define THREADING_ATOMIC 1
60- #else
61- #include <stdatomic.h>
62- #define THREADING_ATOMIC 1
63- #endif
6462#else
6563 /* TODO: Unknown compiler and platform, check the platform and compiler, then implement support if needed */
6664 #define THREADING_ATOMIC 0
0 commit comments