PR 57779 New debug check

François Dumont frs.dumont@gmail.com
Wed Jul 10 20:31:00 GMT 2013


Hi

     This is a proposal to add a new debug like proposed in PR 57779.

     I fully implemented it that is to say that I also detect when 
trying to self insert pointers to the std::vector rather than iterators.

     I had to introduce a __is_lvalue_reference, should I add it to 
bits/cpp_type_traits.h or is there another way to access it without the 
C++11 mode ?

     Tested under linux x86_64.

2013-07-10  François Dumont  <fdumont@gcc.gnu.org>

     PR libstdc++/57779
     * include/debug/formatter.h (_Debug_msg_id): Add
     __msg_insert_itself_range entry.
     * include/debug/functions.h (__foreign_iterator): New function
     checking if an iterator points to a given sequence.
     * include/debug/macros.h (__glibcxx_check_insert_range): Add check
     using __foreign_iterator.
     * src/c++11/debug.cc (_S_debug_messages): Add
     __msg_insert_itself_range_entry message.
     (_Error_formatter::_Parameter::_M_print_description): Display
     iterator sequence address rather than sequence address when the
     parameter type is an iterator.
     (_Error_formatter::_M_print_word): Enhance behavior when
     displaying a word with an appended '\n'.
     * testsuite/util/debug/checks.h (check_insert4): New.
     * testsuite/23_containers/deque/debug/insert5_neg.cc: New.
     * testsuite/23_containers/vector/debug/insert5_neg.cc: Likewise.
     * testsuite/23_containers/vector/debug/insert6_neg.cc: Likewise.
     * testsuite/23_containers/vector/debug/57779_neg.cc: Likewise.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 57779.patch
Type: text/x-patch
Size: 14409 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20130710/32b8704f/attachment.bin>


More information about the Libstdc++ mailing list