diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table index 3a2de1d52dbd..71cf5fbf00bf 100644 --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -19,6 +19,7 @@ #include #include <__undef_min_max> +#include <__undef___deallocate> #include <__debug> diff --git a/libcxx/include/__sso_allocator b/libcxx/include/__sso_allocator index 645f2ba17459..ca3b937c0138 100644 --- a/libcxx/include/__sso_allocator +++ b/libcxx/include/__sso_allocator @@ -15,6 +15,8 @@ #include #include +#include <__undef___deallocate> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif diff --git a/libcxx/include/__undef___deallocate b/libcxx/include/__undef___deallocate new file mode 100644 index 000000000000..2b4ad99dad38 --- /dev/null +++ b/libcxx/include/__undef___deallocate @@ -0,0 +1,18 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifdef __deallocate +#if defined(_MSC_VER) && !defined(__clang__) +_LIBCPP_WARNING("macro __deallocate is incompatible with C++. #undefining __deallocate") +#else +#warning: macro __deallocate is incompatible with C++. #undefining __deallocate +#endif +#undef __deallocate +#endif diff --git a/libcxx/include/experimental/dynarray b/libcxx/include/experimental/dynarray index 0bc8dfe2cb7b..a0258628dfa6 100644 --- a/libcxx/include/experimental/dynarray +++ b/libcxx/include/experimental/dynarray @@ -104,6 +104,8 @@ public: #include #include +#include <__undef___deallocate> + #if defined(_LIBCPP_NO_EXCEPTIONS) #include #endif diff --git a/libcxx/include/memory b/libcxx/include/memory index 40fc8ae07eea..7085cedadaf9 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -615,6 +615,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); #endif #include <__undef_min_max> +#include <__undef___deallocate> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap index 6aeb23f028bf..3c0700eca443 100644 --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -469,4 +469,5 @@ module std [system] { module __tree { header "__tree" export * } module __tuple { header "__tuple" export * } module __undef_min_max { header "__undef_min_max" export * } + module __undef___deallocate { header "__undef___deallocate" export * } } diff --git a/libcxx/include/new b/libcxx/include/new index a710ed93fb43..eebe5af30ed9 100644 --- a/libcxx/include/new +++ b/libcxx/include/new @@ -68,6 +68,8 @@ void operator delete[](void* ptr, void*) noexcept; #include #include +#include <__undef___deallocate> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif diff --git a/libcxx/include/valarray b/libcxx/include/valarray index 2b942046db9d..bdaa58836f39 100644 --- a/libcxx/include/valarray +++ b/libcxx/include/valarray @@ -348,6 +348,7 @@ template unspecified2 end(const valarray& v); #include #include <__undef_min_max> +#include <__undef___deallocate> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header