summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/stdatomic/ATOMIC_BOOL_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_CHAR16_T_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_CHAR32_T_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_CHAR_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_FLAG_INIT.h1
-rw-r--r--src/stdatomic/ATOMIC_INT_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_LLONG_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_LONG_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_POINTER_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_SHORT_LOCK_FREE.c1
-rw-r--r--src/stdatomic/ATOMIC_VAR_INIT.h1
-rw-r--r--src/stdatomic/ATOMIC_WCHAR_T_LOCK_FREE.c1
-rw-r--r--src/stdatomic/__types.sh37
-rw-r--r--src/stdatomic/__types.txt37
-rw-r--r--src/stdatomic/__types2defs.awk6
-rw-r--r--src/stdatomic/atomic_bool.c1
-rw-r--r--src/stdatomic/atomic_char.c1
-rw-r--r--src/stdatomic/atomic_char16_t.c1
-rw-r--r--src/stdatomic/atomic_char32_t.c1
-rw-r--r--src/stdatomic/atomic_compare_exchange_strong.c13
-rw-r--r--src/stdatomic/atomic_compare_exchange_strong_explicit.c23
-rw-r--r--src/stdatomic/atomic_compare_exchange_weak.c13
-rw-r--r--src/stdatomic/atomic_compare_exchange_weak_explicit.c23
-rw-r--r--src/stdatomic/atomic_exchange.c6
-rw-r--r--src/stdatomic/atomic_exchange_explicit.c11
-rw-r--r--src/stdatomic/atomic_fetch_add.c0
-rw-r--r--src/stdatomic/atomic_fetch_add_explicit.c0
-rw-r--r--src/stdatomic/atomic_fetch_and.c0
-rw-r--r--src/stdatomic/atomic_fetch_and_explicit.c0
-rw-r--r--src/stdatomic/atomic_fetch_or.c0
-rw-r--r--src/stdatomic/atomic_fetch_or_explicit.c0
-rw-r--r--src/stdatomic/atomic_fetch_sub.c0
-rw-r--r--src/stdatomic/atomic_fetch_sub_explicit.c0
-rw-r--r--src/stdatomic/atomic_fetch_xor.c0
-rw-r--r--src/stdatomic/atomic_fetch_xor_explicit.c0
-rw-r--r--src/stdatomic/atomic_flag.c2
-rw-r--r--src/stdatomic/atomic_flag_clear.c6
-rw-r--r--src/stdatomic/atomic_flag_clear_explicit.c7
-rw-r--r--src/stdatomic/atomic_flag_test_and_set.c8
-rw-r--r--src/stdatomic/atomic_flag_test_and_set_explicit.c9
-rw-r--r--src/stdatomic/atomic_init.c6
-rw-r--r--src/stdatomic/atomic_int.c1
-rw-r--r--src/stdatomic/atomic_int_fast16_t.c1
-rw-r--r--src/stdatomic/atomic_int_fast32_t.c1
-rw-r--r--src/stdatomic/atomic_int_fast64_t.c1
-rw-r--r--src/stdatomic/atomic_int_fast8_t.c1
-rw-r--r--src/stdatomic/atomic_int_least16_t.c1
-rw-r--r--src/stdatomic/atomic_int_least32_t.c1
-rw-r--r--src/stdatomic/atomic_int_least64_t.c1
-rw-r--r--src/stdatomic/atomic_int_least8_t.c1
-rw-r--r--src/stdatomic/atomic_intmax_t.c1
-rw-r--r--src/stdatomic/atomic_intptr_t.c1
-rw-r--r--src/stdatomic/atomic_is_lock_free.c7
-rw-r--r--src/stdatomic/atomic_llong.c1
-rw-r--r--src/stdatomic/atomic_load.c6
-rw-r--r--src/stdatomic/atomic_load_explicit.c17
-rw-r--r--src/stdatomic/atomic_long.c1
-rw-r--r--src/stdatomic/atomic_ptrdiff_t.c1
-rw-r--r--src/stdatomic/atomic_schar.c1
-rw-r--r--src/stdatomic/atomic_short.c1
-rw-r--r--src/stdatomic/atomic_signal_fence.c26
-rw-r--r--src/stdatomic/atomic_size_t.c1
-rw-r--r--src/stdatomic/atomic_store.c6
-rw-r--r--src/stdatomic/atomic_store_explicit.c17
-rw-r--r--src/stdatomic/atomic_thread_fence.c26
-rw-r--r--src/stdatomic/atomic_uchar.c1
-rw-r--r--src/stdatomic/atomic_uint.c1
-rw-r--r--src/stdatomic/atomic_uint_fast16_t.c1
-rw-r--r--src/stdatomic/atomic_uint_fast32_t.c1
-rw-r--r--src/stdatomic/atomic_uint_fast64_t.c1
-rw-r--r--src/stdatomic/atomic_uint_fast8_t.c1
-rw-r--r--src/stdatomic/atomic_uint_least16_t.c1
-rw-r--r--src/stdatomic/atomic_uint_least32_t.c1
-rw-r--r--src/stdatomic/atomic_uint_least64_t.c1
-rw-r--r--src/stdatomic/atomic_uint_least8_t.c1
-rw-r--r--src/stdatomic/atomic_uintmax_t.c1
-rw-r--r--src/stdatomic/atomic_uintptr_t.c1
-rw-r--r--src/stdatomic/atomic_ullong.c1
-rw-r--r--src/stdatomic/atomic_ulong.c1
-rw-r--r--src/stdatomic/atomic_ushort.c1
-rw-r--r--src/stdatomic/atomic_wchar_t.c1
-rw-r--r--src/stdatomic/kill_dependency.h1
-rw-r--r--src/stdatomic/memory_order.h8
83 files changed, 370 insertions, 0 deletions
diff --git a/src/stdatomic/ATOMIC_BOOL_LOCK_FREE.c b/src/stdatomic/ATOMIC_BOOL_LOCK_FREE.c
new file mode 100644
index 00000000..b5e024f0
--- /dev/null
+++ b/src/stdatomic/ATOMIC_BOOL_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_BOOL_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_CHAR16_T_LOCK_FREE.c b/src/stdatomic/ATOMIC_CHAR16_T_LOCK_FREE.c
new file mode 100644
index 00000000..3cccfddb
--- /dev/null
+++ b/src/stdatomic/ATOMIC_CHAR16_T_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_CHAR_16_T_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_CHAR32_T_LOCK_FREE.c b/src/stdatomic/ATOMIC_CHAR32_T_LOCK_FREE.c
new file mode 100644
index 00000000..36194c3e
--- /dev/null
+++ b/src/stdatomic/ATOMIC_CHAR32_T_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_CHAR32_T_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_CHAR_LOCK_FREE.c b/src/stdatomic/ATOMIC_CHAR_LOCK_FREE.c
new file mode 100644
index 00000000..05a512c0
--- /dev/null
+++ b/src/stdatomic/ATOMIC_CHAR_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_CHAR_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_FLAG_INIT.h b/src/stdatomic/ATOMIC_FLAG_INIT.h
new file mode 100644
index 00000000..322c3720
--- /dev/null
+++ b/src/stdatomic/ATOMIC_FLAG_INIT.h
@@ -0,0 +1 @@
+#define ATOMIC_FLAG_INIT (0)
diff --git a/src/stdatomic/ATOMIC_INT_LOCK_FREE.c b/src/stdatomic/ATOMIC_INT_LOCK_FREE.c
new file mode 100644
index 00000000..84a83ca2
--- /dev/null
+++ b/src/stdatomic/ATOMIC_INT_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_INT_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_LLONG_LOCK_FREE.c b/src/stdatomic/ATOMIC_LLONG_LOCK_FREE.c
new file mode 100644
index 00000000..5f85e906
--- /dev/null
+++ b/src/stdatomic/ATOMIC_LLONG_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_LLONG_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_LONG_LOCK_FREE.c b/src/stdatomic/ATOMIC_LONG_LOCK_FREE.c
new file mode 100644
index 00000000..5d75eb30
--- /dev/null
+++ b/src/stdatomic/ATOMIC_LONG_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_LONG_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_POINTER_LOCK_FREE.c b/src/stdatomic/ATOMIC_POINTER_LOCK_FREE.c
new file mode 100644
index 00000000..0d4dddd1
--- /dev/null
+++ b/src/stdatomic/ATOMIC_POINTER_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_POINTER_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_SHORT_LOCK_FREE.c b/src/stdatomic/ATOMIC_SHORT_LOCK_FREE.c
new file mode 100644
index 00000000..30ef612d
--- /dev/null
+++ b/src/stdatomic/ATOMIC_SHORT_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_SHORT_LOCK_FREE (1)
diff --git a/src/stdatomic/ATOMIC_VAR_INIT.h b/src/stdatomic/ATOMIC_VAR_INIT.h
new file mode 100644
index 00000000..8159ef69
--- /dev/null
+++ b/src/stdatomic/ATOMIC_VAR_INIT.h
@@ -0,0 +1 @@
+#define ATOMIC_VAR_INIT(__value) (__value)
diff --git a/src/stdatomic/ATOMIC_WCHAR_T_LOCK_FREE.c b/src/stdatomic/ATOMIC_WCHAR_T_LOCK_FREE.c
new file mode 100644
index 00000000..ed616a2d
--- /dev/null
+++ b/src/stdatomic/ATOMIC_WCHAR_T_LOCK_FREE.c
@@ -0,0 +1 @@
+#define ATOMIC_WCHAR_T_LOCK_FREE (1)
diff --git a/src/stdatomic/__types.sh b/src/stdatomic/__types.sh
new file mode 100644
index 00000000..297e7a19
--- /dev/null
+++ b/src/stdatomic/__types.sh
@@ -0,0 +1,37 @@
+echo 'typedef _Atomic _Bool atomic_bool;' > atomic_bool.c
+echo 'typedef _Atomic char atomic_char;' > atomic_char.c
+echo 'typedef _Atomic signed char atomic_schar;' > atomic_schar.c
+echo 'typedef _Atomic unsigned char atomic_uchar;' > atomic_uchar.c
+echo 'typedef _Atomic short atomic_short;' > atomic_short.c
+echo 'typedef _Atomic unsigned short atomic_ushort;' > atomic_ushort.c
+echo 'typedef _Atomic int atomic_int;' > atomic_int.c
+echo 'typedef _Atomic unsigned int atomic_uint;' > atomic_uint.c
+echo 'typedef _Atomic long atomic_long;' > atomic_long.c
+echo 'typedef _Atomic unsigned long atomic_ulong;' > atomic_ulong.c
+echo 'typedef _Atomic llong atomic_llong;' > atomic_llong.c
+echo 'typedef _Atomic unsigned long long atomic_ullong;' > atomic_ullong.c
+echo 'typedef _Atomic char16_t atomic_char16_t;' > atomic_char16_t.c
+echo 'typedef _Atomic char32_t atomic_char32_t;' > atomic_char32_t.c
+echo 'typedef _Atomic wchar_t atomic_wchar_t;' > atomic_wchar_t.c
+echo 'typedef _Atomic int_least8_t atomic_int_least8_t;' > atomic_int_least8_t.c
+echo 'typedef _Atomic uint_least8_t atomic_uint_least8_t;' > atomic_uint_least8_t.c
+echo 'typedef _Atomic int_least16_t atomic_int_least16_t;' > atomic_int_least16_t.c
+echo 'typedef _Atomic uint_least16_t atomic_uint_least16_t;' > atomic_uint_least16_t.c
+echo 'typedef _Atomic int_least32_t atomic_int_least32_t;' > atomic_int_least32_t.c
+echo 'typedef _Atomic uint_least32_t atomic_uint_least32_t;' > atomic_uint_least32_t.c
+echo 'typedef _Atomic int_least64_t atomic_int_least64_t;' > atomic_int_least64_t.c
+echo 'typedef _Atomic uint_least64_t atomic_uint_least64_t;' > atomic_uint_least64_t.c
+echo 'typedef _Atomic int_fast8_t atomic_int_fast8_t;' > atomic_int_fast8_t.c
+echo 'typedef _Atomic uint_fast8_t atomic_uint_fast8_t;' > atomic_uint_fast8_t.c
+echo 'typedef _Atomic int_fast16_t atomic_int_fast16_t;' > atomic_int_fast16_t.c
+echo 'typedef _Atomic uint_fast16_t atomic_uint_fast16_t;' > atomic_uint_fast16_t.c
+echo 'typedef _Atomic int_fast32_t atomic_int_fast32_t;' > atomic_int_fast32_t.c
+echo 'typedef _Atomic uint_fast32_t atomic_uint_fast32_t;' > atomic_uint_fast32_t.c
+echo 'typedef _Atomic int_fast64_t atomic_int_fast64_t;' > atomic_int_fast64_t.c
+echo 'typedef _Atomic uint_fast64_t atomic_uint_fast64_t;' > atomic_uint_fast64_t.c
+echo 'typedef _Atomic intptr_t atomic_intptr_t;' > atomic_intptr_t.c
+echo 'typedef _Atomic uintptr_t atomic_uintptr_t;' > atomic_uintptr_t.c
+echo 'typedef _Atomic size_t atomic_size_t;' > atomic_size_t.c
+echo 'typedef _Atomic ptrdiff_t atomic_ptrdiff_t;' > atomic_ptrdiff_t.c
+echo 'typedef _Atomic intmax_t atomic_intmax_t;' > atomic_intmax_t.c
+echo 'typedef _Atomic uintmax_t atomic_uintmax_t;' > atomic_uintmax_t.c
diff --git a/src/stdatomic/__types.txt b/src/stdatomic/__types.txt
new file mode 100644
index 00000000..a1bdb3b2
--- /dev/null
+++ b/src/stdatomic/__types.txt
@@ -0,0 +1,37 @@
+bool _Bool
+char
+schar signed char
+uchar unsigned char
+short
+ushort unsigned short
+int
+uint unsigned int
+long
+ulong unsigned long
+llong
+ullong unsigned long long
+char16_t
+char32_t
+wchar_t
+int_least8_t
+uint_least8_t
+int_least16_t
+uint_least16_t
+int_least32_t
+uint_least32_t
+int_least64_t
+uint_least64_t
+int_fast8_t
+uint_fast8_t
+int_fast16_t
+uint_fast16_t
+int_fast32_t
+uint_fast32_t
+int_fast64_t
+uint_fast64_t
+intptr_t
+uintptr_t
+size_t
+ptrdiff_t
+intmax_t
+uintmax_t
diff --git a/src/stdatomic/__types2defs.awk b/src/stdatomic/__types2defs.awk
new file mode 100644
index 00000000..dab85e1e
--- /dev/null
+++ b/src/stdatomic/__types2defs.awk
@@ -0,0 +1,6 @@
+BEGIN {
+ FS = "\t";
+}
+
+NF == 2 { printf("echo 'typedef _Atomic %s atomic_%s;' > atomic_%s.c\n", $2, $1, $1); }
+NF == 1 { printf("echo 'typedef _Atomic %s atomic_%s;' > atomic_%s.c\n", $1, $1, $1); }
diff --git a/src/stdatomic/atomic_bool.c b/src/stdatomic/atomic_bool.c
new file mode 100644
index 00000000..a8c73d6b
--- /dev/null
+++ b/src/stdatomic/atomic_bool.c
@@ -0,0 +1 @@
+typedef _Atomic _Bool atomic_bool;
diff --git a/src/stdatomic/atomic_char.c b/src/stdatomic/atomic_char.c
new file mode 100644
index 00000000..e7e2b659
--- /dev/null
+++ b/src/stdatomic/atomic_char.c
@@ -0,0 +1 @@
+typedef _Atomic char atomic_char;
diff --git a/src/stdatomic/atomic_char16_t.c b/src/stdatomic/atomic_char16_t.c
new file mode 100644
index 00000000..e160909f
--- /dev/null
+++ b/src/stdatomic/atomic_char16_t.c
@@ -0,0 +1 @@
+typedef _Atomic char16_t atomic_char16_t;
diff --git a/src/stdatomic/atomic_char32_t.c b/src/stdatomic/atomic_char32_t.c
new file mode 100644
index 00000000..188e7de8
--- /dev/null
+++ b/src/stdatomic/atomic_char32_t.c
@@ -0,0 +1 @@
+typedef _Atomic char32_t atomic_char32_t;
diff --git a/src/stdatomic/atomic_compare_exchange_strong.c b/src/stdatomic/atomic_compare_exchange_strong.c
new file mode 100644
index 00000000..43877395
--- /dev/null
+++ b/src/stdatomic/atomic_compare_exchange_strong.c
@@ -0,0 +1,13 @@
+#include <stdatomic.h>
+#include <stdbool.h>
+
+_Bool atomic_compare_exchange_strong(volatile __TYPE *object, __BASE *expected, __BASE desired)
+{
+ if (memcmp(object, expected, sizeof(*object)) == 0) {
+ memcpy(object, &desired, sizeof(*object));
+ return true;
+ }
+
+ memcpy(expected, object, sizeof(*object));
+ return false;
+}
diff --git a/src/stdatomic/atomic_compare_exchange_strong_explicit.c b/src/stdatomic/atomic_compare_exchange_strong_explicit.c
new file mode 100644
index 00000000..6e63cd13
--- /dev/null
+++ b/src/stdatomic/atomic_compare_exchange_strong_explicit.c
@@ -0,0 +1,23 @@
+#include <stdatomic.h>
+#include <stdbool.h>
+
+_Bool atomic_compare_exchange_strong_explicit(volatile __TYPE *object, __BASE *expected, __BASE desired, memory_order failure)
+{
+ switch (failure) {
+ case memory_order_release:
+ case memory_order_acq_rel:
+ abort();
+ break;
+
+ default:
+ break;
+ }
+
+ if (memcmp(object, expected, sizeof(*object)) == 0) {
+ memcpy(object, &desired, sizeof(*object));
+ return true;
+ }
+
+ memcpy(expected, object, sizeof(*object));
+ return false;
+}
diff --git a/src/stdatomic/atomic_compare_exchange_weak.c b/src/stdatomic/atomic_compare_exchange_weak.c
new file mode 100644
index 00000000..e123304e
--- /dev/null
+++ b/src/stdatomic/atomic_compare_exchange_weak.c
@@ -0,0 +1,13 @@
+#include <stdatomic.h>
+#include <stdbool.h>
+
+_Bool atomic_compare_exchange_weak(volatile __TYPE *object, __BASE *expected, __BASE desired)
+{
+ if (memcmp(object, expected, sizeof(*object)) == 0) {
+ memcpy(object, &desired, sizeof(*object));
+ return true;
+ }
+
+ memcpy(expected, object, sizeof(*object));
+ return false;
+}
diff --git a/src/stdatomic/atomic_compare_exchange_weak_explicit.c b/src/stdatomic/atomic_compare_exchange_weak_explicit.c
new file mode 100644
index 00000000..74a4836c
--- /dev/null
+++ b/src/stdatomic/atomic_compare_exchange_weak_explicit.c
@@ -0,0 +1,23 @@
+#include <stdatomic.h>
+#include <stdbool.h>
+
+_Bool atomic_compare_exchange_weak_explicit(volatile __TYPE *object, __BASE *expected, __BASE desired, memory_order failure)
+{
+ switch (failure) {
+ case memory_order_release:
+ case memory_order_acq_rel:
+ abort();
+ break;
+
+ default:
+ break;
+ }
+
+ if (memcmp(object, expected, sizeof(*object)) == 0) {
+ memcpy(object, &desired, sizeof(*object));
+ return true;
+ }
+
+ memcpy(expected, object, sizeof(*object));
+ return false;
+}
diff --git a/src/stdatomic/atomic_exchange.c b/src/stdatomic/atomic_exchange.c
new file mode 100644
index 00000000..f5124d18
--- /dev/null
+++ b/src/stdatomic/atomic_exchange.c
@@ -0,0 +1,6 @@
+#include <stdatomic.h>
+
+__BASE atomic_exchange(volatile __TYPE *object, __BASE desired)
+{
+ return *object = desired;
+}
diff --git a/src/stdatomic/atomic_exchange_explicit.c b/src/stdatomic/atomic_exchange_explicit.c
new file mode 100644
index 00000000..392f5ee9
--- /dev/null
+++ b/src/stdatomic/atomic_exchange_explicit.c
@@ -0,0 +1,11 @@
+#include <stdatomic.h>
+
+__BASE atomic_exchange_explicit(volatile __TYPE *object, __BASE desired, memory_order order)
+{
+ switch (order) {
+ default:
+ break;
+ }
+
+ return *object = desired;
+}
diff --git a/src/stdatomic/atomic_fetch_add.c b/src/stdatomic/atomic_fetch_add.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_add.c
diff --git a/src/stdatomic/atomic_fetch_add_explicit.c b/src/stdatomic/atomic_fetch_add_explicit.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_add_explicit.c
diff --git a/src/stdatomic/atomic_fetch_and.c b/src/stdatomic/atomic_fetch_and.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_and.c
diff --git a/src/stdatomic/atomic_fetch_and_explicit.c b/src/stdatomic/atomic_fetch_and_explicit.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_and_explicit.c
diff --git a/src/stdatomic/atomic_fetch_or.c b/src/stdatomic/atomic_fetch_or.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_or.c
diff --git a/src/stdatomic/atomic_fetch_or_explicit.c b/src/stdatomic/atomic_fetch_or_explicit.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_or_explicit.c
diff --git a/src/stdatomic/atomic_fetch_sub.c b/src/stdatomic/atomic_fetch_sub.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_sub.c
diff --git a/src/stdatomic/atomic_fetch_sub_explicit.c b/src/stdatomic/atomic_fetch_sub_explicit.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_sub_explicit.c
diff --git a/src/stdatomic/atomic_fetch_xor.c b/src/stdatomic/atomic_fetch_xor.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_xor.c
diff --git a/src/stdatomic/atomic_fetch_xor_explicit.c b/src/stdatomic/atomic_fetch_xor_explicit.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/stdatomic/atomic_fetch_xor_explicit.c
diff --git a/src/stdatomic/atomic_flag.c b/src/stdatomic/atomic_flag.c
new file mode 100644
index 00000000..9643dd30
--- /dev/null
+++ b/src/stdatomic/atomic_flag.c
@@ -0,0 +1,2 @@
+typedef _Atomic _Bool
+ atomic_flag;
diff --git a/src/stdatomic/atomic_flag_clear.c b/src/stdatomic/atomic_flag_clear.c
new file mode 100644
index 00000000..6d0de3a9
--- /dev/null
+++ b/src/stdatomic/atomic_flag_clear.c
@@ -0,0 +1,6 @@
+#include <stdatomic.h>
+
+void atomic_flag_clear(volatile atomic_flag *object)
+{
+ *object = 0;
+}
diff --git a/src/stdatomic/atomic_flag_clear_explicit.c b/src/stdatomic/atomic_flag_clear_explicit.c
new file mode 100644
index 00000000..ab24c1d5
--- /dev/null
+++ b/src/stdatomic/atomic_flag_clear_explicit.c
@@ -0,0 +1,7 @@
+#include <stdatomic.h>
+
+void atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order)
+{
+ (void)order;
+ *object = 0;
+}
diff --git a/src/stdatomic/atomic_flag_test_and_set.c b/src/stdatomic/atomic_flag_test_and_set.c
new file mode 100644
index 00000000..9cc641cc
--- /dev/null
+++ b/src/stdatomic/atomic_flag_test_and_set.c
@@ -0,0 +1,8 @@
+#include <stdatomic.h>
+
+_Bool atomic_flag_test_and_set(volatile atomic_flag *object)
+{
+ _Bool r = (*object == 1);
+ *object == 1;
+ return r;
+}
diff --git a/src/stdatomic/atomic_flag_test_and_set_explicit.c b/src/stdatomic/atomic_flag_test_and_set_explicit.c
new file mode 100644
index 00000000..f5672471
--- /dev/null
+++ b/src/stdatomic/atomic_flag_test_and_set_explicit.c
@@ -0,0 +1,9 @@
+#include <stdatomic.h>
+
+_Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order)
+{
+ (void)order;
+ _Bool r = (*object == 1);
+ *object = 1;
+ return r;
+}
diff --git a/src/stdatomic/atomic_init.c b/src/stdatomic/atomic_init.c
new file mode 100644
index 00000000..13b08963
--- /dev/null
+++ b/src/stdatomic/atomic_init.c
@@ -0,0 +1,6 @@
+#include <stdatomic.h>
+
+void atomic_init(volatile __TYPE *obj, __BASE value)
+{
+ *obj = ATOMIC_VAR_INIT(value);
+}
diff --git a/src/stdatomic/atomic_int.c b/src/stdatomic/atomic_int.c
new file mode 100644
index 00000000..ad2d8f19
--- /dev/null
+++ b/src/stdatomic/atomic_int.c
@@ -0,0 +1 @@
+typedef _Atomic int atomic_int;
diff --git a/src/stdatomic/atomic_int_fast16_t.c b/src/stdatomic/atomic_int_fast16_t.c
new file mode 100644
index 00000000..927cc76c
--- /dev/null
+++ b/src/stdatomic/atomic_int_fast16_t.c
@@ -0,0 +1 @@
+typedef _Atomic int_fast16_t atomic_int_fast16_t;
diff --git a/src/stdatomic/atomic_int_fast32_t.c b/src/stdatomic/atomic_int_fast32_t.c
new file mode 100644
index 00000000..c5165f45
--- /dev/null
+++ b/src/stdatomic/atomic_int_fast32_t.c
@@ -0,0 +1 @@
+typedef _Atomic int_fast32_t atomic_int_fast32_t;
diff --git a/src/stdatomic/atomic_int_fast64_t.c b/src/stdatomic/atomic_int_fast64_t.c
new file mode 100644
index 00000000..d426618c
--- /dev/null
+++ b/src/stdatomic/atomic_int_fast64_t.c
@@ -0,0 +1 @@
+typedef _Atomic int_fast64_t atomic_int_fast64_t;
diff --git a/src/stdatomic/atomic_int_fast8_t.c b/src/stdatomic/atomic_int_fast8_t.c
new file mode 100644
index 00000000..6da67f5c
--- /dev/null
+++ b/src/stdatomic/atomic_int_fast8_t.c
@@ -0,0 +1 @@
+typedef _Atomic int_fast8_t atomic_int_fast8_t;
diff --git a/src/stdatomic/atomic_int_least16_t.c b/src/stdatomic/atomic_int_least16_t.c
new file mode 100644
index 00000000..9f530eee
--- /dev/null
+++ b/src/stdatomic/atomic_int_least16_t.c
@@ -0,0 +1 @@
+typedef _Atomic int_least16_t atomic_int_least16_t;
diff --git a/src/stdatomic/atomic_int_least32_t.c b/src/stdatomic/atomic_int_least32_t.c
new file mode 100644
index 00000000..9a4ccbc3
--- /dev/null
+++ b/src/stdatomic/atomic_int_least32_t.c
@@ -0,0 +1 @@
+typedef _Atomic int_least32_t atomic_int_least32_t;
diff --git a/src/stdatomic/atomic_int_least64_t.c b/src/stdatomic/atomic_int_least64_t.c
new file mode 100644
index 00000000..c537446f
--- /dev/null
+++ b/src/stdatomic/atomic_int_least64_t.c
@@ -0,0 +1 @@
+typedef _Atomic int_least64_t atomic_int_least64_t;
diff --git a/src/stdatomic/atomic_int_least8_t.c b/src/stdatomic/atomic_int_least8_t.c
new file mode 100644
index 00000000..98d976e3
--- /dev/null
+++ b/src/stdatomic/atomic_int_least8_t.c
@@ -0,0 +1 @@
+typedef _Atomic int_least8_t atomic_int_least8_t;
diff --git a/src/stdatomic/atomic_intmax_t.c b/src/stdatomic/atomic_intmax_t.c
new file mode 100644
index 00000000..ecf22444
--- /dev/null
+++ b/src/stdatomic/atomic_intmax_t.c
@@ -0,0 +1 @@
+typedef _Atomic intmax_t atomic_intmax_t;
diff --git a/src/stdatomic/atomic_intptr_t.c b/src/stdatomic/atomic_intptr_t.c
new file mode 100644
index 00000000..86ad6731
--- /dev/null
+++ b/src/stdatomic/atomic_intptr_t.c
@@ -0,0 +1 @@
+typedef _Atomic intptr_t atomic_intptr_t;
diff --git a/src/stdatomic/atomic_is_lock_free.c b/src/stdatomic/atomic_is_lock_free.c
new file mode 100644
index 00000000..9fffe7a1
--- /dev/null
+++ b/src/stdatomic/atomic_is_lock_free.c
@@ -0,0 +1,7 @@
+#include <stdatomic.h>
+
+_Bool atomic_is_lock_free(const volatile __TYPE *obj)
+{
+ (void)obj;
+ return 1;
+}
diff --git a/src/stdatomic/atomic_llong.c b/src/stdatomic/atomic_llong.c
new file mode 100644
index 00000000..af3fcf60
--- /dev/null
+++ b/src/stdatomic/atomic_llong.c
@@ -0,0 +1 @@
+typedef _Atomic llong atomic_llong;
diff --git a/src/stdatomic/atomic_load.c b/src/stdatomic/atomic_load.c
new file mode 100644
index 00000000..7a181a2b
--- /dev/null
+++ b/src/stdatomic/atomic_load.c
@@ -0,0 +1,6 @@
+#include <stdatomic.h>
+
+__BASE atomic_store(const volatile __TYPE *object)
+{
+ return *object;
+}
diff --git a/src/stdatomic/atomic_load_explicit.c b/src/stdatomic/atomic_load_explicit.c
new file mode 100644
index 00000000..f491407f
--- /dev/null
+++ b/src/stdatomic/atomic_load_explicit.c
@@ -0,0 +1,17 @@
+#include <stdatomic.h>
+
+__BASE atomic_load_explicit(const volatile __TYPE *object, memory_order order)
+{
+ switch (order) {
+ case memory_order_acquire:
+ case memory_order_consume:
+ case memory_order_acq_rel:
+ abort();
+ break;
+
+ default:
+ break;
+ }
+
+ return *object;
+}
diff --git a/src/stdatomic/atomic_long.c b/src/stdatomic/atomic_long.c
new file mode 100644
index 00000000..b3237c17
--- /dev/null
+++ b/src/stdatomic/atomic_long.c
@@ -0,0 +1 @@
+typedef _Atomic long atomic_long;
diff --git a/src/stdatomic/atomic_ptrdiff_t.c b/src/stdatomic/atomic_ptrdiff_t.c
new file mode 100644
index 00000000..e3a327c8
--- /dev/null
+++ b/src/stdatomic/atomic_ptrdiff_t.c
@@ -0,0 +1 @@
+typedef _Atomic ptrdiff_t atomic_ptrdiff_t;
diff --git a/src/stdatomic/atomic_schar.c b/src/stdatomic/atomic_schar.c
new file mode 100644
index 00000000..9c21171a
--- /dev/null
+++ b/src/stdatomic/atomic_schar.c
@@ -0,0 +1 @@
+typedef _Atomic signed char atomic_schar;
diff --git a/src/stdatomic/atomic_short.c b/src/stdatomic/atomic_short.c
new file mode 100644
index 00000000..c07aa89c
--- /dev/null
+++ b/src/stdatomic/atomic_short.c
@@ -0,0 +1 @@
+typedef _Atomic short atomic_short;
diff --git a/src/stdatomic/atomic_signal_fence.c b/src/stdatomic/atomic_signal_fence.c
new file mode 100644
index 00000000..0ceec034
--- /dev/null
+++ b/src/stdatomic/atomic_signal_fence.c
@@ -0,0 +1,26 @@
+#include <stdatomic.h>
+
+void atomic_signal_fence(memory_order order)
+{
+ switch (order) {
+ case memory_order_relaxed:
+ break;
+
+ case memory_order_acquire:
+ case memory_order_consume:
+ /* acquire fence */
+ break;
+
+ case memory_order_release:
+ /* release fence */
+ break;
+
+ case memory_order_acq_rel:
+ /* acquire fence and release fence */
+ break;
+
+ case memory_order_seq_cst:
+ /* sequentially consistent acquire and release fence */
+ break;
+ }
+}
diff --git a/src/stdatomic/atomic_size_t.c b/src/stdatomic/atomic_size_t.c
new file mode 100644
index 00000000..9bd95806
--- /dev/null
+++ b/src/stdatomic/atomic_size_t.c
@@ -0,0 +1 @@
+typedef _Atomic size_t atomic_size_t;
diff --git a/src/stdatomic/atomic_store.c b/src/stdatomic/atomic_store.c
new file mode 100644
index 00000000..333ff9a7
--- /dev/null
+++ b/src/stdatomic/atomic_store.c
@@ -0,0 +1,6 @@
+#include <stdatomic.h>
+
+void atomic_store(volatile __TYPE *object, __BASE desired)
+{
+ *object = desired;
+}
diff --git a/src/stdatomic/atomic_store_explicit.c b/src/stdatomic/atomic_store_explicit.c
new file mode 100644
index 00000000..55c8f5bd
--- /dev/null
+++ b/src/stdatomic/atomic_store_explicit.c
@@ -0,0 +1,17 @@
+#include <stdatomic.h>
+
+void atomic_store_explicit(volatile __TYPE *object, __BASE desired, memory_order order)
+{
+ switch (order) {
+ case memory_order_acquire:
+ case memory_order_consume:
+ case memory_order_acq_rel:
+ abort();
+ break;
+
+ default:
+ break;
+ }
+
+ *object = desired;
+}
diff --git a/src/stdatomic/atomic_thread_fence.c b/src/stdatomic/atomic_thread_fence.c
new file mode 100644
index 00000000..ee26a260
--- /dev/null
+++ b/src/stdatomic/atomic_thread_fence.c
@@ -0,0 +1,26 @@
+#include <stdatomic.h>
+
+void atomic_thread_fence(memory_order order)
+{
+ switch (order) {
+ case memory_order_relaxed:
+ break;
+
+ case memory_order_acquire:
+ case memory_order_consume:
+ /* acquire fence */
+ break;
+
+ case memory_order_release:
+ /* release fence */
+ break;
+
+ case memory_order_acq_rel:
+ /* acquire fence and release fence */
+ break;
+
+ case memory_order_seq_cst:
+ /* sequentially consistent acquire and release fence */
+ break;
+ }
+}
diff --git a/src/stdatomic/atomic_uchar.c b/src/stdatomic/atomic_uchar.c
new file mode 100644
index 00000000..4b6c8b21
--- /dev/null
+++ b/src/stdatomic/atomic_uchar.c
@@ -0,0 +1 @@
+typedef _Atomic unsigned char atomic_uchar;
diff --git a/src/stdatomic/atomic_uint.c b/src/stdatomic/atomic_uint.c
new file mode 100644
index 00000000..e661eb56
--- /dev/null
+++ b/src/stdatomic/atomic_uint.c
@@ -0,0 +1 @@
+typedef _Atomic unsigned int atomic_uint;
diff --git a/src/stdatomic/atomic_uint_fast16_t.c b/src/stdatomic/atomic_uint_fast16_t.c
new file mode 100644
index 00000000..a0b53e73
--- /dev/null
+++ b/src/stdatomic/atomic_uint_fast16_t.c
@@ -0,0 +1 @@
+typedef _Atomic uint_fast16_t atomic_uint_fast16_t;
diff --git a/src/stdatomic/atomic_uint_fast32_t.c b/src/stdatomic/atomic_uint_fast32_t.c
new file mode 100644
index 00000000..f7f3038c
--- /dev/null
+++ b/src/stdatomic/atomic_uint_fast32_t.c
@@ -0,0 +1 @@
+typedef _Atomic uint_fast32_t atomic_uint_fast32_t;
diff --git a/src/stdatomic/atomic_uint_fast64_t.c b/src/stdatomic/atomic_uint_fast64_t.c
new file mode 100644
index 00000000..91a22f44
--- /dev/null
+++ b/src/stdatomic/atomic_uint_fast64_t.c
@@ -0,0 +1 @@
+typedef _Atomic uint_fast64_t atomic_uint_fast64_t;
diff --git a/src/stdatomic/atomic_uint_fast8_t.c b/src/stdatomic/atomic_uint_fast8_t.c
new file mode 100644
index 00000000..6db80184
--- /dev/null
+++ b/src/stdatomic/atomic_uint_fast8_t.c
@@ -0,0 +1 @@
+typedef _Atomic uint_fast8_t atomic_uint_fast8_t;
diff --git a/src/stdatomic/atomic_uint_least16_t.c b/src/stdatomic/atomic_uint_least16_t.c
new file mode 100644
index 00000000..0e22b86e
--- /dev/null
+++ b/src/stdatomic/atomic_uint_least16_t.c
@@ -0,0 +1 @@
+typedef _Atomic uint_least16_t atomic_uint_least16_t;
diff --git a/src/stdatomic/atomic_uint_least32_t.c b/src/stdatomic/atomic_uint_least32_t.c
new file mode 100644
index 00000000..c251e131
--- /dev/null
+++ b/src/stdatomic/atomic_uint_least32_t.c
@@ -0,0 +1 @@
+typedef _Atomic uint_least32_t atomic_uint_least32_t;
diff --git a/src/stdatomic/atomic_uint_least64_t.c b/src/stdatomic/atomic_uint_least64_t.c
new file mode 100644
index 00000000..59acb723
--- /dev/null
+++ b/src/stdatomic/atomic_uint_least64_t.c
@@ -0,0 +1 @@
+typedef _Atomic uint_least64_t atomic_uint_least64_t;
diff --git a/src/stdatomic/atomic_uint_least8_t.c b/src/stdatomic/atomic_uint_least8_t.c
new file mode 100644
index 00000000..f804b542
--- /dev/null
+++ b/src/stdatomic/atomic_uint_least8_t.c
@@ -0,0 +1 @@
+typedef _Atomic uint_least8_t atomic_uint_least8_t;
diff --git a/src/stdatomic/atomic_uintmax_t.c b/src/stdatomic/atomic_uintmax_t.c
new file mode 100644
index 00000000..213c79d5
--- /dev/null
+++ b/src/stdatomic/atomic_uintmax_t.c
@@ -0,0 +1 @@
+typedef _Atomic uintmax_t atomic_uintmax_t;
diff --git a/src/stdatomic/atomic_uintptr_t.c b/src/stdatomic/atomic_uintptr_t.c
new file mode 100644
index 00000000..6d2c6e55
--- /dev/null
+++ b/src/stdatomic/atomic_uintptr_t.c
@@ -0,0 +1 @@
+typedef _Atomic uintptr_t atomic_uintptr_t;
diff --git a/src/stdatomic/atomic_ullong.c b/src/stdatomic/atomic_ullong.c
new file mode 100644
index 00000000..8fc02060
--- /dev/null
+++ b/src/stdatomic/atomic_ullong.c
@@ -0,0 +1 @@
+typedef _Atomic unsigned long long atomic_ullong;
diff --git a/src/stdatomic/atomic_ulong.c b/src/stdatomic/atomic_ulong.c
new file mode 100644
index 00000000..286192e3
--- /dev/null
+++ b/src/stdatomic/atomic_ulong.c
@@ -0,0 +1 @@
+typedef _Atomic unsigned long atomic_ulong;
diff --git a/src/stdatomic/atomic_ushort.c b/src/stdatomic/atomic_ushort.c
new file mode 100644
index 00000000..dfa11c32
--- /dev/null
+++ b/src/stdatomic/atomic_ushort.c
@@ -0,0 +1 @@
+typedef _Atomic unsigned short atomic_ushort;
diff --git a/src/stdatomic/atomic_wchar_t.c b/src/stdatomic/atomic_wchar_t.c
new file mode 100644
index 00000000..25ddef12
--- /dev/null
+++ b/src/stdatomic/atomic_wchar_t.c
@@ -0,0 +1 @@
+typedef _Atomic wchar_t atomic_wchar_t;
diff --git a/src/stdatomic/kill_dependency.h b/src/stdatomic/kill_dependency.h
new file mode 100644
index 00000000..83b9129b
--- /dev/null
+++ b/src/stdatomic/kill_dependency.h
@@ -0,0 +1 @@
+#define kill_dependency(__y) (__y)
diff --git a/src/stdatomic/memory_order.h b/src/stdatomic/memory_order.h
new file mode 100644
index 00000000..0f338d79
--- /dev/null
+++ b/src/stdatomic/memory_order.h
@@ -0,0 +1,8 @@
+typedef enum {
+ memory_order_relaxed,
+ memory_order_consume,
+ memory_order_acquire,
+ memory_order_release,
+ memory_order_acq_rel,
+ memory_order_seq_cst,
+} memory_order;