[Cppunit-devel] patch to clean up warnings
Brought to you by:
blep
From: CppUnit d. m. l. <cpp...@li...> - 2006-11-22 03:25:44
|
Hello, I just went through the sources from CVS head and fixed three kinds of = warnings (from gcc -Wall): 1. class member initializers listed out of order 2. no virtual destructor in class with virtual functions 3. "statement has no effect", from CPPUNIT_ASSERT_THROW( 1234, ... ) There is a fourth error: 4. ISO C++ forbids casting between pointer-to-function and = pointer-to-object in cppunit/PlugInManager.cpp that apparently cannot be fixed=20 (http://www.trilithium.com/johan/2004/12/problem-with-dlsym/)=20 so I left it. Patch follows. -Steve Index: examples/cppunittest/MockFunctor.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cppunit/cppunit/examples/cppunittest/MockFunctor.h,v retrieving revision 1.2 diff -u -b -B -r1.2 MockFunctor.h --- examples/cppunittest/MockFunctor.h 7 May 2003 21:13:38 -0000 1.2 +++ examples/cppunittest/MockFunctor.h 22 Nov 2006 03:11:17 -0000 @@ -11,12 +11,12 @@ { public: MockFunctor() - : m_shouldThrow( false ) + : m_shouldSucceed( true ) + , m_shouldThrow( false ) , m_shouldThrowFailureException( false ) , m_hasExpectation( false ) , m_actualCallCount( 0 ) , m_expectedCallCount( 0 ) - , m_shouldSucceed( true ) { } =20 Index: examples/cppunittest/MockProtector.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cppunit/cppunit/examples/cppunittest/MockProtector.h,v retrieving revision 1.2 diff -u -b -B -r1.2 MockProtector.h --- examples/cppunittest/MockProtector.h 7 May 2003 21:13:38 -0000 1.2 +++ examples/cppunittest/MockProtector.h 22 Nov 2006 03:11:17 -0000 @@ -19,10 +19,10 @@ { public: MockProtector() - : m_expectException( false ) - , m_hasExpectation( false ) - , m_wasCalled( false ) + : m_wasCalled( false ) , m_wasTrapped( false ) + , m_expectException( false ) + , m_hasExpectation( false ) , m_shouldPropagateException( false ) { } Index: examples/cppunittest/TestAssertTest.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cppunit/cppunit/examples/cppunittest/TestAssertTest.cpp,v retrieving revision 1.9 diff -u -b -B -r1.9 TestAssertTest.cpp --- examples/cppunittest/TestAssertTest.cpp 5 Nov 2004 22:47:21 -0000 = 1.9 +++ examples/cppunittest/TestAssertTest.cpp 22 Nov 2006 03:11:17 -0000 @@ -45,7 +45,8 @@ =20 try { - CPPUNIT_ASSERT_THROW( 1234, std::string ); + int x; + CPPUNIT_ASSERT_THROW( x =3D 1234, std::string ); } catch ( CPPUNIT_NS::Exception & ) { @@ -59,7 +60,8 @@ void=20 TestAssertTest::testAssertNoThrow() { - CPPUNIT_ASSERT_NO_THROW( 1234 ); + int x; + CPPUNIT_ASSERT_NO_THROW( x =3D 1234 ); =20 try { @@ -80,7 +82,8 @@ =20 try { - CPPUNIT_ASSERT_ASSERTION_FAIL( 1234 ); + int x; + CPPUNIT_ASSERT_ASSERTION_FAIL( x =3D 1234 ); } catch ( CPPUNIT_NS::Exception & ) { @@ -94,8 +97,9 @@ void=20 TestAssertTest::testAssertAssertionPass() { - CPPUNIT_ASSERT_ASSERTION_PASS( 1234 ); + int x; + CPPUNIT_ASSERT_ASSERTION_PASS( x =3D 1234 ); =20 try { =20 Index: examples/cppunittest/XmlOutputterTest.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cppunit/cppunit/examples/cppunittest/XmlOutputterTest.cpp,v retrieving revision 1.13 diff -u -b -B -r1.13 XmlOutputterTest.cpp --- examples/cppunittest/XmlOutputterTest.cpp 13 Oct 2005 20:13:15 -0000 = 1.13 +++ examples/cppunittest/XmlOutputterTest.cpp 22 Nov 2006 03:11:17 -0000 @@ -230,11 +230,11 @@ int &statisticsCalls, int &successfulTestCalls, int &failedTestCalls ) - : m_successfulTestCalls( successfulTestCalls ) - , m_failedTestCalls( failedTestCalls ) - , m_beginCalls( beginCalls ) + : m_beginCalls( beginCalls ) , m_endCalls( endCalls ) , m_statisticsCalls( statisticsCalls ) + , m_successfulTestCalls( successfulTestCalls ) + , m_failedTestCalls( failedTestCalls ) { } =20 Index: examples/cppunittest/XmlUniformiser.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cppunit/cppunit/examples/cppunittest/XmlUniformiser.cpp,v retrieving revision 1.7 diff -u -b -B -r1.7 XmlUniformiser.cpp --- examples/cppunittest/XmlUniformiser.cpp 15 Mar 2003 10:21:44 -0000 = 1.7 +++ examples/cppunittest/XmlUniformiser.cpp 22 Nov 2006 03:11:17 -0000 @@ -41,8 +41,8 @@ =20 =20 XmlUniformiser::XmlUniformiser( const std::string &xml ) : - m_xml( xml ), - m_index( 0 ) + m_index( 0 ), + m_xml( xml ) { } =20 Index: examples/hierarchy/main.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cppunit/cppunit/examples/hierarchy/main.cpp,v retrieving revision 1.12 diff -u -b -B -r1.12 main.cpp --- examples/hierarchy/main.cpp 14 Jul 2002 19:48:31 -0000 1.12 +++ examples/hierarchy/main.cpp 22 Nov 2006 03:11:17 -0000 @@ -15,9 +15,9 @@ runner.addTest( BoardGameTest<BoardGame>::suite() ); runner.addTest( ChessTest<Chess>::suite() ); =20 - bool wasSucessful =3D runner.run(); + bool wasSuccessful =3D runner.run(); =20 // should be: // return wasSuccessful ? 0 : 1; - return 0; + return wasSuccessful ? 0 : 0; } Index: include/cppunit/XmlOutputterHook.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cppunit/cppunit/include/cppunit/XmlOutputterHook.h,v retrieving revision 1.5 diff -u -b -B -r1.5 XmlOutputterHook.h --- include/cppunit/XmlOutputterHook.h 9 Jul 2005 07:42:47 -0000 1.5 +++ include/cppunit/XmlOutputterHook.h 22 Nov 2006 03:11:17 -0000 @@ -153,6 +153,8 @@ */ virtual void statisticsAdded( XmlDocument *document, XmlElement *statisticsElement ); + + virtual ~XmlOutputterHook() {} }; =20 =20 Index: include/cppunit/extensions/TestFixtureFactory.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cppunit/cppunit/include/cppunit/extensions/TestFixtureFactory.h,= v retrieving revision 1.2 diff -u -b -B -r1.2 TestFixtureFactory.h --- include/cppunit/extensions/TestFixtureFactory.h 16 Sep 2002 18:36:52 = -0000 1.2 +++ include/cppunit/extensions/TestFixtureFactory.h 22 Nov 2006 03:11:17 = -0000 @@ -18,6 +18,8 @@ public: //! Creates a new TestFixture instance. virtual TestFixture *makeFixture() =3D0; + + virtual ~TestFixtureFactory() {} }; =20 =20 Index: include/cppunit/plugin/TestPlugIn.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cppunit/cppunit/include/cppunit/plugin/TestPlugIn.h,v retrieving revision 1.14 diff -u -b -B -r1.14 TestPlugIn.h --- include/cppunit/plugin/TestPlugIn.h 9 Jul 2005 07:42:47 -0000 1.14 +++ include/cppunit/plugin/TestPlugIn.h 22 Nov 2006 03:11:17 -0000 @@ -92,6 +92,8 @@ * unregistered. */ virtual void uninitialize( CPPUNIT_NS::TestFactoryRegistry *registry = ) =3D0; + + virtual ~CppUnitTestPlugIn() {} }; =20 =20 Index: src/DllPlugInTester/CommandLineParser.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cppunit/cppunit/src/DllPlugInTester/CommandLineParser.cpp,v retrieving revision 1.6 diff -u -b -B -r1.6 CommandLineParser.cpp --- src/DllPlugInTester/CommandLineParser.cpp 18 Jun 2004 08:15:29 -0000 = 1.6 +++ src/DllPlugInTester/CommandLineParser.cpp 22 Nov 2006 03:11:18 -0000 @@ -3,14 +3,14 @@ =20 CommandLineParser::CommandLineParser( int argc,=20 const char *argv[] ) - : m_currentArgument( 0 ) - , m_useCompiler( false ) + : m_useCompiler( false ) , m_useXml( false ) , m_briefProgress( false ) , m_noProgress( false ) , m_useText( false ) , m_useCout( false ) , m_waitBeforeExit( false ) + , m_currentArgument( 0 ) { for ( int index =3D1; index < argc; ++index ) { Index: src/cppunit/DynamicLibraryManagerException.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /cvsroot/cppunit/cppunit/src/cppunit/DynamicLibraryManagerException.cpp,v= retrieving revision 1.3 diff -u -b -B -r1.3 DynamicLibraryManagerException.cpp --- src/cppunit/DynamicLibraryManagerException.cpp 12 Jul 2002 05:59:57 = -0000 1.3 +++ src/cppunit/DynamicLibraryManagerException.cpp 22 Nov 2006 03:11:18 = -0000 @@ -9,8 +9,8 @@ const std::string = &libraryName, const std::string = &errorDetail, Cause cause ) - : m_cause( cause ) - , std::runtime_error( "" ) + : std::runtime_error( "" ), + m_cause( cause ) { if ( cause =3D=3D loadingFailed ) m_message =3D "Failed to load dynamic library: " + libraryName + = "\n" +=20 Index: src/cppunit/TestCaseDecorator.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cppunit/cppunit/src/cppunit/TestCaseDecorator.cpp,v retrieving revision 1.1 diff -u -b -B -r1.1 TestCaseDecorator.cpp --- src/cppunit/TestCaseDecorator.cpp 3 Aug 2002 15:47:52 -0000 1.1 +++ src/cppunit/TestCaseDecorator.cpp 22 Nov 2006 03:11:18 -0000 @@ -4,8 +4,8 @@ =20 =20 TestCaseDecorator::TestCaseDecorator( TestCase *test ) - : m_test( test ) - , TestCase( test->getName() ) + : TestCase( test->getName() ), + m_test( test ) {=20 } =20 Index: src/cppunit/TextTestRunner.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cppunit/cppunit/src/cppunit/TextTestRunner.cpp,v retrieving revision 1.20 diff -u -b -B -r1.20 TextTestRunner.cpp --- src/cppunit/TextTestRunner.cpp 29 Jun 2006 18:38:10 -0000 1.20 +++ src/cppunit/TextTestRunner.cpp 22 Nov 2006 03:11:18 -0000 @@ -18,9 +18,9 @@ * \param outputter used to print text result. Owned by the runner. */ TextTestRunner::TextTestRunner( Outputter *outputter )=20 - : m_outputter( outputter ) - , m_result( new TestResultCollector() ) + : m_result( new TestResultCollector() ) , m_eventManager( new TestResult() ) + , m_outputter( outputter ) { if ( !m_outputter ) m_outputter =3D new TextOutputter( m_result, stdCOut() ); Index: src/cppunit/XmlDocument.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/cppunit/cppunit/src/cppunit/XmlDocument.cpp,v retrieving revision 1.5 diff -u -b -B -r1.5 XmlDocument.cpp --- src/cppunit/XmlDocument.cpp 13 Oct 2005 20:13:16 -0000 1.5 +++ src/cppunit/XmlDocument.cpp 22 Nov 2006 03:11:18 -0000 @@ -8,8 +8,8 @@ =20 XmlDocument::XmlDocument( const std::string &encoding, const std::string &styleSheet ) - : m_rootElement( new XmlElement( "DummyRoot" ) ) - , m_styleSheet( styleSheet ) + : m_styleSheet( styleSheet ) + , m_rootElement( new XmlElement( "DummyRoot" ) ) , m_standalone( true ) { setEncoding( encoding ); |