Hi
This is to fix what is reported as the pretty function in case of
debug assertion failure in the range constructor.
Result looks like this:
/home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/vector:188:
In function:
std::__debug::vector<_Tp, _Allocator>::vector(_InputIterator,
_InputIterator, const _Allocator&) [with _InputIterator =
__gnu_cxx::__normal_iterator<int*, std::vector<int> >;
<template-parameter-2-2> = void; _Tp = int; _Allocator =
std::allocator<int>]
It is interesting to see that in this case we do see the
_RequireInputIter constraint, not a big deal thought.
Tested under Linux x86_64.
Will be committed tomorrow if not told otherwise.
* 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.
François
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 90110e7..93b82cf 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -130,8 +130,8 @@ namespace __debug
#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)
{ }
diff --git a/libstdc++-v3/include/debug/forward_list b/libstdc++-v3/include/debug/forward_list
index d454948..633af1a 100644
--- a/libstdc++-v3/include/debug/forward_list
+++ b/libstdc++-v3/include/debug/forward_list
@@ -241,8 +241,8 @@ namespace __debug
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)
{ }
diff --git a/libstdc++-v3/include/debug/functions.h b/libstdc++-v3/include/debug/functions.h
index 57cc682..3a2ba74 100644
--- a/libstdc++-v3/include/debug/functions.h
+++ b/libstdc++-v3/include/debug/functions.h
@@ -87,10 +87,13 @@ namespace __gnu_debug
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;
}
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index 6e0742a..bf3179a 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -131,8 +131,8 @@ namespace __debug
#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)
{ }
diff --git a/libstdc++-v3/include/debug/macros.h b/libstdc++-v3/include/debug/macros.h
index 6f901bc..824d399 100644
--- a/libstdc++-v3/include/debug/macros.h
+++ b/libstdc++-v3/include/debug/macros.h
@@ -60,12 +60,23 @@ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \
._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, \
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index 9c66e91..1fd4416 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -115,8 +115,8 @@ namespace __debug
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)
{ }
@@ -134,8 +134,8 @@ namespace __debug
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) { }
diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h
index be35f3c..0994dc4 100644
--- a/libstdc++-v3/include/debug/multimap.h
+++ b/libstdc++-v3/include/debug/multimap.h
@@ -115,8 +115,8 @@ namespace __debug
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;
@@ -130,8 +130,8 @@ namespace __debug
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) { }
diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h
index 0be14d7..6e4c1b0 100644
--- a/libstdc++-v3/include/debug/multiset.h
+++ b/libstdc++-v3/include/debug/multiset.h
@@ -115,8 +115,8 @@ namespace __debug
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;
@@ -130,8 +130,8 @@ namespace __debug
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) { }
diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h
index 7f24a83..571cc47 100644
--- a/libstdc++-v3/include/debug/set.h
+++ b/libstdc++-v3/include/debug/set.h
@@ -114,8 +114,8 @@ namespace __debug
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;
@@ -129,8 +129,8 @@ namespace __debug
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) { }
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 2b3677b..0aa5e9c 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -138,8 +138,8 @@ template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
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
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index 687a46c..e4f7c5c 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -99,8 +99,8 @@ namespace __debug
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) { }
@@ -785,8 +785,8 @@ namespace __debug
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) { }
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index 9b2ac9d..adafdb7 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -99,8 +99,8 @@ namespace __debug
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) { }
@@ -662,8 +662,8 @@ namespace __debug
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) { }
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index 5289265..8d60da3 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -182,8 +182,8 @@ namespace __debug
#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