[libcxx-commits] [PATCH] D134591: [libcxx] Make stdatomic.h work when included from a C source file
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 26 16:14:59 PDT 2022
ldionne accepted this revision.
ldionne added inline comments.
This revision is now accepted and ready to land.
================
Comment at: libcxx/include/stdatomic.h:124
-#if _LIBCPP_STD_VER > 20
+#if defined(__cplusplus) && _LIBCPP_STD_VER > 20
----------------
ngg wrote:
> ldionne wrote:
> > Why is this change required?
> I've tried to describe it in the commit message: "Note that _LIBCPP_STD_VER is not defined when in C mode, hence stdatomic.h needs to check if in C++ mode before using that macro to avoid a warning."
>
> _LIBCPP_STD_VER is defined only when in C++ mode, this triggers a warning "treating undefined as 0", and the include_as_c.sh.cpp test even fails because it uses -Werror
Oh, of course, this makes sense. Thanks and sorry for the dumbish question.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134591/new/
https://reviews.llvm.org/D134591
More information about the libcxx-commits
mailing list