Distinguish between library and language support for aligned allocation.
There are two cases:
1. The library has all it needs to provide align_val_t and the
new/delete overloads needed to support aligned allocation.
2. The compiler has actually turned the language feature on.
There are times where libc++ needs to distinguish between the two.
This patch adds the additional macro
_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION which denotes when case (1)
does not hold. _LIBCPP_HAS_NO_ALIGNED_ALLOCATION is defined whenever
_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION is defined, or when the
compiler has not enabled the language feature.
Additionally this patch cleans up a number of other macros related
to detection of aligned allocation machinery.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344207 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index bababbc..14ecb8f 100644
--- a/include/__config
+++ b/include/__config
@@ -984,7 +984,14 @@
// 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_ALIGNED_ALLOCATION
+#define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
+#elif defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
+#define _LIBCPP_DEFER_NEW_TO_VCRUNTIME
+#if !defined(__cpp_aligned_new)
+// We're defering 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
+#endif
#endif
#if defined(__APPLE__)
@@ -994,14 +1001,14 @@
# endif
# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
-# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
# endif
# endif
#endif // defined(__APPLE__)
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
- !defined(_LIBCPP_BUILDING_LIBRARY) && \
- (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
+ (defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \
+ (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606))
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
#endif