[libc++] Tolerate presence of __deallocate macro

Summary:
On Windows the identifier `__deallocate` is defined as a macro by one of the Windows system headers. Previously libc++ worked around this by `#undef __deallocate` and generating a warning. However this causes the WIN32 version of `__threading_support` to always generate a warning on Windows. This is not OK.

This patch renames all usages of `__deallocate` internally as to not conflict with the macro.

Reviewers: mclow.lists, majnemer, rnk, rsmith, smeenai, compnerd

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28426

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291332 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-01-07 03:01:24 +00:00
parent cc1d780758
commit 32b19c3d9f
9 changed files with 21 additions and 52 deletions

View File

@@ -11,9 +11,6 @@
#ifndef _LIBCPP_DYNARRAY
#define _LIBCPP_DYNARRAY
#include <__config>
#if _LIBCPP_STD_VER > 11
/*
dynarray synopsis
@@ -96,6 +93,8 @@ public:
}} // std::experimental
*/
#include <__config>
#if _LIBCPP_STD_VER > 11
#include <__functional_base>
#include <iterator>
@@ -104,8 +103,6 @@ public:
#include <new>
#include <algorithm>
#include <__undef___deallocate>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -143,9 +140,9 @@ private:
return static_cast<value_type *> (_VSTD::__allocate (sizeof(value_type) * count));
}
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate_value( value_type* __ptr ) noexcept
{
_VSTD::__deallocate (static_cast<void *> (__ptr));
_VSTD::__libcpp_deallocate (static_cast<void *> (__ptr));
}
public:
@@ -265,7 +262,7 @@ dynarray<_Tp>::~dynarray()
value_type *__data = data () + __size_;
for ( size_t i = 0; i < __size_; ++i )
(--__data)->value_type::~value_type();
__deallocate ( __base_ );
__deallocate_value( __base_ );
}
template <class _Tp>