forked from OSchip/llvm-project
Handle function name conflicts in _LIBCPP_MSVCRT mode
Visual Studio's SAL extension uses a macro named __deallocate. This macro is used pervasively, and gets included through various different ways. This conflicts with the similarly named interfaces in libc++. Introduce a undef header similar to __undef_min_max to handle this. This fixes a number of errors due to the macro replacing the function name. llvm-svn: 229162
This commit is contained in:
parent
4ef8ac946c
commit
8e5ce33193
|
@ -19,6 +19,7 @@
|
|||
#include <cmath>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <type_traits>
|
||||
#include <new>
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
|
|
@ -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
|
|
@ -104,6 +104,8 @@ public:
|
|||
#include <new>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 * }
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ void operator delete[](void* ptr, void*) noexcept;
|
|||
#include <exception>
|
||||
#include <cstddef>
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
|
|
@ -348,6 +348,7 @@ template <class T> unspecified2 end(const valarray<T>& v);
|
|||
#include <new>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
Loading…
Reference in New Issue