aboutsummaryrefslogtreecommitdiff
path: root/lib/include/stdatomic.h
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-10 03:06:05 -0400
committerGitHub <noreply@github.com>2022-07-10 03:06:05 -0400
commitb88151e0e1553607cbebc197e1111ec4bf53a595 (patch)
treecd4f57feae521500fe4eb99a98a798241256d341 /lib/include/stdatomic.h
parent3f11d1d56d9747de974b00eab1c880bea7972c01 (diff)
parentf9bf4889264aee387639bb8a35fdf594236b1283 (diff)
downloadzig-b88151e0e1553607cbebc197e1111ec4bf53a595.tar.gz
zig-b88151e0e1553607cbebc197e1111ec4bf53a595.zip
Merge pull request #12001 from ziglang/llvm14
Upgrade to LLVM 14
Diffstat (limited to 'lib/include/stdatomic.h')
-rw-r--r--lib/include/stdatomic.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/include/stdatomic.h b/lib/include/stdatomic.h
index 665551ea69..780bcc2dfe 100644
--- a/lib/include/stdatomic.h
+++ b/lib/include/stdatomic.h
@@ -12,8 +12,12 @@
/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
* example, already has a Clang-compatible stdatomic.h header.
+ *
+ * Exclude the MSVC path as well as the MSVC header as of the 14.31.30818
+ * explicitly disallows `stdatomic.h` in the C mode via an `#error`. Fallback
+ * to the clang resource header until that is fully supported.
*/
-#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
+#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>) && !defined(_MSC_VER)
# include_next <stdatomic.h>
#else
@@ -40,6 +44,11 @@ extern "C" {
/* 7.17.2 Initialization */
#define ATOMIC_VAR_INIT(value) (value)
+#if (__STDC_VERSION__ >= 201710L || __cplusplus >= 202002L) && \
+ !defined(_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS)
+/* ATOMIC_VAR_INIT was deprecated in C17 and C++20. */
+#pragma clang deprecated(ATOMIC_VAR_INIT)
+#endif
#define atomic_init __c11_atomic_init
/* 7.17.3 Order and consistency */
@@ -149,6 +158,10 @@ typedef _Atomic(uintmax_t) atomic_uintmax_t;
typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;
#define ATOMIC_FLAG_INIT { 0 }
+#if __cplusplus >= 202002L && !defined(_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS)
+/* ATOMIC_FLAG_INIT was deprecated in C++20 but is not deprecated in C. */
+#pragma clang deprecated(ATOMIC_FLAG_INIT)
+#endif
/* These should be provided by the libc implementation. */
#ifdef __cplusplus