Skip to content

Commit 375d873

Browse files
committed
libcxx: use compiler's _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION when set
closes #25911
1 parent 18a131f commit 375d873

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

lib/libcxx/include/__config

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -653,24 +653,27 @@ typedef __char32_t char32_t;
653653
# define _DECLARE_C99_LDBL_MATH 1
654654
# endif
655655

656+
/* zig patch: compiler defines _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION in some cases */
657+
# if !defined(_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION)
656658
// If we are getting operator new from the MSVC CRT, then allocation overloads
657659
// 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 < 1912
659-
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
660-
# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
660+
# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
661+
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
662+
# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
661663
// We're deferring to Microsoft's STL to provide aligned new et al. We don't
662664
// have it unless the language feature test macro is defined.
663-
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
664-
# elif defined(__MVS__)
665-
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
666-
# else
667-
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 1
668-
# endif
665+
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
666+
# elif defined(__MVS__)
667+
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
668+
# else
669+
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 1
670+
# endif
669671

670-
# if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
671-
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
672-
# else
673-
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1
672+
# if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
673+
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
674+
# else
675+
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1
676+
# endif
674677
# endif
675678

676679
// It is not yet possible to use aligned_alloc() on all Apple platforms since

0 commit comments

Comments
 (0)