diff options
Diffstat (limited to 'lib/include/stdatomic.h')
| -rw-r--r-- | lib/include/stdatomic.h | 15 |
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 |
