aboutsummaryrefslogtreecommitdiff
path: root/lib/builtins/atomic_flag_test_and_set.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/builtins/atomic_flag_test_and_set.c')
-rw-r--r--lib/builtins/atomic_flag_test_and_set.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/builtins/atomic_flag_test_and_set.c b/lib/builtins/atomic_flag_test_and_set.c
index 07209fc02d5e..e8811d39ef25 100644
--- a/lib/builtins/atomic_flag_test_and_set.c
+++ b/lib/builtins/atomic_flag_test_and_set.c
@@ -12,8 +12,16 @@
*===------------------------------------------------------------------------===
*/
+#ifndef __has_include
+#define __has_include(inc) 0
+#endif
+
+#if __has_include(<stdatomic.h>)
+
#include <stdatomic.h>
#undef atomic_flag_test_and_set
_Bool atomic_flag_test_and_set(volatile atomic_flag *object) {
return __c11_atomic_exchange(&(object)->_Value, 1, __ATOMIC_SEQ_CST);
}
+
+#endif