[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
Fri Jan 6 23:36:42 PST 2023


smeenai added a comment.

In D138196#4029676 <https://reviews.llvm.org/D138196#4029676>, @arichardson wrote:

> In D138196#4029503 <https://reviews.llvm.org/D138196#4029503>, @smeenai wrote:
>
>> 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.)
>
> If you give me instructions to test this and the right macro to check I can try to submit a fix, but it will probably be a lot quicker if someone with an existing development setup can add the right line to `__config`.

D141184 <https://reviews.llvm.org/D141184>


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