fix: stdatomic.h compatibility with gcc -std=c11/c17/...

Newer versions of gcc has __has_feature(x) macro, too, and returns
true on c_atomic, though it does not support Clang-flavored atomic
builtins.
This commit is contained in:
sisungo
2026-02-22 15:52:46 +08:00
parent 58c7494c47
commit 9ed6813222
+3 -3
View File
@@ -49,10 +49,10 @@
#endif
#if !defined(__CLANG_ATOMICS) && !defined(__GNUC_ATOMICS)
#if __has_feature(c_atomic)
#define __CLANG_ATOMICS
#elif __GNUC_PREREQ__(4, 7)
#if __GNUC_PREREQ__(4, 7)
#define __GNUC_ATOMICS
#elif __has_feature(c_atomic)
#define __CLANG_ATOMICS
#elif !defined(__GNUC__)
#error "stdatomic.h does not support your compiler"
#endif