2018-05-08 François Dumont <fdumont@gcc.gnu.org>
+ * include/debug/macros.h (__glibcxx_check_valid_range_at): New.
+ * include/debug/functions.h (__check_valid_range): Use latter.
+ * include/debug/macros.h (__glibcxx_check_valid_constructor_range): New,
+ use latter.
+ * include/debug/deque
+ (deque::deque<_Iter>(_Iter, _Iter, const _Alloc&)): Use latter.
+ * include/debug/forward_list
+ (forward_list::forward_list<_Iter>(_Iter, _Iter, const _Alloc&)):
+ Likewise.
+ * include/debug/list
+ (list::list<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
+ * include/debug/list
+ (list::list<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
+ * include/debug/map.h
+ (map::map<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
+ (map::map<_Iter>(_Iter, _Iter, const _Compare&, const _Alloc&)):
+ Likewise.
+ * include/debug/multimap.h
+ (multimap::multimap<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
+ (multimap::multimap<_Iter>(_Iter, _Iter, const _Compare&,
+ const _Alloc&)): Likewise.
+ * include/debug/set.h
+ (set::set<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
+ (set::set<_Iter>(_Iter, _Iter, const _Compare&, const _Alloc&)):
+ Likewise.
+ * include/debug/multiset.h
+ (multiset::multiset<_Iter>(_Iter, _Iter, const _Alloc&)): Likewise.
+ (multiset::multiset<_Iter>(_Iter, _Iter, const _Compare&,
+ const _Alloc&)): Likewise.
+ * include/debug/string
+ (basic_string::basic_string<_Iter>(_Iter, _Iter, const _Alloc&)):
+ Likewise.
+ * include/debug/unordered_map
+ (unordered_map::unordered_map<_Iter>(_Iter, _Iter, const _Alloc&)):
+ Likewise.
+ (unordered_multimap::unordered_multimap<_Iter>(_Iter, _Iter,
+ const _Alloc&)): Likewise.
+ * include/debug/unordered_set
+ (unordered_set::unordered_set<_Iter>(_Iter, _Iter, const _Alloc&)):
+ Likewise.
+ (unordered_multiset::unordered_multiset<_Iter>(_Iter, _Iter,
+ const _Alloc&)): Likewise.
+ * include/debug/vector
+ (vector::vector<_Iter>(_Iter, _Iter, const _Alloc&)): Use latter.
+
* include/debug/formatter.h (_Error_formatter::_M_function): New.
(_Error_formatter(const char*, unsigned int)): Adapt.
(_Error_formatter::_M_at): Rename in...
#endif
deque(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __a)
{ }
typename = std::_RequireInputIter<_InputIterator>>
forward_list(_InputIterator __first, _InputIterator __last,
const allocator_type& __al = allocator_type())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __al)
{ }
template<typename _InputIterator>
inline _InputIterator
__check_valid_range(const _InputIterator& __first,
- const _InputIterator& __last
- __attribute__((__unused__)))
+ const _InputIterator& __last,
+ const char* __file,
+ unsigned int __line,
+ const char* __function)
{
- __glibcxx_check_valid_range(__first, __last);
+ __glibcxx_check_valid_range_at(__first, __last,
+ __file, __line, __function);
return __first;
}
#endif
list(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __a)
{ }
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last))
+#define __glibcxx_check_valid_range_at(_First,_Last,_File,_Line,_Func) \
+_GLIBCXX_DEBUG_VERIFY_AT_F(__gnu_debug::__valid_range(_First, _Last), \
+ _M_message(__gnu_debug::__msg_valid_range) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last), \
+ _File,_Line,_Func)
+
#define __glibcxx_check_valid_range2(_First,_Last,_Dist) \
_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last, _Dist), \
_M_message(__gnu_debug::__msg_valid_range) \
._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last))
+#define __glibcxx_check_valid_constructor_range(_First,_Last) \
+ __gnu_debug::__check_valid_range(_First, _Last, \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
// Verify that [_First, _Last) forms a non-empty iterator range.
#define __glibcxx_check_non_empty_range(_First,_Last) \
_GLIBCXX_DEBUG_VERIFY(_First != _Last, \
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __a)
{ }
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last),
__comp, __a) { }
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __a) { }
~multimap() = default;
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last),
__comp, __a) { }
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __a) { }
~multiset() = default;
multiset(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last),
__comp, __a) { }
template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __a) { }
~set() = default;
set(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last),
__comp, __a) { }
template<typename _InputIterator>
basic_string(_InputIterator __begin, _InputIterator __end,
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__begin,
- __end)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__begin, __end)),
__gnu_debug::__base(__end), __a) { }
#if __cplusplus < 201103L
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __n,
__hf, __eql, __a) { }
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __n,
__hf, __eql, __a) { }
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __n,
__hf, __eql, __a) { }
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __n,
__hf, __eql, __a) { }
#endif
vector(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
- __last)),
+ : _Base(__gnu_debug::__base(
+ __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __a) { }
#if __cplusplus < 201103L