[PATCH] D139266: Headers: tweak inclusion condition for stdatomic.h
Saleem Abdulrasool via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 3 19:02:10 PST 2022
compnerd created this revision.
compnerd added reviewers: aaron.ballman, Mordante, fsb4000.
Herald added a project: All.
compnerd requested review of this revision.
Herald added a project: clang.
MSVC requires that C++23 be available (`_HAS_CXX23`) else the entire
content is elided. Conditionalise the inclusion properly so that C/C++
code using `stdatomic.h` for `memory_order_*` constants are able to do
so without changing the C++ standard. This repairs builds of Swift and
libdispatch after ba49d39b20cc5358da28af2ac82bd336028780bc <https://reviews.llvm.org/rGba49d39b20cc5358da28af2ac82bd336028780bc>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139266
Files:
clang/lib/Headers/stdatomic.h
Index: clang/lib/Headers/stdatomic.h
===================================================================
--- clang/lib/Headers/stdatomic.h
+++ clang/lib/Headers/stdatomic.h
@@ -17,8 +17,8 @@
* 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>) && !(defined(_MSC_VER) && !defined(__cplusplus))
+#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>) \
+ && !(defined(_MSC_VER) && __cplusplus-0 < 202002l)
# include_next <stdatomic.h>
#else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139266.479890.patch
Type: text/x-patch
Size: 688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221204/6d0ab07b/attachment.bin>
More information about the cfe-commits
mailing list