NEWS | 12 ++ configure.ac | 2 examples/ClockerPlugIn/ClockerPlugIn.cpp | 6 - examples/DumperPlugIn/DumperPlugIn.cpp | 2 examples/cppunittest/MockFunctor.h | 2 examples/cppunittest/MockTestCase.cpp | 4 examples/cppunittest/MockTestListener.cpp | 4 examples/cppunittest/TrackedTestCase.cpp | 14 +- include/cppunit/Asserter.h | 82 ++++++++-------- include/cppunit/BriefTestProgressListener.h | 8 - include/cppunit/CompilerOutputter.h | 4 include/cppunit/Exception.h | 4 include/cppunit/Message.h | 2 include/cppunit/Portability.h | 15 -- include/cppunit/SynchronizedObject.h | 2 include/cppunit/Test.h | 8 - include/cppunit/TestCase.h | 6 - include/cppunit/TestComposite.h | 8 - include/cppunit/TestFixture.h | 6 - include/cppunit/TestLeaf.h | 6 - include/cppunit/TestListener.h | 8 - include/cppunit/TestPath.h | 10 - include/cppunit/TestResult.h | 4 include/cppunit/TestResultCollector.h | 10 - include/cppunit/TestRunner.h | 8 - include/cppunit/TestSuccessListener.h | 6 - include/cppunit/TestSuite.h | 8 - include/cppunit/TextOutputter.h | 4 include/cppunit/TextTestProgressListener.h | 8 - include/cppunit/TextTestResult.h | 4 include/cppunit/XmlOutputter.h | 6 - include/cppunit/config/config-msvc6.h | 3 include/cppunit/extensions/RepeatedTest.h | 4 include/cppunit/extensions/TestCaseDecorator.h | 10 - include/cppunit/extensions/TestDecorator.h | 12 +- include/cppunit/extensions/TestFactoryRegistry.h | 4 include/cppunit/extensions/TestSetUp.h | 2 include/cppunit/extensions/TestSuiteBuilderContext.h | 4 include/cppunit/plugin/DynamicLibraryManager.h | 8 - include/cppunit/plugin/DynamicLibraryManagerException.h | 6 - include/cppunit/plugin/PlugInManager.h | 2 include/cppunit/plugin/TestPlugInDefaultImpl.h | 14 +- include/cppunit/portability/Stream.h | 2 include/cppunit/tools/XmlElement.h | 4 include/cppunit/ui/text/TextTestRunner.h | 6 - src/DllPlugInTester/CommandLineParserTest.cpp | 24 ++-- src/cppunit/Asserter.cpp | 24 ++-- src/cppunit/DefaultProtector.h | 2 src/cppunit/DynamicLibraryManager.cpp | 11 -- src/cppunit/DynamicLibraryManagerException.cpp | 2 src/cppunit/Exception.cpp | 6 - src/cppunit/PlugInManager.cpp | 2 src/cppunit/ProtectorChain.cpp | 2 src/cppunit/ProtectorChain.h | 4 src/cppunit/SynchronizedObject.cpp | 2 src/cppunit/Test.cpp | 8 - src/cppunit/TestCase.cpp | 2 src/cppunit/TestFactoryRegistry.cpp | 2 src/cppunit/TestFailure.cpp | 2 src/cppunit/TestLeaf.cpp | 2 src/cppunit/TypeInfoHelper.cpp | 4 src/cppunit/Win32DynamicLibraryManager.cpp | 6 - src/cppunit/XmlElement.cpp | 1 63 files changed, 223 insertions(+), 237 deletions(-)
New commits: commit d7049a6dd98ef12f0949f3ccfbc8ff4dbd63df2e Author: Markus Mohrhard <markus.mohrh...@googlemail.com> AuthorDate: Fri Oct 1 03:14:16 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 03:14:16 2021 +0800 add initial NEWS entries for 1.15.2 diff --git a/NEWS b/NEWS index 10520c2..9de7602 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ + New in CppUnit 1.15.2: + --------------------- + +* Portability: + + - Use more C++11 features and remove old and deprecated + C++ language features + + - Fix a few compiler warnings + New in CppUnit 1.15.1: --------------------- commit ae6bffb6caa0e68c6b3c85d4409141084cae84f5 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> AuthorDate: Fri Oct 1 03:13:56 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 03:13:56 2021 +0800 fix incorrect version reference in NEWS file diff --git a/NEWS b/NEWS index 57d95f5..10520c2 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ - New in CppUnit 1.15.0: + New in CppUnit 1.15.1: --------------------- * Portability: commit 5e8533adb35d6c1918d4cc826226100a27cc11b8 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> AuthorDate: Fri Oct 1 03:10:21 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 03:10:21 2021 +0800 work towards 1.15.2 There are no API changes yet so we can just release an updated version. diff --git a/configure.ac b/configure.ac index 18a9966..a591f45 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ AC_PREREQ([2.65]) # ==================== m4_define([cppunit_version_major],[1]) m4_define([cppunit_version_minor],[15]) -m4_define([cppunit_version_micro],[1]) +m4_define([cppunit_version_micro],[2]) m4_define([cppunit_version],[cppunit_version_major.cppunit_version_minor.cppunit_version_micro]) m4_define([cppunit_interface_age], [0]) m4_define([cppunit_binary_age], [0]) commit 240cb599d739c7d96138588f4a474c637d91e677 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> AuthorDate: Fri Oct 1 02:48:31 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 02:48:31 2021 +0800 remove a few trailing whitespaces diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h index 8858688..ca65593 100644 --- a/include/cppunit/Asserter.h +++ b/include/cppunit/Asserter.h @@ -19,23 +19,23 @@ class Message; * \code * #include <cppunit/SourceLine.h> * #include <cppunit/TestAssert.h> - * - * void + * + * void * checkXmlEqual( std::string expectedXml, * std::string actualXml, * CppUnit::SourceLine sourceLine ) * { * std::string expected = XmlUniformiser( expectedXml ).stripped(); * std::string actual = XmlUniformiser( actualXml ).stripped(); - * + * * if ( expected == actual ) * return; - * + * * ::CppUnit::Asserter::failNotEqual( expected, * actual, * sourceLine ); * } - * + * * /// Asserts that two XML strings are equivalent. * #define CPPUNITTEST_ASSERT_XML_EQUAL( expected, actual ) \ * checkXmlEqual( expected, actual, \ @@ -47,14 +47,14 @@ struct Asserter { /*! \brief Throws a Exception with the specified message and location. */ - [[noreturn]] static void CPPUNIT_API fail( const Message &message, - const SourceLine &sourceLine = SourceLine() ); + [[noreturn]] static void CPPUNIT_API fail( const Message &message, + const SourceLine &sourceLine = SourceLine() ); /*! \brief Throws a Exception with the specified message and location. * \deprecated Use fail( Message, SourceLine ) instead. */ - [[noreturn]] static void CPPUNIT_API fail( std::string message, - const SourceLine &sourceLine = SourceLine() ); + [[noreturn]] static void CPPUNIT_API fail( std::string message, + const SourceLine &sourceLine = SourceLine() ); /*! \brief Throws a Exception with the specified message and location. * \param shouldFail if \c true then the exception is thrown. Otherwise @@ -62,8 +62,8 @@ struct Asserter * \param message Message explaining the assertion failiure. * \param sourceLine Location of the assertion. */ - static void CPPUNIT_API failIf( bool shouldFail, - const Message &message, + static void CPPUNIT_API failIf( bool shouldFail, + const Message &message, const SourceLine &sourceLine = SourceLine() ); /*! \brief Throws a Exception with the specified message and location. @@ -73,13 +73,13 @@ struct Asserter * \param message Message explaining the assertion failiure. * \param sourceLine Location of the assertion. */ - static void CPPUNIT_API failIf( bool shouldFail, - std::string message, + static void CPPUNIT_API failIf( bool shouldFail, + std::string message, const SourceLine &sourceLine = SourceLine() ); /*! \brief Returns a expected value string for a message, case equal than * Typically used to create 'not equal' message, or to check that a message - * contains the expected content when writing unit tests for your custom + * contains the expected content when writing unit tests for your custom * assertions. * * \param expectedValue String that represents the expected value. @@ -90,7 +90,7 @@ struct Asserter static std::string CPPUNIT_API makeExpected( const std::string &expectedValue ); /*! \brief Returns a expected value string for a message, case equal than * Typically used to create 'not equal' message, or to check that a message - * contains the expected content when writing unit tests for your custom + * contains the expected content when writing unit tests for your custom * assertions. * * \param expectedValue String that represents the expected value. @@ -129,7 +129,7 @@ struct Asserter /*! \brief Returns an actual value string for a message. * Typically used to create 'not equal' message, or to check that a message - * contains the expected content when writing unit tests for your custom + * contains the expected content when writing unit tests for your custom * assertions. * * \param actualValue String that represents the actual value. @@ -140,7 +140,7 @@ struct Asserter /*! * \deprecated Use makeMessage instead - */ + */ static Message CPPUNIT_API makeNotEqualMessage( const std::string &expectedValue, const std::string &actualValue, const AdditionalMessage &additionalMessage = AdditionalMessage(), @@ -159,8 +159,8 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - [[noreturn]] static void CPPUNIT_API failNotEqual( std::string expected, - std::string actual, + [[noreturn]] static void CPPUNIT_API failNotEqual( std::string expected, + std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage = AdditionalMessage(), std::string shortDescription = "equality assertion failed" ); @@ -231,8 +231,8 @@ struct Asserter * \param shortDescription Short description for the failure message. */ static void CPPUNIT_API failNotEqualIf( bool shouldFail, - std::string expected, - std::string actual, + std::string expected, + std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage = AdditionalMessage(), std::string shortDescription = "equality assertion failed" ); diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp index 9e74f1d..52f8625 100644 --- a/src/cppunit/Asserter.cpp +++ b/src/cppunit/Asserter.cpp @@ -23,7 +23,7 @@ Asserter::fail( const Message &message, } -void +void Asserter::failIf( bool shouldFail, const Message &message, const SourceLine &sourceLine ) @@ -33,7 +33,7 @@ Asserter::failIf( bool shouldFail, } -void +void Asserter::failIf( bool shouldFail, std::string message, const SourceLine &sourceLine ) @@ -77,7 +77,7 @@ Asserter::makeExpectedGreaterEqual( const std::string& expectedValue ) return "Expected greater or equal than: " + expectedValue; } -std::string +std::string Asserter::makeActual( const std::string &actualValue ) { return "Actual : " + actualValue; @@ -99,7 +99,7 @@ Asserter::makeMessage( const std::string& expectedMessage, } -Message +Message Asserter::makeNotEqualMessage( const std::string &expectedValue, const std::string &actualValue, const AdditionalMessage &additionalMessage, @@ -109,7 +109,7 @@ Asserter::makeNotEqualMessage( const std::string &expectedValue, } -void +void Asserter::failNotEqual( std::string expected, std::string actual, const SourceLine &sourceLine, @@ -180,7 +180,7 @@ Asserter::failNotGreaterEqual( std::string expected, additionalMessage ), sourceLine ); } -void +void Asserter::failNotEqualIf( bool shouldFail, std::string expected, std::string actual, commit 84237a0161e7867a1313d07cda33aeb99818ddf1 Author: Florian Becker <f...@vxapps.com> AuthorDate: Fri Oct 1 02:47:08 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 02:47:08 2021 +0800 avoid a few annoying compiler warnings diff --git a/include/cppunit/TestListener.h b/include/cppunit/TestListener.h index 330262d..fce6c37 100644 --- a/include/cppunit/TestListener.h +++ b/include/cppunit/TestListener.h @@ -125,8 +125,8 @@ public: * \param test Test that is going to be run. * \param eventManager Event manager used for the test run. */ - virtual void startTestRun( Test * /*test*/, - TestResult * /*eventManager*/ ) {} + virtual void startTestRun( Test *test, + TestResult *eventManager ) { ( void )test; ( void )eventManager; } /*! \brief Called by a TestRunner after running the test. * @@ -136,8 +136,8 @@ public: * \param test Test that was run. * \param eventManager Event manager used for the test run. */ - virtual void endTestRun( Test * /*test*/, - TestResult * /*eventManager*/ ) {} + virtual void endTestRun( Test * test, + TestResult *eventManager ) { ( void )test; ( void )eventManager; } }; diff --git a/src/cppunit/DynamicLibraryManager.cpp b/src/cppunit/DynamicLibraryManager.cpp index 9471870..56bd294 100644 --- a/src/cppunit/DynamicLibraryManager.cpp +++ b/src/cppunit/DynamicLibraryManager.cpp @@ -36,7 +36,6 @@ DynamicLibraryManager::findSymbol( const std::string &symbol ) throw DynamicLibraryManagerException( m_libraryName, symbol, DynamicLibraryManagerException::symbolNotFound ); - return nullptr; // keep compiler happy } diff --git a/src/cppunit/XmlElement.cpp b/src/cppunit/XmlElement.cpp index 691cde1..585c3da 100644 --- a/src/cppunit/XmlElement.cpp +++ b/src/cppunit/XmlElement.cpp @@ -124,7 +124,6 @@ XmlElement::elementFor( const std::string &name ) const } throw std::invalid_argument( "XmlElement::elementFor(), not matching child element found" ); - return nullptr; // make some compilers happy. } commit a31e2451e763f918ec900e6dfb0e63cf505f8cda Author: Florian Becker <f...@vxapps.com> AuthorDate: Fri Oct 1 02:45:02 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 02:45:02 2021 +0800 replace 0 with nullptr when assigning to a pointer diff --git a/include/cppunit/SynchronizedObject.h b/include/cppunit/SynchronizedObject.h index 59c3cbb..68bd0cf 100644 --- a/include/cppunit/SynchronizedObject.h +++ b/include/cppunit/SynchronizedObject.h @@ -36,7 +36,7 @@ public: /*! Constructs a SynchronizedObject object. */ - SynchronizedObject( SynchronizationObject *syncObject =0 ); + SynchronizedObject( SynchronizationObject *syncObject = nullptr ); /// Destructor. virtual ~SynchronizedObject(); diff --git a/include/cppunit/TestResult.h b/include/cppunit/TestResult.h index 3c4ddc9..7dc2402 100644 --- a/include/cppunit/TestResult.h +++ b/include/cppunit/TestResult.h @@ -48,7 +48,7 @@ class CPPUNIT_API TestResult : protected SynchronizedObject { public: /// Construct a TestResult - TestResult( SynchronizationObject *syncObject = 0 ); + TestResult( SynchronizationObject *syncObject = nullptr ); /// Destroys a test result virtual ~TestResult() override; diff --git a/include/cppunit/TestResultCollector.h b/include/cppunit/TestResultCollector.h index 287f019..314f1cc 100644 --- a/include/cppunit/TestResultCollector.h +++ b/include/cppunit/TestResultCollector.h @@ -37,7 +37,7 @@ public: /*! Constructs a TestResultCollector object. */ - TestResultCollector( SynchronizationObject *syncObject = 0 ); + TestResultCollector( SynchronizationObject *syncObject = nullptr ); /// Destructor. virtual ~TestResultCollector() override; diff --git a/include/cppunit/TestSuccessListener.h b/include/cppunit/TestSuccessListener.h index 18de362..714fbf6 100644 --- a/include/cppunit/TestSuccessListener.h +++ b/include/cppunit/TestSuccessListener.h @@ -17,7 +17,7 @@ class CPPUNIT_API TestSuccessListener : public TestListener, public: /*! Constructs a TestSuccessListener object. */ - TestSuccessListener( SynchronizationObject *syncObject = 0 ); + TestSuccessListener( SynchronizationObject *syncObject = nullptr ); /// Destructor. virtual ~TestSuccessListener() override; diff --git a/src/cppunit/SynchronizedObject.cpp b/src/cppunit/SynchronizedObject.cpp index 1764538..489f378 100644 --- a/src/cppunit/SynchronizedObject.cpp +++ b/src/cppunit/SynchronizedObject.cpp @@ -5,7 +5,7 @@ CPPUNIT_NS_BEGIN SynchronizedObject::SynchronizedObject( SynchronizationObject *syncObject ) - : m_syncObject( syncObject == 0 ? new SynchronizationObject() : + : m_syncObject( syncObject == nullptr ? new SynchronizationObject() : syncObject ) { } diff --git a/src/cppunit/TypeInfoHelper.cpp b/src/cppunit/TypeInfoHelper.cpp index aa24a80..2472077 100644 --- a/src/cppunit/TypeInfoHelper.cpp +++ b/src/cppunit/TypeInfoHelper.cpp @@ -17,12 +17,12 @@ TypeInfoHelper::getClassName( const std::type_info &info ) #if defined(CPPUNIT_HAVE_GCC_ABI_DEMANGLE) && CPPUNIT_HAVE_GCC_ABI_DEMANGLE int status = 0; - char* c_name = 0; + char* c_name = nullptr; const char* c_origName = info.name(); if(c_origName[0] == '*') ++c_origName; - c_name = abi::__cxa_demangle( c_origName, 0, 0, &status ); + c_name = abi::__cxa_demangle( c_origName, nullptr, nullptr, &status ); std::string name; if(c_name) commit 40fd60a4743a9e587b197a3991bb5f7e451e6b8a Author: Markus Mohrhard <markus.mohrh...@googlemail.com> AuthorDate: Fri Oct 1 02:41:11 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 02:41:49 2021 +0800 get rid of old casting macros diff --git a/examples/cppunittest/MockFunctor.h b/examples/cppunittest/MockFunctor.h index 888273b..d739d74 100644 --- a/examples/cppunittest/MockFunctor.h +++ b/examples/cppunittest/MockFunctor.h @@ -23,7 +23,7 @@ public: bool operator()() const { - ++CPPUNIT_CONST_CAST(MockFunctor *,this)->m_actualCallCount; + ++const_cast<MockFunctor*>( this )->m_actualCallCount; if ( m_shouldThrow ) { diff --git a/examples/cppunittest/MockTestCase.cpp b/examples/cppunittest/MockTestCase.cpp index 033bba5..ae01193 100644 --- a/examples/cppunittest/MockTestCase.cpp +++ b/examples/cppunittest/MockTestCase.cpp @@ -33,7 +33,7 @@ MockTestCase::~MockTestCase() int MockTestCase::countTestCases() const { - MockTestCase *mutableThis = CPPUNIT_CONST_CAST(MockTestCase *, this ); + MockTestCase *mutableThis = const_cast<MockTestCase*>( this ); ++mutableThis->m_actualCountTestCasesCallCount; if ( m_expectCountTestCasesCall ) { diff --git a/include/cppunit/Portability.h b/include/cppunit/Portability.h index c2e3bd0..4efa9af 100644 --- a/include/cppunit/Portability.h +++ b/include/cppunit/Portability.h @@ -73,21 +73,6 @@ #endif #endif -// If CPPUNIT_HAVE_CPP_CAST is defined, then c++ style cast will be used, -// otherwise, C style cast are used. -#if defined( CPPUNIT_HAVE_CPP_CAST ) -# define CPPUNIT_CONST_CAST( TargetType, pointer ) \ - const_cast<TargetType>( pointer ) - -# define CPPUNIT_STATIC_CAST( TargetType, pointer ) \ - static_cast<TargetType>( pointer ) -#else // defined( CPPUNIT_HAVE_CPP_CAST ) -# define CPPUNIT_CONST_CAST( TargetType, pointer ) \ - ((TargetType)( pointer )) -# define CPPUNIT_STATIC_CAST( TargetType, pointer ) \ - ((TargetType)( pointer )) -#endif // defined( CPPUNIT_HAVE_CPP_CAST ) - // If CPPUNIT_NO_STD_NAMESPACE is defined then STL are in the global space. // => Define macro 'std' to nothing #if defined(CPPUNIT_NO_STD_NAMESPACE) diff --git a/include/cppunit/config/config-msvc6.h b/include/cppunit/config/config-msvc6.h index 0edc059..ac03c89 100644 --- a/include/cppunit/config/config-msvc6.h +++ b/include/cppunit/config/config-msvc6.h @@ -47,9 +47,6 @@ # define CPPUNIT_COMPILER_LOCATION_FORMAT "%p(%l):" #endif -// Define to 1 if the compiler support C++ style cast. -#define CPPUNIT_HAVE_CPP_CAST 1 - /* define to 1 if the compiler has _finite() */ #ifndef CPPUNIT_HAVE__FINITE #define CPPUNIT_HAVE__FINITE 1 diff --git a/include/cppunit/extensions/TestSuiteBuilderContext.h b/include/cppunit/extensions/TestSuiteBuilderContext.h index f66a203..acea374 100644 --- a/include/cppunit/extensions/TestSuiteBuilderContext.h +++ b/include/cppunit/extensions/TestSuiteBuilderContext.h @@ -135,7 +135,7 @@ public: */ FixtureType *makeFixture() const { - return CPPUNIT_STATIC_CAST( FixtureType *, + return static_cast<FixtureType*>( TestSuiteBuilderContextBase::makeTestFixture() ); } }; diff --git a/src/cppunit/Exception.cpp b/src/cppunit/Exception.cpp index 9401fbc..969e716 100644 --- a/src/cppunit/Exception.cpp +++ b/src/cppunit/Exception.cpp @@ -70,7 +70,7 @@ Exception::operator =( const Exception& other ) const char* Exception::what() const noexcept { - Exception *mutableThis = CPPUNIT_CONST_CAST( Exception *, this ); + Exception *mutableThis = const_cast<Exception*>( this ); mutableThis->m_whatMessage = m_message.shortDescription() + "\n" + m_message.details(); return m_whatMessage.c_str(); diff --git a/src/cppunit/Test.cpp b/src/cppunit/Test.cpp index fef8be7..010ea15 100644 --- a/src/cppunit/Test.cpp +++ b/src/cppunit/Test.cpp @@ -19,7 +19,7 @@ Test * Test::findTest( const std::string &testName ) const { TestPath path; - Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); + Test *mutableThis = const_cast<Test*>( this ); mutableThis->findTestPath( testName, path ); if ( !path.isValid() ) throw std::invalid_argument( "No test named <" + testName + "> found in test <" @@ -32,7 +32,7 @@ bool Test::findTestPath( const std::string &testName, TestPath &testPath ) const { - Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); + Test *mutableThis = const_cast<Test*>( this ); if ( getName() == testName ) { testPath.add( mutableThis ); @@ -57,7 +57,7 @@ bool Test::findTestPath( const Test *test, TestPath &testPath ) const { - Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); + Test *mutableThis = const_cast<Test*>( this ); if ( this == test ) { testPath.add( mutableThis ); @@ -81,7 +81,7 @@ Test::findTestPath( const Test *test, TestPath Test::resolveTestPath( const std::string &testPath ) const { - Test *mutableThis = CPPUNIT_CONST_CAST( Test *, this ); + Test *mutableThis = const_cast<Test*>( this ); return TestPath( mutableThis, testPath ); } commit 6e077ed0705d9bf67f1b643eec367d5815a589b2 Author: Florian Becker <f...@vxapps.com> AuthorDate: Fri Oct 1 02:30:54 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 02:30:54 2021 +0800 remove superfluous semicolons diff --git a/include/cppunit/Message.h b/include/cppunit/Message.h index c3d8d92..b08b721 100644 --- a/include/cppunit/Message.h +++ b/include/cppunit/Message.h @@ -34,7 +34,7 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API Message { public: - Message() {}; + Message() {} // Ensure thread-safe copy by detaching the string. Message( const Message &other ); diff --git a/include/cppunit/Test.h b/include/cppunit/Test.h index 2a8fada..3a20b36 100644 --- a/include/cppunit/Test.h +++ b/include/cppunit/Test.h @@ -25,7 +25,7 @@ class TestPath; class CPPUNIT_API Test { public: - virtual ~Test() {}; + virtual ~Test() {} /*! \brief Run the test, collecting results. */ diff --git a/include/cppunit/TestFixture.h b/include/cppunit/TestFixture.h index 1223adb..da854b6 100644 --- a/include/cppunit/TestFixture.h +++ b/include/cppunit/TestFixture.h @@ -83,13 +83,13 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API TestFixture { public: - virtual ~TestFixture() {}; + virtual ~TestFixture() {} //! \brief Set up context before running a test. - virtual void setUp() {}; + virtual void setUp() {} //! Clean up after the test run. - virtual void tearDown() {}; + virtual void tearDown() {} }; commit ed24ec011df58256ac275d434eba131027843184 Author: Florian Becker <f...@vxapps.com> AuthorDate: Fri Oct 1 02:26:40 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 02:27:37 2021 +0800 switch from throw() to noexcept diff --git a/include/cppunit/plugin/DynamicLibraryManagerException.h b/include/cppunit/plugin/DynamicLibraryManagerException.h index 74199ff..dc6402e 100644 --- a/include/cppunit/plugin/DynamicLibraryManagerException.h +++ b/include/cppunit/plugin/DynamicLibraryManagerException.h @@ -32,13 +32,9 @@ public: const std::string &errorDetail, Cause cause ); - ~DynamicLibraryManagerException() throw() - { - } - Cause getCause() const; - const char *what() const throw() override; + const char *what() const noexcept override; private: std::string m_message; diff --git a/src/cppunit/DynamicLibraryManagerException.cpp b/src/cppunit/DynamicLibraryManagerException.cpp index d5a89d8..1d99fd1 100644 --- a/src/cppunit/DynamicLibraryManagerException.cpp +++ b/src/cppunit/DynamicLibraryManagerException.cpp @@ -28,7 +28,7 @@ DynamicLibraryManagerException::getCause() const const char * -DynamicLibraryManagerException::what() const throw() +DynamicLibraryManagerException::what() const noexcept { return m_message.c_str(); } diff --git a/src/cppunit/Exception.cpp b/src/cppunit/Exception.cpp index 6685480..9401fbc 100644 --- a/src/cppunit/Exception.cpp +++ b/src/cppunit/Exception.cpp @@ -44,7 +44,7 @@ Exception::Exception( std::string message, #endif -Exception::~Exception() throw() +Exception::~Exception() noexcept { } @@ -68,7 +68,7 @@ Exception::operator =( const Exception& other ) const char* -Exception::what() const throw() +Exception::what() const noexcept { Exception *mutableThis = CPPUNIT_CONST_CAST( Exception *, this ); mutableThis->m_whatMessage = m_message.shortDescription() + "\n" + commit 4a09e067ec7ba06bc89cf30075f4befc892945d9 Author: Florian Becker <f...@vxapps.com> AuthorDate: Fri Oct 1 02:25:02 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 02:27:28 2021 +0800 add override annotations diff --git a/include/cppunit/BriefTestProgressListener.h b/include/cppunit/BriefTestProgressListener.h index 137ca44..b97be20 100644 --- a/include/cppunit/BriefTestProgressListener.h +++ b/include/cppunit/BriefTestProgressListener.h @@ -18,13 +18,13 @@ public: BriefTestProgressListener(); /// Destructor. - virtual ~BriefTestProgressListener(); + virtual ~BriefTestProgressListener() override; - void startTest( Test *test ); + void startTest( Test *test ) override; - void addFailure( const TestFailure &failure ); + void addFailure( const TestFailure &failure ) override; - void endTest( Test *test ); + void endTest( Test *test ) override; private: /// Prevents the use of the copy constructor. diff --git a/include/cppunit/CompilerOutputter.h b/include/cppunit/CompilerOutputter.h index 885fe65..7c374c9 100644 --- a/include/cppunit/CompilerOutputter.h +++ b/include/cppunit/CompilerOutputter.h @@ -68,7 +68,7 @@ public: const std::string &locationFormat = CPPUNIT_COMPILER_LOCATION_FORMAT ); /// Destructor. - virtual ~CompilerOutputter(); + virtual ~CompilerOutputter() override; /*! \brief Sets the error location format. * @@ -102,7 +102,7 @@ public: static CompilerOutputter *defaultOutputter( TestResultCollector *result, OStream &stream ); - void write(); + void write() override; void setNoWrap(); diff --git a/include/cppunit/Exception.h b/include/cppunit/Exception.h index bf5fcac..90bedd4 100644 --- a/include/cppunit/Exception.h +++ b/include/cppunit/Exception.h @@ -41,13 +41,13 @@ public: Exception( const Exception &other ); /// Destructs the exception - virtual ~Exception() throw(); + virtual ~Exception() noexcept override; /// Performs an assignment Exception &operator =( const Exception &other ); /// Returns descriptive message - const char *what() const throw(); + const char *what() const noexcept override; /// Location where the error occured SourceLine sourceLine() const; diff --git a/include/cppunit/TestCase.h b/include/cppunit/TestCase.h index d4b7a46..e966854 100644 --- a/include/cppunit/TestCase.h +++ b/include/cppunit/TestCase.h @@ -33,11 +33,11 @@ public: TestCase(); - ~TestCase(); + ~TestCase() override; - virtual void run(TestResult *result); + virtual void run(TestResult *result) override; - std::string getName() const; + std::string getName() const override; //! FIXME: this should probably be pure virtual. virtual void runTest(); diff --git a/include/cppunit/TestComposite.h b/include/cppunit/TestComposite.h index 0ded95f..4f3fff3 100644 --- a/include/cppunit/TestComposite.h +++ b/include/cppunit/TestComposite.h @@ -19,13 +19,13 @@ class CPPUNIT_API TestComposite : public Test public: TestComposite( const std::string &name = "" ); - ~TestComposite(); + ~TestComposite() override; - void run( TestResult *result ); + void run( TestResult *result ) override; - int countTestCases() const; + int countTestCases() const override; - std::string getName() const; + std::string getName() const override; private: TestComposite( const TestComposite &other ); diff --git a/include/cppunit/TestLeaf.h b/include/cppunit/TestLeaf.h index c83b075..d41bca7 100644 --- a/include/cppunit/TestLeaf.h +++ b/include/cppunit/TestLeaf.h @@ -23,7 +23,7 @@ public: * \return 1. * \see Test::countTestCases(). */ - int countTestCases() const; + int countTestCases() const override; /*! Returns the number of child of this test case: 0. * @@ -31,12 +31,12 @@ public: * * \return 0. */ - int getChildTestCount() const; + int getChildTestCount() const override; /*! Always throws std::out_of_range. * \see Test::doGetChildTestAt(). */ - Test *doGetChildTestAt( int index ) const; + Test *doGetChildTestAt( int index ) const override; }; CPPUNIT_NS_END diff --git a/include/cppunit/TestResult.h b/include/cppunit/TestResult.h index aabd80b..3c4ddc9 100644 --- a/include/cppunit/TestResult.h +++ b/include/cppunit/TestResult.h @@ -51,7 +51,7 @@ public: TestResult( SynchronizationObject *syncObject = 0 ); /// Destroys a test result - virtual ~TestResult(); + virtual ~TestResult() override; virtual void addListener( TestListener *listener ); diff --git a/include/cppunit/TestResultCollector.h b/include/cppunit/TestResultCollector.h index b78c978..287f019 100644 --- a/include/cppunit/TestResultCollector.h +++ b/include/cppunit/TestResultCollector.h @@ -40,12 +40,12 @@ public: TestResultCollector( SynchronizationObject *syncObject = 0 ); /// Destructor. - virtual ~TestResultCollector(); + virtual ~TestResultCollector() override; - void startTest( Test *test ); - void addFailure( const TestFailure &failure ); + void startTest( Test *test ) override; + void addFailure( const TestFailure &failure ) override; - virtual void reset(); + virtual void reset() override; virtual int runTests() const; virtual int testErrors() const; diff --git a/include/cppunit/TestRunner.h b/include/cppunit/TestRunner.h index 930370a..ba854e1 100644 --- a/include/cppunit/TestRunner.h +++ b/include/cppunit/TestRunner.h @@ -102,14 +102,14 @@ protected: public: WrappingSuite( const std::string &name = "All Tests" ); - int getChildTestCount() const; + int getChildTestCount() const override; - std::string getName() const; + std::string getName() const override; - void run( TestResult *result ); + void run( TestResult *result ) override; protected: - Test *doGetChildTestAt( int index ) const; + Test *doGetChildTestAt( int index ) const override; bool hasOnlyOneTest() const; diff --git a/include/cppunit/TestSuccessListener.h b/include/cppunit/TestSuccessListener.h index 60c5ff5..18de362 100644 --- a/include/cppunit/TestSuccessListener.h +++ b/include/cppunit/TestSuccessListener.h @@ -20,11 +20,11 @@ public: TestSuccessListener( SynchronizationObject *syncObject = 0 ); /// Destructor. - virtual ~TestSuccessListener(); + virtual ~TestSuccessListener() override; virtual void reset(); - void addFailure( const TestFailure &failure ); + void addFailure( const TestFailure &failure ) override; /// Returns whether the entire test was successful or not. virtual bool wasSuccessful() const; diff --git a/include/cppunit/TestSuite.h b/include/cppunit/TestSuite.h index e02d1e2..9b613c5 100644 --- a/include/cppunit/TestSuite.h +++ b/include/cppunit/TestSuite.h @@ -44,7 +44,7 @@ public: */ TestSuite( std::string name = "" ); - ~TestSuite(); + ~TestSuite() override; /*! Adds the specified test to the suite. * \param test Test to add. Must not be \c nullptr. @@ -62,9 +62,9 @@ public: */ virtual void deleteContents(); - int getChildTestCount() const; + int getChildTestCount() const override; - Test *doGetChildTestAt( int index ) const; + Test *doGetChildTestAt( int index ) const override; private: std::vector<Test *> m_tests; diff --git a/include/cppunit/TextOutputter.h b/include/cppunit/TextOutputter.h index 6bd9cea..ee63556 100644 --- a/include/cppunit/TextOutputter.h +++ b/include/cppunit/TextOutputter.h @@ -24,9 +24,9 @@ public: OStream &stream ); /// Destructor. - virtual ~TextOutputter(); + virtual ~TextOutputter() override; - void write(); + void write() override; virtual void printFailures(); virtual void printHeader(); diff --git a/include/cppunit/TextTestProgressListener.h b/include/cppunit/TextTestProgressListener.h index 7521c40..090ea3e 100644 --- a/include/cppunit/TextTestProgressListener.h +++ b/include/cppunit/TextTestProgressListener.h @@ -19,14 +19,14 @@ public: TextTestProgressListener(); /// Destructor. - virtual ~TextTestProgressListener(); + virtual ~TextTestProgressListener() override; - void startTest( Test *test ); + void startTest( Test *test ) override; - void addFailure( const TestFailure &failure ); + void addFailure( const TestFailure &failure ) override; void endTestRun( Test *test, - TestResult *eventManager ); + TestResult *eventManager ) override; private: /// Prevents the use of the copy constructor. diff --git a/include/cppunit/TextTestResult.h b/include/cppunit/TextTestResult.h index 63937b0..4f9807e 100644 --- a/include/cppunit/TextTestResult.h +++ b/include/cppunit/TextTestResult.h @@ -23,8 +23,8 @@ class CPPUNIT_API TextTestResult : public TestResult, public: TextTestResult(); - virtual void addFailure( const TestFailure &failure ); - virtual void startTest( Test *test ); + virtual void addFailure( const TestFailure &failure ) override; + virtual void startTest( Test *test ) override; virtual void print( OStream &stream ); using TestResult::addFailure; diff --git a/include/cppunit/XmlOutputter.h b/include/cppunit/XmlOutputter.h index 36fe954..3c705f3 100644 --- a/include/cppunit/XmlOutputter.h +++ b/include/cppunit/XmlOutputter.h @@ -49,7 +49,7 @@ public: const std::string& encoding = std::string("ISO-8859-1") ); /// Destructor. - virtual ~XmlOutputter(); + virtual ~XmlOutputter() override; /*! \brief Adds the specified hook to the outputter. * \param hook Hook to add. Must not be \c nullptr. @@ -66,7 +66,7 @@ public: * Refer to examples/cppunittest/XmlOutputterTest.cpp for example * of use and XML document structure. */ - virtual void write(); + virtual void write() override; /*! \brief Sets the XSL style sheet used. * diff --git a/include/cppunit/extensions/RepeatedTest.h b/include/cppunit/extensions/RepeatedTest.h index 390ce48..d379201 100644 --- a/include/cppunit/extensions/RepeatedTest.h +++ b/include/cppunit/extensions/RepeatedTest.h @@ -25,9 +25,9 @@ public: { } - void run( TestResult *result ); + void run( TestResult *result ) override; - int countTestCases() const; + int countTestCases() const override; private: RepeatedTest( const RepeatedTest & ); diff --git a/include/cppunit/extensions/TestCaseDecorator.h b/include/cppunit/extensions/TestCaseDecorator.h index effde25..a7d98f7 100644 --- a/include/cppunit/extensions/TestCaseDecorator.h +++ b/include/cppunit/extensions/TestCaseDecorator.h @@ -19,15 +19,15 @@ class CPPUNIT_API TestCaseDecorator : public TestCase { public: TestCaseDecorator( TestCase *test ); - ~TestCaseDecorator(); + ~TestCaseDecorator() override; - std::string getName() const; + std::string getName() const override; - void setUp(); + void setUp() override; - void tearDown(); + void tearDown() override; - void runTest(); + void runTest() override; protected: TestCase *m_test; diff --git a/include/cppunit/extensions/TestDecorator.h b/include/cppunit/extensions/TestDecorator.h index 1c63b63..18565a2 100644 --- a/include/cppunit/extensions/TestDecorator.h +++ b/include/cppunit/extensions/TestDecorator.h @@ -22,18 +22,18 @@ class CPPUNIT_API TestDecorator : public Test { public: TestDecorator( Test *test ); - ~TestDecorator(); + ~TestDecorator() override; - int countTestCases() const; + int countTestCases() const override; - std::string getName() const; + std::string getName() const override; - void run( TestResult *result ); + void run( TestResult *result ) override; - int getChildTestCount() const; + int getChildTestCount() const override; protected: - Test *doGetChildTestAt( int index ) const; + Test *doGetChildTestAt( int index ) const override; Test *m_test; diff --git a/include/cppunit/extensions/TestFactoryRegistry.h b/include/cppunit/extensions/TestFactoryRegistry.h index 9d10c94..cb7271e 100644 --- a/include/cppunit/extensions/TestFactoryRegistry.h +++ b/include/cppunit/extensions/TestFactoryRegistry.h @@ -82,13 +82,13 @@ public: TestFactoryRegistry( std::string name ); /// Destructor. - virtual ~TestFactoryRegistry(); + virtual ~TestFactoryRegistry() override; /** Returns a new TestSuite that contains the registered test. * \return A new TestSuite which contains all the test added using * registerFactory(TestFactory *). */ - virtual Test *makeTest(); + virtual Test *makeTest() override; /** Returns a named registry. * diff --git a/include/cppunit/extensions/TestSetUp.h b/include/cppunit/extensions/TestSetUp.h index f2128ec..22e74d8 100644 --- a/include/cppunit/extensions/TestSetUp.h +++ b/include/cppunit/extensions/TestSetUp.h @@ -16,7 +16,7 @@ class CPPUNIT_API TestSetUp : public TestDecorator public: TestSetUp( Test *test ); - void run( TestResult *result ); + void run( TestResult *result ) override; protected: virtual void setUp(); diff --git a/include/cppunit/plugin/DynamicLibraryManagerException.h b/include/cppunit/plugin/DynamicLibraryManagerException.h index 11ebbd9..74199ff 100644 --- a/include/cppunit/plugin/DynamicLibraryManagerException.h +++ b/include/cppunit/plugin/DynamicLibraryManagerException.h @@ -38,7 +38,7 @@ public: Cause getCause() const; - const char *what() const throw(); + const char *what() const throw() override; private: std::string m_message; diff --git a/include/cppunit/plugin/TestPlugInDefaultImpl.h b/include/cppunit/plugin/TestPlugInDefaultImpl.h index 8040b79..21923f1 100644 --- a/include/cppunit/plugin/TestPlugInDefaultImpl.h +++ b/include/cppunit/plugin/TestPlugInDefaultImpl.h @@ -33,20 +33,20 @@ class CPPUNIT_API TestPlugInDefaultImpl : public CppUnitTestPlugIn public: TestPlugInDefaultImpl(); - virtual ~TestPlugInDefaultImpl(); + virtual ~TestPlugInDefaultImpl() override; void initialize( TestFactoryRegistry *registry, - const PlugInParameters ¶meters ); + const PlugInParameters ¶meters ) override; - void addListener( TestResult *eventManager ); + void addListener( TestResult *eventManager ) override; - void removeListener( TestResult *eventManager ); + void removeListener( TestResult *eventManager ) override; - void addXmlOutputterHooks( XmlOutputter *outputter ); + void addXmlOutputterHooks( XmlOutputter *outputter ) override; - void removeXmlOutputterHooks(); + void removeXmlOutputterHooks() override; - void uninitialize( TestFactoryRegistry *registry ); + void uninitialize( TestFactoryRegistry *registry ) override; }; diff --git a/include/cppunit/ui/text/TextTestRunner.h b/include/cppunit/ui/text/TextTestRunner.h index 25fc717..563a9a8 100644 --- a/include/cppunit/ui/text/TextTestRunner.h +++ b/include/cppunit/ui/text/TextTestRunner.h @@ -65,7 +65,7 @@ class CPPUNIT_API TextTestRunner : public CPPUNIT_NS::TestRunner public: TextTestRunner( Outputter *outputter = nullptr ); - virtual ~TextTestRunner(); + virtual ~TextTestRunner() override; bool run( std::string testPath ="", bool doWait = false, @@ -80,7 +80,7 @@ public: public: // overridden from TestRunner (to avoid hidden virtual function warning) virtual void run( TestResult &controller, - const std::string &testPath = "" ); + const std::string &testPath = "" ) override; protected: virtual void wait( bool doWait ); diff --git a/src/cppunit/DefaultProtector.h b/src/cppunit/DefaultProtector.h index 4a76ea0..8176f39 100644 --- a/src/cppunit/DefaultProtector.h +++ b/src/cppunit/DefaultProtector.h @@ -18,7 +18,7 @@ class DefaultProtector : public Protector { public: bool protect( const Functor &functor, - const ProtectorContext &context ); + const ProtectorContext &context ) override; }; CPPUNIT_NS_END diff --git a/src/cppunit/ProtectorChain.cpp b/src/cppunit/ProtectorChain.cpp index db7744a..c953447 100644 --- a/src/cppunit/ProtectorChain.cpp +++ b/src/cppunit/ProtectorChain.cpp @@ -15,7 +15,7 @@ public: { } - bool operator()() const + bool operator()() const override { return m_protector->protect( m_functor, m_context ); } diff --git a/src/cppunit/ProtectorChain.h b/src/cppunit/ProtectorChain.h index 9123782..e798a96 100644 --- a/src/cppunit/ProtectorChain.h +++ b/src/cppunit/ProtectorChain.h @@ -21,7 +21,7 @@ class CPPUNIT_API ProtectorChain : public Protector public: ProtectorChain(); - ~ProtectorChain(); + ~ProtectorChain() override; void push( Protector *protector ); @@ -30,7 +30,7 @@ public: int count() const; bool protect( const Functor &functor, - const ProtectorContext &context ); + const ProtectorContext &context ) override; private: class ProtectFunctor; diff --git a/src/cppunit/TestCase.cpp b/src/cppunit/TestCase.cpp index 431a0c5..31fcefa 100644 --- a/src/cppunit/TestCase.cpp +++ b/src/cppunit/TestCase.cpp @@ -27,7 +27,7 @@ public: { } - bool operator()() const + bool operator()() const override { (m_target->*m_method)(); return true; commit 89c831e25ab566756288c45e5505815e9185b276 Author: Florian Becker <f...@vxapps.com> AuthorDate: Fri Oct 1 02:15:52 2021 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 02:15:52 2021 +0800 add missing [[noreturn]] attributes diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h index dd39ead..8858688 100644 --- a/include/cppunit/Asserter.h +++ b/include/cppunit/Asserter.h @@ -173,11 +173,11 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotLess( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "less assertion failed" ); + [[noreturn]] static void CPPUNIT_API failNotLess( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "less assertion failed" ); /*! \brief Throws an Exception with the specified message and location. * \param expected Text describing the expected value. @@ -187,11 +187,11 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotGreater( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "greater assertion failed" ); + [[noreturn]] static void CPPUNIT_API failNotGreater( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "greater assertion failed" ); /*! \brief Throws an Exception with the specified message and location. * \param expected Text describing the expected value. @@ -201,11 +201,11 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotLessEqual( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "less equal assertion failed" ); + [[noreturn]] static void CPPUNIT_API failNotLessEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "less equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location. * \param expected Text describing the expected value. @@ -215,11 +215,11 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotGreaterEqual( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "greater equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location. + [[noreturn]] static void CPPUNIT_API failNotGreaterEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "greater equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location. * \param shouldFail if \c true then the exception is thrown. Otherwise * nothing happen. diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp index 79fcb2e..9e74f1d 100644 --- a/src/cppunit/Asserter.cpp +++ b/src/cppunit/Asserter.cpp @@ -7,7 +7,7 @@ CPPUNIT_NS_BEGIN // coverity[+kill] -void +[[noreturn]] void Asserter::fail( std::string message, const SourceLine &sourceLine ) { @@ -15,7 +15,7 @@ Asserter::fail( std::string message, } // coverity[+kill] -void +[[noreturn]] void Asserter::fail( const Message &message, const SourceLine &sourceLine ) { @@ -124,7 +124,7 @@ Asserter::failNotEqual( std::string expected, } -void +[[noreturn]] void Asserter::failNotLess( std::string expected, std::string actual, const SourceLine &sourceLine, @@ -139,7 +139,7 @@ Asserter::failNotLess( std::string expected, } -void +[[noreturn]] void Asserter::failNotGreater( std::string expected, std::string actual, const SourceLine &sourceLine, @@ -153,7 +153,7 @@ Asserter::failNotGreater( std::string expected, sourceLine ); } -void +[[noreturn]] void Asserter::failNotLessEqual( std::string expected, std::string actual, const SourceLine &sourceLine, @@ -167,7 +167,7 @@ Asserter::failNotLessEqual( std::string expected, sourceLine ); } -void +[[noreturn]] void Asserter::failNotGreaterEqual( std::string expected, std::string actual, const SourceLine &sourceLine, commit 3836794be3e10b8a65f666f07fa721c7ea205a17 Author: Florian Becker <f...@vxapps.com> AuthorDate: Sun Sep 19 22:33:50 2021 +0200 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> CommitDate: Fri Oct 1 01:55:43 2021 +0800 Replace NULL with nullptr diff --git a/examples/ClockerPlugIn/ClockerPlugIn.cpp b/examples/ClockerPlugIn/ClockerPlugIn.cpp index bfcdbd1..d170024 100644 --- a/examples/ClockerPlugIn/ClockerPlugIn.cpp +++ b/examples/ClockerPlugIn/ClockerPlugIn.cpp @@ -12,9 +12,9 @@ class ClockerPlugIn : public CppUnitTestPlugIn { public: ClockerPlugIn() - : m_dumper( NULL ) - , m_model( NULL ) - , m_xmlHook( NULL ) + : m_dumper( nullptr ) + , m_model( nullptr ) + , m_xmlHook( nullptr ) { } diff --git a/examples/DumperPlugIn/DumperPlugIn.cpp b/examples/DumperPlugIn/DumperPlugIn.cpp index 55ef9f1..f0f16f9 100644 --- a/examples/DumperPlugIn/DumperPlugIn.cpp +++ b/examples/DumperPlugIn/DumperPlugIn.cpp @@ -8,7 +8,7 @@ class DumperPlugIn : public CppUnitTestPlugIn { public: DumperPlugIn() - : m_dumper( NULL ) + : m_dumper( nullptr ) { } diff --git a/examples/cppunittest/MockTestCase.cpp b/examples/cppunittest/MockTestCase.cpp index f8eff46..033bba5 100644 --- a/examples/cppunittest/MockTestCase.cpp +++ b/examples/cppunittest/MockTestCase.cpp @@ -20,7 +20,7 @@ MockTestCase::MockTestCase( std::string name ) , m_setUpThrow( false ) , m_tearDownThrow( false ) , m_runTestThrow( false ) - , m_passingTest( NULL ) + , m_passingTest( nullptr ) { } diff --git a/examples/cppunittest/MockTestListener.cpp b/examples/cppunittest/MockTestListener.cpp index 0cacfd3..f1de8a1 100644 --- a/examples/cppunittest/MockTestListener.cpp +++ b/examples/cppunittest/MockTestListener.cpp @@ -34,8 +34,8 @@ MockTestListener::MockTestListener( std::string name ) , m_hasParametersExpectationForAddFailure( false ) , m_expectedAddFailureCallCount( 0 ) , m_addFailureCall( 0 ) - , m_expectedFailedTest( NULL ) - , m_expectedException( NULL ) + , m_expectedFailedTest( nullptr ) + , m_expectedException( nullptr ) , m_expectedIsError( false ) { } diff --git a/examples/cppunittest/TrackedTestCase.cpp b/examples/cppunittest/TrackedTestCase.cpp index aaea99a..6d8aab2 100644 --- a/examples/cppunittest/TrackedTestCase.cpp +++ b/examples/cppunittest/TrackedTestCase.cpp @@ -1,18 +1,18 @@ #include "TrackedTestCase.h" -Tracker *TrackedTestCase::ms_tracker = NULL; +Tracker *TrackedTestCase::ms_tracker = nullptr; TrackedTestCase::TrackedTestCase() : CPPUNIT_NS::TestCase( "" ) { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onConstructor(); } TrackedTestCase::~TrackedTestCase() { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onDestructor(); } @@ -20,7 +20,7 @@ TrackedTestCase::~TrackedTestCase() void TrackedTestCase::setUp() { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onSetUp(); } @@ -28,7 +28,7 @@ TrackedTestCase::setUp() void TrackedTestCase::tearDown() { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onTearDown(); } @@ -36,7 +36,7 @@ TrackedTestCase::tearDown() void TrackedTestCase::test() { - if ( ms_tracker != NULL ) + if ( ms_tracker != nullptr ) ms_tracker->onTest(); } @@ -51,5 +51,5 @@ TrackedTestCase::setTracker( Tracker *tracker ) void TrackedTestCase::removeTracker() { - ms_tracker = NULL; + ms_tracker = nullptr; } diff --git a/include/cppunit/Test.h b/include/cppunit/Test.h index a56be0f..2a8fada 100644 --- a/include/cppunit/Test.h +++ b/include/cppunit/Test.h @@ -51,7 +51,7 @@ public: * You should override doGetChildTestAt() method. * * \param index Zero based index of the child test to return. - * \return Pointer on the test. Never \c NULL. + * \return Pointer on the test. Never \c nullptr. * \exception std::out_of_range is \a index is < 0 or >= getChildTestCount(). */ virtual Test *getChildTestAt( int index ) const; @@ -83,7 +83,7 @@ public: /*! \brief Finds the test with the specified name in the hierarchy. * \param testName Name of the test to find. - * \return Pointer on the first test found that is named \a testName. Never \c NULL. + * \return Pointer on the first test found that is named \a testName. Never \c nullptr. * \exception std::invalid_argument if no test named \a testName is found. */ virtual Test *findTest( const std::string &testName ) const; @@ -105,7 +105,7 @@ protected: /*! \brief Returns the child test of the specified valid index. * \param index Zero based valid index of the child test to return. - * \return Pointer on the test. Never \c NULL. + * \return Pointer on the test. Never \c nullptr. */ virtual Test *doGetChildTestAt( int index ) const =0; }; diff --git a/include/cppunit/TestPath.h b/include/cppunit/TestPath.h index 8934479..4eb6a26 100644 --- a/include/cppunit/TestPath.h +++ b/include/cppunit/TestPath.h @@ -83,7 +83,7 @@ public: virtual bool isValid() const; /*! \brief Adds a test to the path. - * \param test Pointer on the test to add. Must not be \c NULL. + * \param test Pointer on the test to add. Must not be \c nullptr. */ virtual void add( Test *test ); @@ -93,7 +93,7 @@ public: virtual void add( const TestPath &path ); /*! \brief Inserts a test at the specified index. - * \param test Pointer on the test to insert. Must not be \c NULL. + * \param test Pointer on the test to insert. Must not be \c nullptr. * \param index Zero based index indicating where the test is inserted. * \exception std::out_of_range is \a index < 0 or \a index > getTestCount(). */ @@ -132,13 +132,13 @@ public: /*! \brief Returns the test of the specified index. * \param index Zero based index of the test to return. - * \return Pointer on the test at index \a index. Never \c NULL. + * \return Pointer on the test at index \a index. Never \c nullptr. * \exception std::out_of_range is \a index < 0 or \a index >= getTestCount(). */ virtual Test *getTestAt( int index ) const; /*! \brief Get the last test of the path. - * \return Pointer on the last test (test at the bottom of the hierarchy). Never \c NULL. + * \return Pointer on the last test (test at the bottom of the hierarchy). Never \c nullptr. * \exception std::out_of_range if the path is not valid ( isValid() returns \c false ). */ virtual Test *getChildTest() const; @@ -185,7 +185,7 @@ protected: * the root test if the path string is relative. * \param pathAsString Path string. May be absolute or relative. * \param testNames Test name components are added to that container. - * \return Pointer on the resolved root test. Never \c NULL. + * \return Pointer on the resolved root test. Never \c nullptr. * \exception std::invalid_argument if either the root name can not be resolved or if * pathAsString contains no name components. */ diff --git a/include/cppunit/TestSuite.h b/include/cppunit/TestSuite.h index 63c0a6b..e02d1e2 100644 --- a/include/cppunit/TestSuite.h +++ b/include/cppunit/TestSuite.h @@ -47,7 +47,7 @@ public: ~TestSuite(); /*! Adds the specified test to the suite. - * \param test Test to add. Must not be \c NULL. + * \param test Test to add. Must not be \c nullptr. */ void addTest( Test *test ); diff --git a/include/cppunit/XmlOutputter.h b/include/cppunit/XmlOutputter.h index 2bf9411..36fe954 100644 --- a/include/cppunit/XmlOutputter.h +++ b/include/cppunit/XmlOutputter.h @@ -52,7 +52,7 @@ public: virtual ~XmlOutputter(); /*! \brief Adds the specified hook to the outputter. - * \param hook Hook to add. Must not be \c NULL. + * \param hook Hook to add. Must not be \c nullptr. */ virtual void addHook( XmlOutputterHook *hook ); diff --git a/include/cppunit/extensions/TestSuiteBuilderContext.h b/include/cppunit/extensions/TestSuiteBuilderContext.h index 04f4b9b..f66a203 100644 --- a/include/cppunit/extensions/TestSuiteBuilderContext.h +++ b/include/cppunit/extensions/TestSuiteBuilderContext.h @@ -47,7 +47,7 @@ public: /*! \brief Adds a test to the fixture suite. * - * \param test Test to add to the fixture suite. Must not be \c NULL. + * \param test Test to add to the fixture suite. Must not be \c nullptr. */ void addTest( Test *test ); diff --git a/include/cppunit/plugin/DynamicLibraryManager.h b/include/cppunit/plugin/DynamicLibraryManager.h index d70ccde..4ec9d91 100644 --- a/include/cppunit/plugin/DynamicLibraryManager.h +++ b/include/cppunit/plugin/DynamicLibraryManager.h @@ -49,7 +49,7 @@ public: /*! \brief Returns a pointer on the specified symbol exported by the library. * \param symbol Name of the symbol exported by the library. - * \return Pointer on the symbol. Should be casted to the actual type. Never \c NULL. + * \return Pointer on the symbol. Should be casted to the actual type. Never \c nullptr. * \exception DynamicLibraryManagerException if the symbol is not found. */ Symbol findSymbol( const std::string &symbol ); @@ -72,14 +72,14 @@ private: * * May throw any exceptions (indicates failure). * \param libraryName Name of the library to load. - * \return Handle of the loaded library. \c NULL indicates failure. + * \return Handle of the loaded library. \c nullptr indicates failure. */ LibraryHandle doLoadLibrary( const std::string &libraryName ); /*! Releases the loaded library. * * The handle of the library to free is in \c m_libraryHandle. It is never - * \c NULL. + * \c nullptr. * \warning Must NOT throw any exceptions (called from destructor). */ void doReleaseLibrary(); @@ -88,7 +88,7 @@ private: * * May throw any exceptions (indicates failure). * \param symbol Name of the symbol exported by the library. - * \return Pointer on the symbol. \c NULL indicates failure. + * \return Pointer on the symbol. \c nullptr indicates failure. */ Symbol doFindSymbol( const std::string &symbol ); diff --git a/include/cppunit/plugin/PlugInManager.h b/include/cppunit/plugin/PlugInManager.h index c9d72d8..9b73af5 100644 --- a/include/cppunit/plugin/PlugInManager.h +++ b/include/cppunit/plugin/PlugInManager.h @@ -40,7 +40,7 @@ public: * \param libraryFileName Name of the file that contains the TestPlugIn. * \param parameters List of string passed to the plug-in. * \return Pointer on the DynamicLibraryManager associated to the library. - * Valid until the library is unloaded. Never \c NULL. + * Valid until the library is unloaded. Never \c nullptr. * \exception DynamicLibraryManagerException is thrown if an error occurs during loading. */ void load( const std::string &libraryFileName, diff --git a/include/cppunit/portability/Stream.h b/include/cppunit/portability/Stream.h index e9beb8c..9968fa2 100644 --- a/include/cppunit/portability/Stream.h +++ b/include/cppunit/portability/Stream.h @@ -199,7 +199,7 @@ public: OStream &operator <<( const char *v ) { - return write( v ? v : "NULL" ); + return write( v ? v : "nullptr" ); } OStream &operator <<( char c ) diff --git a/include/cppunit/tools/XmlElement.h b/include/cppunit/tools/XmlElement.h index 70e21f8..3478a35 100644 --- a/include/cppunit/tools/XmlElement.h +++ b/include/cppunit/tools/XmlElement.h @@ -90,7 +90,7 @@ public: int numericValue ); /*! \brief Adds a child element to the element. - * \param element Child element to add. Must not be \c NULL. + * \param element Child element to add. Must not be \c nullptr. */ void addElement( XmlElement *element ); @@ -101,7 +101,7 @@ public: /*! \brief Returns the child element at the specified index. * \param index Zero based index of the element to return. - * \returns Element at the specified index. Never \c NULL. + * \returns Element at the specified index. Never \c nullptr. * \exception std::invalid_argument if \a index < 0 or index >= elementCount(). */ XmlElement *elementAt( int index ) const; diff --git a/include/cppunit/ui/text/TextTestRunner.h b/include/cppunit/ui/text/TextTestRunner.h index 6250166..25fc717 100644 --- a/include/cppunit/ui/text/TextTestRunner.h +++ b/include/cppunit/ui/text/TextTestRunner.h @@ -63,7 +63,7 @@ class TestResultCollector; class CPPUNIT_API TextTestRunner : public CPPUNIT_NS::TestRunner { public: - TextTestRunner( Outputter *outputter =NULL ); + TextTestRunner( Outputter *outputter = nullptr ); virtual ~TextTestRunner(); diff --git a/src/DllPlugInTester/CommandLineParserTest.cpp b/src/DllPlugInTester/CommandLineParserTest.cpp index 2ee2a52..ecdb12f 100644 --- a/src/DllPlugInTester/CommandLineParserTest.cpp +++ b/src/DllPlugInTester/CommandLineParserTest.cpp @@ -17,7 +17,7 @@ CommandLineParserTest::~CommandLineParserTest() void CommandLineParserTest::setUp() { - _parser = NULL; + _parser = nullptr; } @@ -32,7 +32,7 @@ void CommandLineParserTest::parse( const char **lines ) { int count =0; - for ( const char **line = lines; *line != NULL; ++line, ++count ) + for ( const char **line = lines; *line != nullptr; ++line, ++count ) ; delete _parser; @@ -44,7 +44,7 @@ CommandLineParserTest::parse( const char **lines ) void CommandLineParserTest::testEmptyCommandLine() { - static const char *lines[] = { "", NULL }; + static const char *lines[] = { "", nullptr }; parse( lines ); std::string none; @@ -64,7 +64,7 @@ CommandLineParserTest::testEmptyCommandLine() void CommandLineParserTest::testFlagCompiler() { - static const char *lines[] = { "", "-c", NULL }; + static const char *lines[] = { "", "-c", nullptr }; parse( lines ); std::string none; @@ -85,7 +85,7 @@ CommandLineParserTest::testFlagCompiler() void CommandLineParserTest::testLongFlagBriefProgress() { - static const char *lines[] = { "", "--brief-progress", NULL }; + static const char *lines[] = { "", "--brief-progress", nullptr }; parse( lines ); std::string none; @@ -106,7 +106,7 @@ CommandLineParserTest::testLongFlagBriefProgress() void CommandLineParserTest::testFileName() { - static const char *lines[] = { "", "TestPlugIn.dll", NULL }; + static const char *lines[] = { "", "TestPlugIn.dll", nullptr }; parse( lines ); std::string none; @@ -132,7 +132,7 @@ CommandLineParserTest::testFileName() void CommandLineParserTest::testTestPath() { - static const char *lines[] = { "", ":Core", NULL }; + static const char *lines[] = { "", ":Core", nullptr }; parse( lines ); std::string none; @@ -153,7 +153,7 @@ CommandLineParserTest::testTestPath() void CommandLineParserTest::testParameterWithSpace() { - static const char *lines[] = { "", "--xml", "Test Results.xml", NULL }; + static const char *lines[] = { "", "--xml", "Test Results.xml", nullptr }; parse( lines ); std::string none; @@ -175,7 +175,7 @@ CommandLineParserTest::testParameterWithSpace() void CommandLineParserTest::testMissingStyleSheetParameterThrow() { - static const char *lines[] = { "", "--xsl", NULL }; + static const char *lines[] = { "", "--xsl", nullptr }; parse( lines ); } @@ -183,7 +183,7 @@ CommandLineParserTest::testMissingStyleSheetParameterThrow() void CommandLineParserTest::testMissingEncodingParameterThrow() { - static const char *lines[] = { "", "--encoding", NULL }; + static const char *lines[] = { "", "--encoding", nullptr }; parse( lines ); } @@ -191,7 +191,7 @@ CommandLineParserTest::testMissingEncodingParameterThrow() void CommandLineParserTest::testXmlFileNameIsOptional() { - static const char *lines[] = { "", "--xml", NULL }; + static const char *lines[] = { "", "--xml", nullptr }; parse( lines ); std::string none; @@ -203,7 +203,7 @@ void CommandLineParserTest::testPlugInsWithParameters() { static const char *lines[] = { "", "TestPlugIn1.dll=login = lain", - "Clocker.dll", NULL }; + "Clocker.dll", nullptr }; parse( lines ); CPPUNIT_ASSERT_EQUAL( 2, _parser->getPlugInCount() ); diff --git a/src/cppunit/DynamicLibraryManager.cpp b/src/cppunit/DynamicLibraryManager.cpp index e6f6294..9471870 100644 --- a/src/cppunit/DynamicLibraryManager.cpp +++ b/src/cppunit/DynamicLibraryManager.cpp @@ -7,7 +7,7 @@ CPPUNIT_NS_BEGIN DynamicLibraryManager::DynamicLibraryManager( const std::string &libraryFileName ) - : m_libraryHandle( NULL ) + : m_libraryHandle( nullptr ) , m_libraryName( libraryFileName ) { loadLibrary( libraryFileName ); @@ -26,7 +26,7 @@ DynamicLibraryManager::findSymbol( const std::string &symbol ) try { Symbol symbolPointer = doFindSymbol( symbol ); - if ( symbolPointer != NULL ) + if ( symbolPointer != nullptr ) return symbolPointer; } catch ( ... ) @@ -36,7 +36,7 @@ DynamicLibraryManager::findSymbol( const std::string &symbol ) throw DynamicLibraryManagerException( m_libraryName, symbol, DynamicLibraryManagerException::symbolNotFound ); - return NULL; // keep compiler happy + return nullptr; // keep compiler happy } @@ -47,7 +47,7 @@ DynamicLibraryManager::loadLibrary( const std::string &libraryName ) { releaseLibrary(); m_libraryHandle = doLoadLibrary( libraryName ); - if ( m_libraryHandle != NULL ) + if ( m_libraryHandle != nullptr ) return; } catch (...) @@ -63,10 +63,10 @@ DynamicLibraryManager::loadLibrary( const std::string &libraryName ) void DynamicLibraryManager::releaseLibrary() { - if ( m_libraryHandle != NULL ) + if ( m_libraryHandle != nullptr ) { doReleaseLibrary(); - m_libraryHandle = NULL; + m_libraryHandle = nullptr; } } diff --git a/src/cppunit/PlugInManager.cpp b/src/cppunit/PlugInManager.cpp index 4f8b371..80ac89f 100644 --- a/src/cppunit/PlugInManager.cpp +++ b/src/cppunit/PlugInManager.cpp @@ -85,7 +85,7 @@ PlugInManager::unload( PlugInInfo &plugIn ) catch (...) { delete plugIn.m_manager; - plugIn.m_manager = NULL; + plugIn.m_manager = nullptr; throw; } } diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp index f1623cc..35448a6 100644 --- a/src/cppunit/TestFactoryRegistry.cpp +++ b/src/cppunit/TestFactoryRegistry.cpp @@ -70,7 +70,7 @@ public: // validity beforehand using TestFactoryRegistry::isValid() beforehand. assert( isValid() ); if ( !isValid() ) // release mode - return NULL; // => force CRASH + return nullptr; // => force CRASH return getInstance()->getInternalRegistry( name ); } diff --git a/src/cppunit/TestFailure.cpp b/src/cppunit/TestFailure.cpp index e31e138..63b98d7 100644 --- a/src/cppunit/TestFailure.cpp +++ b/src/cppunit/TestFailure.cpp @@ -29,7 +29,7 @@ TestFailure::failedTest() const } -/// Gets the thrown exception. Never \c NULL. +/// Gets the thrown exception. Never \c nullptr. Exception * TestFailure::thrownException() const { diff --git a/src/cppunit/TestLeaf.cpp b/src/cppunit/TestLeaf.cpp index 3d8767c..f4e1a93 100644 --- a/src/cppunit/TestLeaf.cpp +++ b/src/cppunit/TestLeaf.cpp @@ -22,7 +22,7 @@ Test * TestLeaf::doGetChildTestAt( int index ) const { checkIsValidIndex( index ); - return NULL; // never called, checkIsValidIndex() always throw. + return nullptr; // never called, checkIsValidIndex() always throw. } CPPUNIT_NS_END diff --git a/src/cppunit/Win32DynamicLibraryManager.cpp b/src/cppunit/Win32DynamicLibraryManager.cpp index 5dac4fa..81f9ee2 100644 --- a/src/cppunit/Win32DynamicLibraryManager.cpp +++ b/src/cppunit/Win32DynamicLibraryManager.cpp @@ -49,18 +49,18 @@ DynamicLibraryManager::getLastErrorDetail() const FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPSTR) &lpMsgBuf, 0, - NULL + nullptr ); std::string message = (LPCSTR)lpMsgBuf; // Display the string. -// ::MessageBoxA( NULL, (LPCSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); +// ::MessageBoxA( nullptr, (LPCSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); // Free the buffer. ::LocalFree( lpMsgBuf ); diff --git a/src/cppunit/XmlElement.cpp b/src/cppunit/XmlElement.cpp index b16d2fe..691cde1 100644 --- a/src/cppunit/XmlElement.cpp +++ b/src/cppunit/XmlElement.cpp @@ -124,7 +124,7 @@ XmlElement::elementFor( const std::string &name ) const } throw std::invalid_argument( "XmlElement::elementFor(), not matching child element found" ); - return NULL; // make some compilers happy. + return nullptr; // make some compilers happy. }