From f10e0ac7b0e27026dec14f437c59eb6686071d14 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 1 Nov 2018 14:41:37 +0000 Subject: [PATCH] [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 --- include/map | 32 ++++++++++++++-------------- include/set | 40 +++++++++++++++++------------------ test/support/nasty_macros.hpp | 3 +++ 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/include/map b/include/map index 472ac314b..d3c59f3c5 100644 --- a/include/map +++ b/include/map @@ -1323,33 +1323,33 @@ public: { return __tree_.template __node_handle_extract(__it.__i_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(map& __source) + void merge(map& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(map&& __source) + void merge(map&& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(multimap& __source) + void merge(multimap& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(multimap&& __source) + void merge(multimap&& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); @@ -1942,33 +1942,33 @@ public: return __tree_.template __node_handle_extract( __it.__i_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(multimap& __source) + void merge(multimap& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); return __tree_.__node_handle_merge_multi(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(multimap&& __source) + void merge(multimap&& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); return __tree_.__node_handle_merge_multi(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(map& __source) + void merge(map& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); return __tree_.__node_handle_merge_multi(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(map&& __source) + void merge(map&& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); diff --git a/include/set b/include/set index 80cc7b04c..ccf785ab1 100644 --- a/include/set +++ b/include/set @@ -513,7 +513,7 @@ public: #if _LIBCPP_STD_VER > 11 template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) : set(__f, __l, key_compare(), __a) {} #endif @@ -569,7 +569,7 @@ public: } #if _LIBCPP_STD_VER > 11 - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY set(initializer_list __il, const allocator_type& __a) : set(__il, key_compare(), __a) {} #endif @@ -707,33 +707,33 @@ public: { return __tree_.template __node_handle_extract(__it); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(set& __source) + void merge(set& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(set&& __source) + void merge(set&& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(multiset& __source) + void merge(multiset& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(multiset&& __source) + void merge(multiset&& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); @@ -984,7 +984,7 @@ public: #if _LIBCPP_STD_VER > 11 template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) : multiset(__f, __l, key_compare(), __a) {} #endif @@ -1048,7 +1048,7 @@ public: } #if _LIBCPP_STD_VER > 11 - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY multiset(initializer_list __il, const allocator_type& __a) : multiset(__il, key_compare(), __a) {} #endif @@ -1185,33 +1185,33 @@ public: { return __tree_.template __node_handle_extract(__it); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(multiset& __source) + void merge(multiset& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(multiset&& __source) + void merge(multiset&& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(set& __source) + void merge(set& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } - template + template _LIBCPP_INLINE_VISIBILITY - void merge(set&& __source) + void merge(set&& __source) { _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); diff --git a/test/support/nasty_macros.hpp b/test/support/nasty_macros.hpp index 97a17bb68..3c2a5e27a 100644 --- a/test/support/nasty_macros.hpp +++ b/test/support/nasty_macros.hpp @@ -49,6 +49,9 @@ #define _CRPC 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. // NOTE: Obviously we can only define these on non-windows platforms. #ifndef _WIN32