authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-11-13 19:52:30+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-11-14 02:02:59+01:00
log375d873e1e45843c36db2a6183be4fea9ee60c27
tree925dcd88b50d63e0faef5f5df07a2be4c66e3deb
parent18a131f3da97fc5ec8027859e71509468dfad885

libcxx: use compiler's _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION when set

closes #25911

1 files changed, 16 insertions(+), 13 deletions(-)

lib/libcxx/include/__config+16-13
...@@ -653,24 +653,27 @@ typedef __char32_t char32_t;...@@ -653,24 +653,27 @@ typedef __char32_t char32_t;
653# define _DECLARE_C99_LDBL_MATH 1653# define _DECLARE_C99_LDBL_MATH 1
654# endif654# endif
655655
656/* zig patch: compiler defines _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION in some cases */
657# if !defined(_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION)
656// If we are getting operator new from the MSVC CRT, then allocation overloads658// If we are getting operator new from the MSVC CRT, then allocation overloads
657// for align_val_t were added in 19.12, aka VS 2017 version 15.3.659// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
658# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912660# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
659# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0661# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
660# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)662# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
661// We're deferring to Microsoft's STL to provide aligned new et al. We don't663// We're deferring to Microsoft's STL to provide aligned new et al. We don't
662// have it unless the language feature test macro is defined.664// have it unless the language feature test macro is defined.
663# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0665# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
664# elif defined(__MVS__)666# elif defined(__MVS__)
665# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0667# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
666# else668# else
667# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 1669# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 1
668# endif670# endif
669671
670# if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)672# if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
671# define _LIBCPP_HAS_ALIGNED_ALLOCATION 0673# define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
672# else674# else
673# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1675# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1
676# endif
674# endif677# endif
675678
676// It is not yet possible to use aligned_alloc() on all Apple platforms since679// It is not yet possible to use aligned_alloc() on all Apple platforms since