safe unordered local iterators

François Dumont francois.cppdevs@free.fr
Thu Jul 14 21:19:00 GMT 2011


Hi

     Here is the finalize version of the patch to add a safe mode for 
local unordered sequence. I have added many tests showing problems in my 
initial proposition. Moreover I have been able to remove a lot of code 
from _Safe_local_iterator because I realized that local iterators are 
only forward iterators. I have also specialize some assertion messages 
to make more clear that the problem occurred on local iterators.

2011-07-14  François Dumont <francois.cppdevs@free.fr>

         * include/debug/safe_unordered_base.h, safe_unordered_sequence.h,
         safe_unordered_sequence.tcc, safe_local_iterator.h,
         safe_local_iterator.tcc: New, support for unordered sequence safe
         local iterators.
         * include/Makefile.am: Add previous files.
         * include/Makefile.in: Regenerate.
         * include/debug/unordered_map, unordered_set: Implement
         _Safe_unordered_sequence and expose _Safe_local_iterator.
         * include/debug/safe_iterator.h, safe_iterator.tcc: Refactor
         _Safe_iterator::_M_get_distance static method to expose it as
         __get_distance function and use it in _Safe_local_iterator type.
         * include/debug/formatter.h: Add __msg_local_iter_compare_bad
         _Debug_msg_id enum entry to notify invalid comparison between local
         iterators from different buckets. Add __local_iterator kind. Add
         _Parameter constructor from _Safe_local_iterator.
         * include/debug/functions.h: Add __valid_range overload for
         _Safe_local_iterator.
         * src/debug.cc: Add _Safe_unordered_sequence_base and
         _Safe_local_iterator_base methods implementations. Adapt some 
messages
         to work for both iterators and local iterators. Introduce 'kind'
         fields for iterators or local iterators.
         * config/abi/pre/gnu.ver: Add export of some
         _Safe_unordered_sequence_base and _Safe_local_iterator_base 
methods.
         * testsuite/util/debug/checks.h: Add use_invalid_iterator 
function to
         simulate usage of a singular iterator.
         * testsuite/util/debug/unordered_checks.h: New, several functions
         to simulate classic invalid usage of unordered sequence local
         iterators.
         * testsuite/23_containers/unordered_map/debug/
         use_erased_local_iterator_neg.cc, 
invalid_local_iterator_range_neg.cc,
         use_invalid_local_iterator_neg.cc, use_invalid_iterator_neg.cc,
         invalid_local_iterator_compare_neg.cc: New.
         * testsuite/23_containers/unordered_multimap/debug/
         use_erased_local_iterator_neg.cc, 
invalid_local_iterator_range_neg.cc,
         use_invalid_local_iterator_neg.cc, use_invalid_iterator_neg.cc,
         invalid_local_iterator_compare_neg.cc: New.
         * testsuite/23_containers/unordered_set/debug/
         use_erased_local_iterator_neg.cc, 
invalid_local_iterator_range_neg.cc,
         use_invalid_local_iterator_neg.cc, use_invalid_iterator_neg.cc,
         invalid_local_iterator_compare_neg.cc: New.
         * testsuite/23_containers/unordered_multiset/debug/
         use_erased_local_iterator_neg.cc, 
invalid_local_iterator_range_neg.cc,
         use_invalid_local_iterator_neg.cc, use_invalid_iterator_neg.cc,
         invalid_local_iterator_compare_neg.cc: New.

Ok to apply ?

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: safe_unordered.patch
Type: text/x-patch
Size: 120953 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20110714/b3a06d46/attachment.bin>


More information about the Libstdc++ mailing list