[libcxx-commits] [libcxx] [libc++] Improve aligned allocation support with picolibc. (PR #96086)

Simon Tatham via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 21 07:35:48 PDT 2024


================
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
 #  if defined(_LIBCPP_MSVCRT_LIKE)
   return ::_aligned_malloc(__size, __alignment);
-#  elif _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC)
+#  elif defined(_LIBCPP_HAS_C11_ALIGNED_ALLOC) || (_LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC))
----------------
statham-arm wrote:

The latter is already not defined, so this code will select C11 `aligned_alloc` with picolibc as long as `_LIBCPP_STD_VER >= 17`.

This change is intended to make it select `aligned_alloc` even when that's _not_ true: we can't fall back to any other API because it doesn't reliably have them.

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


More information about the libcxx-commits mailing list