[libcxx-commits] [PATCH] D138196: [libc++] Use aligned_alloc instead of posix_memalign for C++17

Shoaib Meenai via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 5 11:39:31 PST 2023


smeenai added subscribers: rprichard, danalbert, smeenai.
smeenai added a comment.

In D138196#4019550 <https://reviews.llvm.org/D138196#4019550>, @thakis wrote:

>> cstdlib only has the following `using ::aligned_alloc _LIBCPP_USING_IF_EXISTS;`, so I assume it would also fail with std::aligned_alloc(). I don't have a chromium checkout, but maybe the C library that your build is using doesn't provide aligned_alloc() ? Or maybe it requires an additional macro to expose it? Otherwise you could add another opt-out case to `libcxx/include/__config` (like the macos < 10.15 one from this commit).
>
> It's broken on android (bionic) and chromeos (some glibc, I think?).
>
> libcxx/test/std/depr/depr.c.headers/stdlib_h.aligned_alloc.compile.pass.cpp claims "::aligned_alloc is available starting with Android P (API 28)". We support API level 24, so we can't use that yet.
>
> So I think this breaks most people doing Android builds, so it'd probably be good if `_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC` was set correctly automatically for at least Android.
>
> (But we'll just define `_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC` ourselves for now.)

CC @danalbert and @rprichard. (We hit the same breakage as well.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138196



More information about the libcxx-commits mailing list