[libcxx] Fix usage of _C2, which is a "nasty macro" in some environments

The problem was pointed out in https://reviews.llvm.org/D48896#inline-475775.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345834 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Louis Dionne
2018-11-01 14:41:37 +00:00
parent 3fa96b3738
commit f10e0ac7b0
3 changed files with 39 additions and 36 deletions

View File

@@ -1323,33 +1323,33 @@ public:
{ {
return __tree_.template __node_handle_extract<node_type>(__it.__i_); return __tree_.template __node_handle_extract<node_type>(__it.__i_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(map<key_type, mapped_type, _C2, allocator_type>& __source) void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_); __tree_.__node_handle_merge_unique(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(map<key_type, mapped_type, _C2, allocator_type>&& __source) void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_); __tree_.__node_handle_merge_unique(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(multimap<key_type, mapped_type, _C2, allocator_type>& __source) void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_); __tree_.__node_handle_merge_unique(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(multimap<key_type, mapped_type, _C2, allocator_type>&& __source) void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
@@ -1942,33 +1942,33 @@ public:
return __tree_.template __node_handle_extract<node_type>( return __tree_.template __node_handle_extract<node_type>(
__it.__i_); __it.__i_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(multimap<key_type, mapped_type, _C2, allocator_type>& __source) void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_); return __tree_.__node_handle_merge_multi(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(multimap<key_type, mapped_type, _C2, allocator_type>&& __source) void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_); return __tree_.__node_handle_merge_multi(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(map<key_type, mapped_type, _C2, allocator_type>& __source) void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_); return __tree_.__node_handle_merge_multi(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(map<key_type, mapped_type, _C2, allocator_type>&& __source) void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");

View File

@@ -513,7 +513,7 @@ public:
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
template <class _InputIterator> template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: set(__f, __l, key_compare(), __a) {} : set(__f, __l, key_compare(), __a) {}
#endif #endif
@@ -569,7 +569,7 @@ public:
} }
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const allocator_type& __a) set(initializer_list<value_type> __il, const allocator_type& __a)
: set(__il, key_compare(), __a) {} : set(__il, key_compare(), __a) {}
#endif #endif
@@ -707,33 +707,33 @@ public:
{ {
return __tree_.template __node_handle_extract<node_type>(__it); return __tree_.template __node_handle_extract<node_type>(__it);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(set<key_type, _C2, allocator_type>& __source) void merge(set<key_type, _Compare2, allocator_type>& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_); __tree_.__node_handle_merge_unique(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(set<key_type, _C2, allocator_type>&& __source) void merge(set<key_type, _Compare2, allocator_type>&& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_); __tree_.__node_handle_merge_unique(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(multiset<key_type, _C2, allocator_type>& __source) void merge(multiset<key_type, _Compare2, allocator_type>& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_); __tree_.__node_handle_merge_unique(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(multiset<key_type, _C2, allocator_type>&& __source) void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
@@ -984,7 +984,7 @@ public:
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
template <class _InputIterator> template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: multiset(__f, __l, key_compare(), __a) {} : multiset(__f, __l, key_compare(), __a) {}
#endif #endif
@@ -1048,7 +1048,7 @@ public:
} }
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const allocator_type& __a) multiset(initializer_list<value_type> __il, const allocator_type& __a)
: multiset(__il, key_compare(), __a) {} : multiset(__il, key_compare(), __a) {}
#endif #endif
@@ -1185,33 +1185,33 @@ public:
{ {
return __tree_.template __node_handle_extract<node_type>(__it); return __tree_.template __node_handle_extract<node_type>(__it);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(multiset<key_type, _C2, allocator_type>& __source) void merge(multiset<key_type, _Compare2, allocator_type>& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_multi(__source.__tree_); __tree_.__node_handle_merge_multi(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(multiset<key_type, _C2, allocator_type>&& __source) void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_multi(__source.__tree_); __tree_.__node_handle_merge_multi(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(set<key_type, _C2, allocator_type>& __source) void merge(set<key_type, _Compare2, allocator_type>& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");
__tree_.__node_handle_merge_multi(__source.__tree_); __tree_.__node_handle_merge_multi(__source.__tree_);
} }
template <class _C2> template <class _Compare2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(set<key_type, _C2, allocator_type>&& __source) void merge(set<key_type, _Compare2, allocator_type>&& __source)
{ {
_LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
"merging container with incompatible allocator"); "merging container with incompatible allocator");

View File

@@ -49,6 +49,9 @@
#define _CRPC NASTY_MACRO #define _CRPC NASTY_MACRO
#define _CPC NASTY_MACRO #define _CPC NASTY_MACRO
// yvals.h on MINGW defines this macro
#define _C2 NASTY_MACRO
// Test that libc++ doesn't use names reserved by WIN32 API Macros. // Test that libc++ doesn't use names reserved by WIN32 API Macros.
// NOTE: Obviously we can only define these on non-windows platforms. // NOTE: Obviously we can only define these on non-windows platforms.
#ifndef _WIN32 #ifndef _WIN32