[libcxx-commits] [libcxx] [libc++] Fix diagnostic for <stdatomic.h> before C++23 (PR #83351)

Ryan Prichard via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 1 17:06:04 PDT 2024


rprichard wrote:

I think this PR won't work with Android. Since 2014 (https://r.android.com/104366), Android has allowed including `<stdatomic.h>` or `<atomic>` in any order, even for language modes before C++23, and `<stdatomic.h>` delegates to `<atomic>`.

Maybe disable it for Bionic?

```diff
-#if _LIBCPP_STD_VER < 23 && defined(_LIBCPP_STDATOMIC_H)
+#if _LIBCPP_STD_VER < 23 && defined(_LIBCPP_STDATOMIC_H) && !defined(__BIONIC__)
```

I'm guessing libc++ doesn't have an Android-specific test verifying that stdatomic.h and atomic can both be used before C++23. I think I could add one.

https://github.com/llvm/llvm-project/pull/83351


More information about the libcxx-commits mailing list