[v3 patch] Add std::tr1::shared_ptr
Jonathan Wakely
cow@compsoc.man.ac.uk
Tue Feb 22 14:21:00 GMT 2005
On Mon, Feb 21, 2005 at 12:02:33PM -0600, Benjamin Kosnik wrote:
>
> > It'd be possible to get rid of that. I think easiest would be to run it
> > and expect it to fail at runtime (since it would throw with exceptions
> > enabled or abort() without). Does that sound OK?
>
> Sounds great.
I committed the code. The file that checked __EXCEPTIONS was split into
three XFAIL files that work with -fno-exceptions.
> > > All you need to do is make sure -fno-exceptions compiles cleanly. (It
> > > looks like you've tested this. Am I correct?)
> >
> > I did test it, but a while ago. I'll check again.
This patch makes another file an XFAIL and changes the other XFAILs to
ensures that we notice if a different exception to bad_weak_ptr is thrown.
OK to commit?
2005-02-22 Jonathan Wakely
* testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/
not_shared.cc: Add comments.
* testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/
not_shared2.cc: Check for wrong type of exception.
* testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/
not_shared3.cc: Likewise.
* testsuite/tr1/2_general_utilities/memory/shared_ptr/cons/
weak_ptr_expired.cc: Change test to XFAIL to behave consistently
when -fno-exceptions is used.
jon
--
Message terminated with signal 11, SIGFAULT
-------------- next part --------------
Index: testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared.cc,v
retrieving revision 1.1
diff -u -p -r1.1 not_shared.cc
--- testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared.cc 22 Feb 2005 00:10:19 -0000 1.1
+++ testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared.cc 22 Feb 2005 13:28:05 -0000
@@ -39,10 +39,12 @@ test01()
}
catch (const std::tr1::bad_weak_ptr&)
{
+ // Expected.
__throw_exception_again;
}
catch (...)
{
+ // Failed.
}
return 0;
Index: testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared2.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared2.cc,v
retrieving revision 1.1
diff -u -p -r1.1 not_shared2.cc
--- testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared2.cc 22 Feb 2005 00:10:19 -0000 1.1
+++ testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared2.cc 22 Feb 2005 13:28:05 -0000
@@ -41,8 +41,13 @@ test01()
}
catch (const std::tr1::bad_weak_ptr&)
{
+ // Expected.
__throw_exception_again;
}
+ catch (...)
+ {
+ // Failed.
+ }
return 0;
}
Index: testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared3.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared3.cc,v
retrieving revision 1.1
diff -u -p -r1.1 not_shared3.cc
--- testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared3.cc 22 Feb 2005 00:10:19 -0000 1.1
+++ testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/not_shared3.cc 22 Feb 2005 13:28:05 -0000
@@ -42,8 +42,13 @@ test01()
}
catch (const std::tr1::bad_weak_ptr&)
{
+ // Expected.
__throw_exception_again;
}
+ catch (...)
+ {
+ // Failed.
+ }
return 0;
}
Index: testsuite/tr1/2_general_utilities/memory/shared_ptr/cons/weak_ptr_expired.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/cons/weak_ptr_expired.cc,v
retrieving revision 1.1
diff -u -p -r1.1 weak_ptr_expired.cc
--- testsuite/tr1/2_general_utilities/memory/shared_ptr/cons/weak_ptr_expired.cc 22 Feb 2005 00:10:20 -0000 1.1
+++ testsuite/tr1/2_general_utilities/memory/shared_ptr/cons/weak_ptr_expired.cc 22 Feb 2005 13:28:05 -0000
@@ -1,3 +1,4 @@
+// { dg-do run { xfail *-*-* } }
// Copyright (C) 2005 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,6 +35,7 @@ test01()
std::tr1::shared_ptr<A> a1(new A);
std::tr1::weak_ptr<A> wa(a1);
a1.reset();
+ VERIFY( wa.expired() );
try
{
std::tr1::shared_ptr<A> a2(wa);
@@ -41,13 +43,12 @@ test01()
catch (const std::tr1::bad_weak_ptr&)
{
// Expected.
+ __throw_exception_again;
}
catch (...)
{
// Failed.
- __throw_exception_again;
}
- VERIFY( wa.expired() );
return 0;
}
More information about the Libstdc++
mailing list