macros.h (__glibcxx_check_valid_range_at): New.
authorFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 8 May 2018 19:46:59 +0000 (19:46 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 8 May 2018 19:46:59 +0000 (19:46 +0000)
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.

From-SVN: r260053

14 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/debug/deque
libstdc++-v3/include/debug/forward_list
libstdc++-v3/include/debug/functions.h
libstdc++-v3/include/debug/list
libstdc++-v3/include/debug/macros.h
libstdc++-v3/include/debug/map.h
libstdc++-v3/include/debug/multimap.h
libstdc++-v3/include/debug/multiset.h
libstdc++-v3/include/debug/set.h
libstdc++-v3/include/debug/string
libstdc++-v3/include/debug/unordered_map
libstdc++-v3/include/debug/unordered_set
libstdc++-v3/include/debug/vector

index 87bd39c9341c50f5d1d0d7264fef2dc483a2d193..bf1e80333beb9cb27b44c4721f419ea0bc5083be 100644 (file)
@@ -1,5 +1,50 @@
 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...
index 90110e7d7de6808a33da9b472b489c9e6d6554f1..93b82cf0cdc14c0799933bfd03c15aca41d6b1e0 100644 (file)
@@ -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)
        { }
 
index d45494851c6cfca554eeb7f84f7e34b7c1933e44..633af1a90e7a7eb36efdf7c7de1dc80fa6b3dadd 100644 (file)
@@ -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)
        { }
 
index 57cc6826ce092f0b2afd339c91191ead8d112364..3a2ba74fbbeb2ece38213c53e1b90fa4a921a834 100644 (file)
@@ -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;
     }
 
index 13a7486fff469a13258b354fadefc87f7c7bf60f..e37ebf1a3eb4a196a6f71c9c22386bd36ce4093b 100644 (file)
@@ -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)
        { }
 
index 6f901bc00314e6ed8c0de038f4c62e801b05f465..824d399941c100460736e811ac65fdf7bf90c443 100644 (file)
@@ -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,                                 \
index 414b4dc07526a9188eeeac022b8b70e39018944a..3f0649aef9e60c7ba0fc1614d50f015d1150b3b6 100644 (file)
@@ -114,8 +114,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)
        { }
 
@@ -133,8 +133,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) { }
 
index 8d6358b303088fd1d67e88de559f93b83755e1c6..e709eb7452f116e71dab1e01d16a7dcda44f910a 100644 (file)
@@ -114,8 +114,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;
@@ -129,8 +129,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) { }
 
index 4e1406e93c2995b77b05635f63745e327a7e1ccb..461f4f632ddd0313006b545cd7d7c28622437ff2 100644 (file)
@@ -114,8 +114,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;
@@ -129,8 +129,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) { }
 
index a886860ceabc6bb497c229bef5e818479878f9a2..2ac8f1c1fab75569190e03800722b8a62cedcc57 100644 (file)
@@ -113,8 +113,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;
@@ -128,8 +128,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) { }
 
index 2b3677b3f7e42b26a37faf88ec1d7c2810b80b05..0aa5e9cf82572cb960c73e66589c230c9dcad03d 100644 (file)
@@ -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
index 687a46ca50d4f85d79c3a005b4202b865ac19525..e4f7c5ca733bdb04acefb70d7985f88335ea918f 100644 (file)
@@ -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) { }
 
index 9b2ac9d69a3482797d25cd5acb653bda5c5ddd72..adafdb73a4f4643b975e450cf180e13d7204eb21 100644 (file)
@@ -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) { }
 
index 5289265372875407b0285c08cec7927e30a5fae5..8d60da328e1af36b4be82574ee19891077137c8b 100644 (file)
@@ -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