Patchwork debug mode patch

login
register
mail settings
Submitter François Dumont
Date Feb. 19, 2011, 8:53 p.m.
Message ID <4D602DCE.1000400@free.fr>
Download mbox | patch
Permalink /patch/83714/
State New
Headers show

Comments

François Dumont - Feb. 19, 2011, 8:53 p.m.
On 02/19/2011 12:42 PM, Paolo Carlini wrote:
> Hi,
>
>    
>> Hi
>>
>>     Here is a proposition of a patch to a minor issue in debug string and to remove a useless debug check on heap. Ok ?
>>      
> Looks good, thanks!
>
> Paolo.
>    

Attached patch applied

2011-02-19  François Dumont <francois.cppdevs@free.fr>

         * include/debug/string (basic_string::insert): Add iterator 
check and
         pass normal iterator to normal insert.
         * include/debug/macros.h (__glibcxx_check_heap,
         __glibcxx_check_heap_pred): Remove __glibcxx_check_valid_range,
         already done.

Bests

Patch

Index: include/debug/string
===================================================================
--- include/debug/string	(revision 170309)
+++ include/debug/string	(working copy)
@@ -514,7 +514,8 @@ 
     void
     insert(iterator __p, std::initializer_list<_CharT> __l)
     {
-      _Base::insert(__p, __l);
+      __glibcxx_check_insert(__p);
+      _Base::insert(__p.base(), __l);
       this->_M_invalidate_all();
     }
 #endif // __GXX_EXPERIMENTAL_CXX0X__
Index: include/debug/macros.h
===================================================================
--- include/debug/macros.h	(revision 170309)
+++ include/debug/macros.h	(working copy)
@@ -286,7 +286,6 @@ 
 
 // Verify that the iterator range [_First, _Last) is a heap
 #define __glibcxx_check_heap(_First,_Last)				\
-__glibcxx_check_valid_range(_First,_Last);				\
 _GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last),		        \
 		      _M_message(__gnu_debug::__msg_not_heap)	        \
 		      ._M_iterator(_First, #_First)			\
@@ -295,7 +294,6 @@ 
 /** Verify that the iterator range [_First, _Last) is a heap
     w.r.t. the predicate _Pred. */
 #define __glibcxx_check_heap_pred(_First,_Last,_Pred)			\
-__glibcxx_check_valid_range(_First,_Last);				\
 _GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last, _Pred),		\
 		      _M_message(__gnu_debug::__msg_not_heap_pred)      \
                       ._M_iterator(_First, #_First)			\