From 397e055ddd944b2a730458b70c389f1c6588c058 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 3 Feb 2022 14:18:29 -0700 Subject: update C language headers to clang release/14.x upstream commit 91632c8ac97fa3daffe4ff8f1391735b5d6805e6 --- lib/include/stdatomic.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/include/stdatomic.h') 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() +#if __STDC_HOSTED__ && __has_include_next() && !defined(_MSC_VER) # include_next #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 -- cgit v1.2.3