[libcxx-commits] [PATCH] D134591: [libcxx] Make stdatomic.h work when included from a C source file

Gergely Nagy via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 26 12:30:15 PDT 2022


ngg added inline comments.


================
Comment at: libcxx/include/stdatomic.h:124
 
-#if _LIBCPP_STD_VER > 20
+#if defined(__cplusplus) && _LIBCPP_STD_VER > 20
 
----------------
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


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