[patch] Improving shared_ptr for C++0x

Jonathan Wakely jwakely.gcc@gmail.com
Tue Dec 11 13:31:00 GMT 2007


On 10/12/2007, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 10/12/2007, Benjamin Kosnik <bkoz@redhat.com> wrote:
> >
> > You should be testing std::shared_ptr in 20_util/shared_ptr, not
> > in the testsuite/tr1/ directories. (The type_traits bits are
> > tested this way too.) Please fix that up pre-checkin.
> >
> > The duplication is unfortunate but given the divergence, necessary IMHO.
>
> OK, I'll start work on copying those test files now.

This patch adds copies of all shared/weak_ptr tests under 20_utils.
The new tests in my previous patch (for move, aliasing, allocators
etc.) will now only appear under 20_utils, not
tr1/2_general_utilities.  Apart from removing those new tests my
previous patch for boost_share_ptr.h etc. is unchanged.

I preserved the copyright dates from the original tr1 tests, so a tr1
test from 2005 now has 2005, 2006, 2007 in the new c++0x copy, is that
right?

Final ChangeLog will look like:

	* include/tr1_impl/boost_shared_ptr.h: Add support for allocators,
	aliasing, make_shared and rvalue-references. Move __shared_count
	and _Sp_counted_* classes to new headers.
	* include/tr1_impl/boost_sp_counted_base.h: New.
	* include/bits/boost_sp_shared_count.h: New.
	* include/tr1/boost_sp_shared_count.h: New.
	* include/std/memory, include/tr1/memory: Include new headers.
	* include/Makefile.am: Adjust.
	* include/Makefile.in: Regenerate.
	* docs/html/20_util/shared_ptr.html: New.
	* docs/html/20_util/shared_ptr.html: New.
	* docs/html/17_intro/c++0x_status.html: Update shared_ptr status.
	* testsuite/20_util/shared_ptr/cons/alias.cc: New.
	* testsuite/20_util/shared_ptr/cons/alloc.cc: Likewise.
        * testsuite/20_util/shared_ptr/cons/move.cc: Likewise.
	* testsuite/20_util/shared_ptr/assign/move.cc: Likewise.
	* testsuite/20_util/shared_ptr/creation/alloc.cc: Likewise.
	* testsuite/20_util/shared_ptr/creation/make.cc: Likewise.
	* testsuite/20_util/shared_ptr/modifiers/reset_alloc.cc: Likewise.
        * testsuite/20_util/shared_ptr/assign/assign.cc: Duplicate tr1 test.
	* testsuite/20_util/shared_ptr/assign/auto_ptr.cc: Likewise.
	* testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/assign/dr541.cc: Likewise.
	* testsuite/20_util/shared_ptr/assign/shared_ptr.cc: Likewise.
	* testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/casts/1.cc: Likewise.
	* testsuite/20_util/shared_ptr/comparison/cmp.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/auto_ptr.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/copy.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/default.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/pointer.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/weak_ptr.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc: Likewise.
	* testsuite/20_util/shared_ptr/dest/dest.cc: Likewise.
	* testsuite/20_util/shared_ptr/misc/24595.cc: Likewise.
	* testsuite/20_util/shared_ptr/misc/io.cc: Likewise.
	* testsuite/20_util/shared_ptr/misc/swap.cc: Likewise.
	* testsuite/20_util/shared_ptr/modifiers/24805.cc: Likewise.
	* testsuite/20_util/shared_ptr/modifiers/reset.cc: Likewise.
	* testsuite/20_util/shared_ptr/modifiers/reset_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/modifiers/swap.cc: Likewise.
	* testsuite/20_util/shared_ptr/modifiers/swap_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/observers/bool_conv.cc: Likewise.
	* testsuite/20_util/shared_ptr/observers/get.cc: Likewise.
	* testsuite/20_util/shared_ptr/observers/unique.cc: Likewise.
	* testsuite/20_util/shared_ptr/observers/use_count.cc: Likewise.
	* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
        Likewise.
	* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise.
	* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/
        1.cc: Likewise.
	* testsuite/20_util/shared_ptr/requirements/explicit_instantiation/
        2.cc: Likewise.
	* testsuite/20_util/shared_ptr/requirements/explicit_instantiation.cc:
        Remove.
	* testsuite/20_util/weak_ptr/lock/1.cc: Duplicate tr1 test.
	* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc:
        Likewise.
	* testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc:
        Likewise.
	* testsuite/20_util/weak_ptr/requirements/explicit_instantiation.cc:
        Remove.

I noticed the explicit_instantiation tests don't instantiate bases and
members, so don't even get as far as __shared_ptr, which is where the
fun begins, and where bugs are more likely to lurk.  But instantiating
implementation details like _Sp_counted_ptr in the testsuite seems
wrong to me.

Jon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new_sp_tests.patch
Type: text/x-patch
Size: 101937 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20071211/907e87aa/attachment.bin>


More information about the Libstdc++ mailing list