[libcxx-commits] [libcxx] [libcxx] Use `aligned_alloc` for testing instead of `posix_memalign` (PR #101748)
Joseph Huber via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 6 11:44:27 PDT 2024
jhuber6 wrote:
> @rprichard Does Android provide aligned_alloc?
>
> @jhuber6 I’m on my phone right now but how does the non-test code handle this?
Seems we guard it with this,
```
// If we are getting operator new from the MSVC CRT, then allocation overloads
// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
// We're deferring to Microsoft's STL to provide aligned new et al. We don't
// have it unless the language feature test macro is defined.
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
# elif defined(__MVS__)
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
# endif
```
https://github.com/llvm/llvm-project/pull/101748
More information about the libcxx-commits
mailing list