summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-06-27 13:00:15 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-06-27 13:00:15 +0100
commit943e73cc0401df0fac2636e3676218c8e1219a05 (patch)
tree7817490766284610f95c1d841b16a6b46955bdd7
parent5f0b02d69d0799d729d35a555c038a65ee0e1e0e (diff)
downloadcppunit-943e73cc0401df0fac2636e3676218c8e1219a05.tar.gz
avoid the need to work around auto_ptr warnings by dropping that
-rw-r--r--include/cppunit/extensions/HelperMacros.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h
index c461b1b..5c68b03 100644
--- a/include/cppunit/extensions/HelperMacros.h
+++ b/include/cppunit/extensions/HelperMacros.h
@@ -165,18 +165,27 @@
*/
#define CPPUNIT_TEST_SUITE_END() \
} \
+ \
+ struct CppUnitExDeleter { /* avoid deprecated auto_ptr warnings */ \
+ CPPUNIT_NS::TestSuite *suite; \
+ ~CppUnitExDeleter() { delete suite; } \
+ CPPUNIT_NS::TestSuite *release() { \
+ CPPUNIT_NS::TestSuite *tmp = suite; suite = NULL; return tmp; \
+ } \
+ }; \
\
+public: \
static CPPUNIT_NS::TestSuite *suite() \
{ \
const CPPUNIT_NS::TestNamer &namer = getTestNamer__(); \
- std::auto_ptr<CPPUNIT_NS::TestSuite> suite( \
- new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \
+ CppUnitExDeleter guard; \
+ guard.suite = new CPPUNIT_NS::TestSuite( namer.getFixtureName() ); \
CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory; \
- CPPUNIT_NS::TestSuiteBuilderContextBase context( *suite.get(), \
+ CPPUNIT_NS::TestSuiteBuilderContextBase context( *guard.suite, \
namer, \
factory ); \
TestFixtureType::addTestsToSuite( context ); \
- return suite.release(); \
+ return guard.release(); \
} \
private: /* dummy typedef so that the macro can still end with ';'*/ \
typedef int CppUnitDummyTypedefForSemiColonEnding__