I have sent this letter to the stdcxx-dev@ at Friday, but its has not
reached, possible due to excess of a limit for the size of attachments.
I resend this letter. The source files are here:
http://zaripov.kiev.ua/src/
------------------------------------------------------------------------
------
The files attached is new tests of the list container with
supporting files and changes to the existing files.
ChangeLog:
* sigdefs.h: New header file with definitions of helpers macros
to define member and non-member functions overload id's
* 23.containers.h: New header file with definitions of helpers
used in clause 23 tests.
* 23.containers.cpp: Ditto.
* 21.strings.h: (StringIds): Inherited from ContainerIds
from 23.containers.h. Removed definitions, which is present
in 23.containers.h.
* 21.strings.cpp: Removed definitions, which is present
in 23.containers.h.
*23.list.h: New header file with definitions of helpers used
in clause 23.list tests.
* rw_char.h: Added declarations of the functions make_char(),
rw_widen(), rw_expand(), rw_narrow(), rw_match() for type X.
* char.cpp: Added definitions of the functions make_char(),
rw_widen(), rw_expand(), rw_narrow(), rw_match() for type X.
(_rw_expand): Added support of the type X.
(_rw_fmtstringv): Added support of the type X.
* 21.string.iterators.cpp (test_iterators): Fixed incorrect use
of RW_ASSERT().
* 23.list.iterators.cpp: New test exercising the list members:
begin(), end(), rbegin(), rend(), front(), back(), get_allocator().
*23.list.cons.cpp: New test exercising list constructors and
list<>::operator=.
It seems to be list ctors is not exception safe. The test 23.list.cons
asserts about leaks detected when exception is thrown during call the
ctor.
The list ctors calls _RWSTD_LIST_INSERT_RANGE macro which, if an
exception was catched, calls the _C_free_buffers() before rethrow.
But _C_free_buffers() just frees the memory without calling dtors
of the successfully allocated elements. The list dtor calls clear()
before call of _C_free_buffers().
<list>:
# define _RWSTD_NODE_LIST_FREE() \
_C_free_buffers ()
# define _RWSTD_LIST_INSERT_RANGE(b,e,v) \
_TRY { \
insert (b, e, v); \
} _CATCH (...) { \
_RWSTD_NODE_LIST_FREE(); \
_RETHROW; \
} typedef void __dummy_t
<list.cc>:
template <class _TypeT, class _Allocator>
list<_TypeT, _Allocator>::
~list ()
{
if (_C_node) {
clear ();
_C_put_node (_C_node);
_RWSTD_NODE_LIST_FREE ();
}
}
I'll write the simple test to situate this.
Farid.
|