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

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 10 05:21:09 PDT 2022


philnik added a comment.

In D131435#3711269 <https://reviews.llvm.org/D131435#3711269>, @smeenai wrote:

> In D131435#3709364 <https://reviews.llvm.org/D131435#3709364>, @philnik wrote:
>
>> This won't change anything. All the code is guarded by `_LIBCPP_STD_VER > 20`. `_LIBCPP_STD_VER` also isn't defined when compiled for C, so it's `#if 0 > 20`, which is obviously not the case.
>
> The `#elif` that I'm changing is for that `#if`, so we'll fall through to it and include the Clang resource directory's `stdatomic.h` after my change. I verified that this did fix my actual issue, but I also came up with an alternative solution, so I don't need this patch anymore. I'm happy to abandon if we'd rather not take this change.

Ah, I missed that. It's really subtle. Couldn't we just make this an `#else` and that would do the same thing? Or is there a reason we don't want to `#include_next <stdatomic.h>` when using GCC?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131435



More information about the libcxx-commits mailing list