[PATCH] D139266: Headers: tweak inclusion condition for stdatomic.h

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 6 09:45:57 PST 2022


compnerd updated this revision to Diff 480531.
compnerd added a comment.

Update to avoid use of the `-0` trick.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139266/new/

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
@@ -15,10 +15,12 @@
  *
  * 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.
+ * to the clang resource header until that is fully supported.  The
+ * `stdatomic.h` header requires C++ 23 or newer.
  */
 #if __STDC_HOSTED__ &&                                                         \
-    __has_include_next(<stdatomic.h>) && !(defined(_MSC_VER) && !defined(__cplusplus))
+    __has_include_next(<stdatomic.h>) &&                                       \
+    !(defined(_MSC_VER) && defined(__cplusplus) && __cplusplus < 202002l)
 # include_next <stdatomic.h>
 #else



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139266.480531.patch
Type: text/x-patch
Size: 906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221206/32d6f6ca/attachment.bin>


More information about the cfe-commits mailing list