debug mode maintenance patch
François Dumont
frs.dumont@gmail.com
Mon May 25 13:31:00 GMT 2015
Hi
This is a patch to clean the debug mode code.
I have introduced a new debug header, assertions.h, so that headers
that only need _GLIBCXX_DEBUG_ASSERT do not have to include the big
debug.h. I also introduce functions.tcc to isolate implementation of
__foreign_iterator which require a number of other headers.
I reorganized _Error_formatter. Nested _Parameter is now public
like several format methods so that I am able to move some code to
debug.cc. I would have needed to export new symbols otherwise. I
introduced 2 new type of debug parameters, __instance for any functor,
__iterator_value_type to report iterator value_type. I will use those in
new debug checks to come.
Note that I try to regenerate include/Makefile.in with autoreconf
2.64 but it was producing a lot of modifications in all Makefile.in. Can
someone check if those files are up to date ?
2015-02-19 François Dumont <fdumont@gcc.gnu.org>
* include/debug/debug.h ([_GLIBCXX_DEBUG_ASSERT,
_GLIBCXX_DEBUG_PEDASSERT, _GLIBCXX_DEBUG_ONLY]): Move definition...
* include/debug/assertions.h: ...here, new.
* include/debug/formatter.h
(struct _Error_formatter::_Is_iterator_value_type): New.
(struct _Error_formatter::_Is_instance): New.
(struct _Error_formatter::_Parameter): Make public and not friend
anymore.
(_Error_formatter::_Parameter::__instance): New _M_kind enum entry.
(_Error_formatter::_Parameter::__iterator_value_type): New _M_kind enum
entry.
(struct _Error_formatter::_Parameter::_Type): New.
(struct _Error_formatter::_Parameter::_Instance): New, inherit from
latter.
(union _Error_formatter::_Parameter::_M_variant): Reorganize.
(_Parameter(_Iterator const&, const char*, _Is_iterator)): Make all
overloads take iterator through a const reference.
(_Parameter(const _Iterator&, const char*, _Is_iterator_value_type)):
New.
(_Parameter(const _Type&, const char*, _Is_instance)): New.
(_Error_formatter::_M_print_type): Delete.
(_Error_formatter::_M_iterator_value_type): New.
(_Error_formatter::_M_instance): New.
* include/debug/functions.h (__foreign_iterator): Move definition...
* include/debug/functions.tcc: ...here, new.
* include/Makefile.am: Add new above debug files.
* include/Makefile.in: Regenerate.
* include/debug/safe_iterator.h: Replace debug.h include with
assertions.h.
(__check_dereferenceable, __valid_range): Move here overload for
_Safe_iterator.
(struct __is_safe_random_iterator): Move here partial specialization
for _Safe_iterator.
(__check_singular_aux): Move...
* include/debug/safe_base.h (__check_singular_aux): ... here.
* include/debug/safe_local_iterator.h (__check_dereferenceable)
(__valid_range): Move here overload for _Safe_local_iterator.
* include/debug/safe_sequence.h: Replace debug.h with assertions.h.
Remove _Safe_iterator declaration.
* include/debug/safe_unordered_container.h: Replace debug.h with
assertions.h.
* include/debug/array: Replace safe_sequence.h include with
formatter.h and macros.h.
* include/debug/deque: Include functions.tcc.
* include/debug/forward_list: Likewise.
* include/debug/list: Likewise.
* include/debug/string: Likewise.
* include/debug/vector: Likewise.
* include/bits/unique_ptr.h: Replace debug.h include with new
assertions.h.
* include/bits/stl_iterator_base_funcs.h: Likewise.
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/array/tuple_interface/
tuple_element_debug_neg.cc: Likewise.
* src/c++11/debug.cc: Adapt.
Tested under Linux x86_64 debug mode.
Will commit in a couple of days if no complain.
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug.patch
Type: text/x-patch
Size: 46166 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20150525/5c38bf02/attachment.bin>
More information about the Libstdc++
mailing list