Commit a1a0abac by Paolo Carlini Committed by Paolo Carlini

re PR libstdc++/58049 (libstdc++ bootstrap failure for fix to PR libstdc++/57779)

2013-08-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/58049
	* include/debug/functions.h: Include <bits/move.h>; minor formatting
	changes.
	(__foreign_iterator_aux4): Declare __l and __ge constexpr.
	* include/debug/safe_iterator.h (_Safe_iterator<>::operator->):
	Use __addressof.
	* include/debug/safe_local_iterator.h (_Safe_local_iterator<>::
	operator->): Likewise.

From-SVN: r201424
parent fcf58e3d
2013-08-02 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/58049
* include/debug/functions.h: Include <bits/move.h>; minor formatting
changes.
(__foreign_iterator_aux4): Declare __l and __ge constexpr.
* include/debug/safe_iterator.h (_Safe_iterator<>::operator->):
Use __addressof.
* include/debug/safe_local_iterator.h (_Safe_local_iterator<>::
operator->): Likewise.
2013-08-01 François Dumont <fdumont@gcc.gnu.org> 2013-08-01 François Dumont <fdumont@gcc.gnu.org>
PR libstdc++/57779 PR libstdc++/57779
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <bits/stl_iterator_base_types.h> // for iterator_traits, categories and #include <bits/stl_iterator_base_types.h> // for iterator_traits, categories and
// _Iter_base // _Iter_base
#include <bits/cpp_type_traits.h> // for __is_integer #include <bits/cpp_type_traits.h> // for __is_integer
#include <bits/move.h> // for __addressof and addressof
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
# include <bits/stl_function.h> // for less and greater_equal # include <bits/stl_function.h> // for less and greater_equal
# include <type_traits> // for common_type # include <type_traits> // for common_type
...@@ -126,8 +127,8 @@ namespace __gnu_debug ...@@ -126,8 +127,8 @@ namespace __gnu_debug
inline bool inline bool
__valid_range_aux(const _InputIterator& __first, __valid_range_aux(const _InputIterator& __first,
const _InputIterator& __last, std::__false_type) const _InputIterator& __last, std::__false_type)
{ return __valid_range_aux2(__first, __last, { return __valid_range_aux2(__first, __last,
std::__iterator_category(__first)); } std::__iterator_category(__first)); }
/** Don't know what these iterators are, or if they are even /** Don't know what these iterators are, or if they are even
* iterators (we may get an integral type for InputIterator), so * iterators (we may get an integral type for InputIterator), so
...@@ -182,15 +183,14 @@ namespace __gnu_debug ...@@ -182,15 +183,14 @@ namespace __gnu_debug
{ {
typedef typename std::common_type<_PointerType1, typedef typename std::common_type<_PointerType1,
_PointerType2>::type _PointerType; _PointerType2>::type _PointerType;
std::less<_PointerType> __l; constexpr std::less<_PointerType> __l;
std::greater_equal<_PointerType> __ge; constexpr std::greater_equal<_PointerType> __ge;
return return (__l(std::addressof(*__other),
__l(std::addressof(*__other), std::addressof(*(__it._M_get_sequence()->_M_base().begin())))
std::addressof(*(__it._M_get_sequence()->_M_base().begin()))) || __ge(std::addressof(*__other),
|| __ge(std::addressof(*__other), std::addressof(*(__it._M_get_sequence()->_M_base().end()
std::addressof(*(__it._M_get_sequence()->_M_base().end() - 1)) + 1); - 1)) + 1));
} }
template<typename _Iterator, typename _Sequence, typename _InputIterator> template<typename _Iterator, typename _Sequence, typename _InputIterator>
...@@ -205,12 +205,13 @@ namespace __gnu_debug ...@@ -205,12 +205,13 @@ namespace __gnu_debug
// past-the-end iterator. // past-the-end iterator.
if (__it._M_get_sequence()->_M_base().begin() if (__it._M_get_sequence()->_M_base().begin()
!= __it._M_get_sequence()->_M_base().end()) != __it._M_get_sequence()->_M_base().end())
if (std::__addressof(*(__it._M_get_sequence()->_M_base().end() - 1)) if (std::addressof(*(__it._M_get_sequence()->_M_base().end() - 1))
- std::__addressof(*(__it._M_get_sequence()->_M_base().begin())) - std::addressof(*(__it._M_get_sequence()->_M_base().begin()))
== __it._M_get_sequence()->size() - 1) == __it._M_get_sequence()->size() - 1)
return __foreign_iterator_aux4(__it, __other, return (__foreign_iterator_aux4
std::addressof(*(__it._M_get_sequence()->_M_base().begin())), (__it, __other,
std::addressof(*__other)); std::addressof(*(__it._M_get_sequence()->_M_base().begin())),
std::addressof(*__other)));
return true; return true;
} }
...@@ -232,8 +233,8 @@ namespace __gnu_debug ...@@ -232,8 +233,8 @@ namespace __gnu_debug
{ return __it._M_get_sequence() != __other._M_get_sequence(); } { return __it._M_get_sequence() != __other._M_get_sequence(); }
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
/* This overload detects when passing pointers to the contained elements rather /* This overload detects when passing pointers to the contained elements
than using iterators. rather than using iterators.
*/ */
template<typename _Iterator, typename _Sequence, typename _InputIterator> template<typename _Iterator, typename _Sequence, typename _InputIterator>
inline bool inline bool
...@@ -271,10 +272,9 @@ namespace __gnu_debug ...@@ -271,10 +272,9 @@ namespace __gnu_debug
_InputIterator __other, _InputIterator __other,
std::__false_type) std::__false_type)
{ {
return return (_Insert_range_from_self_is_safe<_Sequence>::__value
_Insert_range_from_self_is_safe<_Sequence>::__value || __foreign_iterator_aux2(__it, __other,
|| __foreign_iterator_aux2(__it, __other, std::__iterator_category(__it)));
std::__iterator_category(__it));
} }
template<typename _Iterator, typename _Sequence, template<typename _Iterator, typename _Sequence,
......
...@@ -269,7 +269,6 @@ namespace __gnu_debug ...@@ -269,7 +269,6 @@ namespace __gnu_debug
* @brief Iterator dereference. * @brief Iterator dereference.
* @pre iterator is dereferenceable * @pre iterator is dereferenceable
* @todo Make this correct w.r.t. iterators that return proxies * @todo Make this correct w.r.t. iterators that return proxies
* @todo Use addressof() instead of & operator
*/ */
pointer pointer
operator->() const operator->() const
...@@ -277,7 +276,7 @@ namespace __gnu_debug ...@@ -277,7 +276,7 @@ namespace __gnu_debug
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
_M_message(__msg_bad_deref) _M_message(__msg_bad_deref)
._M_iterator(*this, "this")); ._M_iterator(*this, "this"));
return &*_M_current; return std::__addressof(*_M_current);
} }
// ------ Input iterator requirements ------ // ------ Input iterator requirements ------
......
...@@ -173,7 +173,6 @@ namespace __gnu_debug ...@@ -173,7 +173,6 @@ namespace __gnu_debug
* @brief Iterator dereference. * @brief Iterator dereference.
* @pre iterator is dereferenceable * @pre iterator is dereferenceable
* @todo Make this correct w.r.t. iterators that return proxies * @todo Make this correct w.r.t. iterators that return proxies
* @todo Use addressof() instead of & operator
*/ */
pointer pointer
operator->() const operator->() const
...@@ -181,7 +180,7 @@ namespace __gnu_debug ...@@ -181,7 +180,7 @@ namespace __gnu_debug
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
_M_message(__msg_bad_deref) _M_message(__msg_bad_deref)
._M_iterator(*this, "this")); ._M_iterator(*this, "this"));
return &*_M_current; return std::__addressof(*_M_current);
} }
// ------ Input iterator requirements ------ // ------ Input iterator requirements ------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment