diff options
Diffstat (limited to 'libcxx/include')
-rw-r--r-- | libcxx/include/__config | 7 | ||||
-rw-r--r-- | libcxx/include/__debug | 2 | ||||
-rw-r--r-- | libcxx/include/__hash_table | 22 | ||||
-rw-r--r-- | libcxx/include/iterator | 14 | ||||
-rw-r--r-- | libcxx/include/list | 14 | ||||
-rw-r--r-- | libcxx/include/vector | 6 |
6 files changed, 25 insertions, 40 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index fa6abf626ab..b1f0d9586ec 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -529,11 +529,4 @@ template <unsigned> struct __static_assert_check {}; #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr #endif - -#ifdef _LIBCPP_DEBUG2 -# include <__debug> -#else -# define _LIBCPP_ASSERT(x, m) ((void)0) -#endif - #endif // _LIBCPP_CONFIG diff --git a/libcxx/include/__debug b/libcxx/include/__debug index 0d631bf0438..4c920a7f4ae 100644 --- a/libcxx/include/__debug +++ b/libcxx/include/__debug @@ -171,7 +171,7 @@ public: bool __decrementable(const void* __i) const; bool __addable(const void* __i, ptrdiff_t __n) const; bool __subscriptable(const void* __i, ptrdiff_t __n) const; - bool __comparable(const void* __i, const void* __j) const; + bool __less_than_comparable(const void* __i, const void* __j) const; private: _LIBCPP_HIDDEN __i_node* __insert_iterator(void* __i); diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table index 0f722948f54..a8d922252e3 100644 --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -20,6 +20,12 @@ #include <__undef_min_max> +#ifdef _LIBCPP_DEBUG2 +# include <__debug> +#else +# define _LIBCPP_ASSERT(x, m) ((void)0) +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif @@ -181,10 +187,6 @@ public: friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __hash_iterator& __x, const __hash_iterator& __y) { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare non-comparable unordered container iterator"); -#endif return __x.__node_ == __y.__node_; } friend _LIBCPP_INLINE_VISIBILITY @@ -329,10 +331,6 @@ public: friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y) { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare non-comparable unordered container const_iterator"); -#endif return __x.__node_ == __y.__node_; } friend _LIBCPP_INLINE_VISIBILITY @@ -467,10 +465,6 @@ public: friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y) { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare non-comparable unordered container local_iterator"); -#endif return __x.__node_ == __y.__node_; } friend _LIBCPP_INLINE_VISIBILITY @@ -636,10 +630,6 @@ public: friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare non-comparable unordered container local_const_iterator"); -#endif return __x.__node_ == __y.__node_; } friend _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/iterator b/libcxx/include/iterator index dda053da33b..4989d8b7a0d 100644 --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -321,8 +321,10 @@ template <class T, size_t N> T* end(T (&array)[N]); #include <Availability.h> #endif -#ifdef _LIBCPP_DEBUG -#include <cassert> +#ifdef _LIBCPP_DEBUG2 +# include <__debug> +#else +# define _LIBCPP_ASSERT(x, m) ((void)0) #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -1264,10 +1266,6 @@ inline _LIBCPP_INLINE_VISIBILITY bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare incomparable iterators"); -#endif return __x.base() == __y.base(); } @@ -1277,7 +1275,7 @@ bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), + _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), "Attempted to compare incomparable iterators"); #endif return __x.base() < __y.base(); @@ -1353,7 +1351,7 @@ typename __wrap_iter<_Iter1>::difference_type operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), + _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), "Attempted to subtract incompatible iterators"); #endif return __x.base() - __y.base(); diff --git a/libcxx/include/list b/libcxx/include/list index 628a35bade7..4041b88d6b1 100644 --- a/libcxx/include/list +++ b/libcxx/include/list @@ -178,6 +178,12 @@ template <class T, class Alloc> #include <__undef_min_max> +#ifdef _LIBCPP_DEBUG2 +# include <__debug> +#else +# define _LIBCPP_ASSERT(x, m) ((void)0) +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif @@ -350,10 +356,6 @@ public: friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __list_iterator& __x, const __list_iterator& __y) { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare non-comparable list::iterator"); -#endif return __x.__ptr_ == __y.__ptr_; } friend _LIBCPP_INLINE_VISIBILITY @@ -491,10 +493,6 @@ public: friend _LIBCPP_INLINE_VISIBILITY bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y) { -#if _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y), - "Attempted to compare non-comparable list::const_iterator"); -#endif return __x.__ptr_ == __y.__ptr_; } friend _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/vector b/libcxx/include/vector index 373e7c13d88..0758f75bf3b 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -272,6 +272,12 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y) #include <__undef_min_max> +#ifdef _LIBCPP_DEBUG2 +# include <__debug> +#else +# define _LIBCPP_ASSERT(x, m) ((void)0) +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif |