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

Shoaib Meenai via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 10 09:55:02 PDT 2022


smeenai added a comment.

In D131435#3712212 <https://reviews.llvm.org/D131435#3712212>, @philnik wrote:

> 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?

Not sure about that; I was just leaving the existing behavior be, since the comment specifically mentions Clang.

In D131435#3712985 <https://reviews.llvm.org/D131435#3712985>, @Mordante wrote:

> @smeenai is this intended to be backported to the LLVM 15 branch?
>
> SGTM but I think it would be good when @ldionne has a look too.

Yup, I was planning to backport if this is accepted.


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