libcxx: use compiler's _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION when set

closes #25911
This commit is contained in:
Alex Rønne Petersen 2025-11-13 19:52:30 +01:00
parent 18a131f3da
commit 375d873e1e

View file

@ -653,6 +653,8 @@ typedef __char32_t char32_t;
# define _DECLARE_C99_LDBL_MATH 1 # define _DECLARE_C99_LDBL_MATH 1
# endif # endif
/* zig patch: compiler defines _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION in some cases */
# if !defined(_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION)
// If we are getting operator new from the MSVC CRT, then allocation overloads // 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. // 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 # if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
@ -672,6 +674,7 @@ typedef __char32_t char32_t;
# else # else
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1 # define _LIBCPP_HAS_ALIGNED_ALLOCATION 1
# endif # endif
# endif
// It is not yet possible to use aligned_alloc() on all Apple platforms since // It is not yet possible to use aligned_alloc() on all Apple platforms since
// 10.15 was the first version to ship an implementation of aligned_alloc(). // 10.15 was the first version to ship an implementation of aligned_alloc().