[libcxx-commits] [PATCH] D97044: [libc++] [C++2b] [P0943] Add stdatomic.h header.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 8 14:02:05 PST 2022
ldionne added inline comments.
================
Comment at: libcxx/include/stdatomic.h:223-231
+#endif // defined(__cplusplus) && _LIBCPP_STD_VER > 20
+
+// If we are not being compiled as C++, we include the next <stdatomic.h> on the path
+// to avoid hijacking the header when compiling as C11.
+#if !defined(__cplusplus)
+# if __has_include_next(<stdatomic.h>)
+# include_next <stdatomic.h>
----------------
hubert.reinterpretcast wrote:
> This is what I meant (since it reflects the status quo where Clang has a `stdatomic.h` that "works" in C++ mode (except that `<atomic>` and anything that uses it cannot be used after the `stdatomic.h` inclusion).
>
> Maybe the message should be updated:
> ```
> #ifdef kill_dependency
> # error C++ standard library is incompatible with <stdatomic.h>
> #endif
> ```
>
> Aside: The `#else` comment style above is not my usual preference (I like using the negation), but it seems to be the more common style in libc++ (although there are examples of both styles).
I added a test for this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97044/new/
https://reviews.llvm.org/D97044
More information about the libcxx-commits
mailing list