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

Nico Weber via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 29 10:12:03 PST 2022


thakis added a comment.

> 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.)


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