diff --git a/CppUnit/include/CppUnit/Test.h b/CppUnit/include/CppUnit/Test.h index bacab5ee5..afd2938da 100644 --- a/CppUnit/include/CppUnit/Test.h +++ b/CppUnit/include/CppUnit/Test.h @@ -50,13 +50,11 @@ private: }; -inline Test::~Test() -{ -} +inline Test::~Test() = default; // Runs a test and collects its result in a TestResult instance. -inline void Test::run(TestResult* result, const Callback& callback) +inline void Test::run(TestResult*, const Callback&) { } diff --git a/CppUnit/include/CppUnit/TestCaller.h b/CppUnit/include/CppUnit/TestCaller.h index 6161e299b..559284120 100644 --- a/CppUnit/include/CppUnit/TestCaller.h +++ b/CppUnit/include/CppUnit/TestCaller.h @@ -51,7 +51,7 @@ class TestCaller: public TestCase { REFERENCEOBJECT (TestCaller) - typedef void (Fixture::*TestMethod)(); + using TestMethod = void (Fixture::*)(); public: TestCaller(const std::string& name, TestMethod test, Test::Type testType = Test::Normal): @@ -62,19 +62,19 @@ public: } protected: - void runTest() + void runTest() override { (_fixture.get()->*_test)(); } - void setUp() + void setUp() override { if (!setup().empty()) _fixture.get()->addSetup(setup()); _fixture.get()->setUp(); } - void tearDown() + void tearDown() override { _fixture.get()->tearDown(); } diff --git a/CppUnit/include/CppUnit/TestCase.h b/CppUnit/include/CppUnit/TestCase.h index 5c3c7e394..976660586 100644 --- a/CppUnit/include/CppUnit/TestCase.h +++ b/CppUnit/include/CppUnit/TestCase.h @@ -13,6 +13,7 @@ #include "CppUnit/TestResult.h" #include "CppUnit/CppUnitException.h" #include +#include #include #include @@ -88,14 +89,14 @@ class CppUnit_API TestCase: public Test REFERENCEOBJECT (TestCase) public: - TestCase(const std::string& Name, Test::Type testType = Test::Normal); - ~TestCase(); + TestCase(const std::string& name, Test::Type testType = Test::Normal); + ~TestCase() override; - virtual void run(TestResult* result, const Test::Callback& callback = nullptr); + void run(TestResult* result, const Test::Callback& callback = nullptr) override; virtual TestResult* run(); - virtual int countTestCases() const; - virtual std::string toString() const; - virtual Test::Type getType() const; + int countTestCases() const override; + std::string toString() const override; + Test::Type getType() const override; void setType(Test::Type testType); const std::string& name() const; @@ -126,8 +127,8 @@ protected: const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); template ::value, T1>::type, - typename = typename std::enable_if::value, T2>::type> + typename = std::enable_if_t, T1>, + typename = std::enable_if_t, T2>> void assertEquals(T1 expected, T2 actual, long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER, @@ -159,8 +160,8 @@ protected: const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME); template ::value, T1>::type, - typename = typename std::enable_if::value, T2>::type> + typename = std::enable_if_t, T1>, + typename = std::enable_if_t, T2>> std::string notEqualsMessage(T1 expected, T2 actual) { return "expected: " + std::to_string(expected) + " but was: " + std::to_string(actual); @@ -203,9 +204,7 @@ inline TestCase::TestCase(const std::string& name, Test::Type testType) // Destructs a test case -inline TestCase::~TestCase() -{ -} +inline TestCase::~TestCase() = default; // Returns a count of all the tests executed @@ -229,7 +228,7 @@ inline void TestCase::setUp() // A hook for fixture set up with command line arguments -inline void TestCase::setUp(const std::vector& setup) +inline void TestCase::setUp(const std::vector&) { } diff --git a/CppUnit/include/CppUnit/TestDecorator.h b/CppUnit/include/CppUnit/TestDecorator.h index cda17c097..8348e1306 100644 --- a/CppUnit/include/CppUnit/TestDecorator.h +++ b/CppUnit/include/CppUnit/TestDecorator.h @@ -31,13 +31,13 @@ class CppUnit_API TestDecorator: public Test public: TestDecorator(Test* test); - virtual ~TestDecorator(); + ~TestDecorator() override; - int countTestCases() const; + int countTestCases() const override; - void run(TestResult* result, const Test::Callback& callback = nullptr); + void run(TestResult* result, const Test::Callback& callback = nullptr) override; - std::string toString() const; + std::string toString() const override; protected: Test* _test; diff --git a/CppUnit/include/CppUnit/TestResult.h b/CppUnit/include/CppUnit/TestResult.h index b888ea224..a07733493 100644 --- a/CppUnit/include/CppUnit/TestResult.h +++ b/CppUnit/include/CppUnit/TestResult.h @@ -64,13 +64,9 @@ public: class SynchronizationObject { public: - SynchronizationObject() - { - } + SynchronizationObject() = default; - virtual ~SynchronizationObject() - { - } + virtual ~SynchronizationObject() = default; virtual void lock() { @@ -138,7 +134,7 @@ inline void TestResult::addFailure(Test* test, CppUnitException* e) // Informs the result that a test will be started. -inline void TestResult::startTest(Test* test) +inline void TestResult::startTest(Test*) { ExclusiveZone zone(_syncObject); _runTests++; @@ -146,7 +142,7 @@ inline void TestResult::startTest(Test* test) // Informs the result that a test was completed. -inline void TestResult::endTest(Test* test) +inline void TestResult::endTest(Test*) { ExclusiveZone zone(_syncObject); } diff --git a/CppUnit/include/CppUnit/TestRunner.h b/CppUnit/include/CppUnit/TestRunner.h index 6157bc749..ad0cf5932 100644 --- a/CppUnit/include/CppUnit/TestRunner.h +++ b/CppUnit/include/CppUnit/TestRunner.h @@ -37,8 +37,8 @@ namespace CppUnit { */ class CppUnit_API TestRunner { - typedef std::pair Mapping; - typedef std::vector Mappings; + using Mapping = std::pair; + using Mappings = std::vector; public: TestRunner(); diff --git a/CppUnit/include/CppUnit/TestSuite.h b/CppUnit/include/CppUnit/TestSuite.h index 9aa6a55d9..8c75aa23f 100644 --- a/CppUnit/include/CppUnit/TestSuite.h +++ b/CppUnit/include/CppUnit/TestSuite.h @@ -39,13 +39,13 @@ class CppUnit_API TestSuite: public Test public: TestSuite(const std::string& name = ""); - ~TestSuite(); + ~TestSuite() override; - void run(TestResult* result, const Test::Callback& callback = nullptr); - int countTestCases() const; + void run(TestResult* result, const Test::Callback& callback = nullptr) override; + int countTestCases() const override; void addTest(Test* test); - std::string toString() const; - Test::Type getType() const; + std::string toString() const override; + Test::Type getType() const override; virtual void deleteContents(); diff --git a/CppUnit/include/CppUnit/TextTestResult.h b/CppUnit/include/CppUnit/TextTestResult.h index 867679965..6be0d4eb5 100644 --- a/CppUnit/include/CppUnit/TextTestResult.h +++ b/CppUnit/include/CppUnit/TextTestResult.h @@ -24,9 +24,9 @@ public: TextTestResult(std::ostream& ostr); TextTestResult(std::ostream& ostr, const std::string& ignore); - virtual void addError(Test* test, CppUnitException* e); - virtual void addFailure(Test* test, CppUnitException* e); - virtual void startTest(Test* test); + void addError(Test* test, CppUnitException* e) override; + void addFailure(Test* test, CppUnitException* e) override; + void startTest(Test* test) override; virtual void print(std::ostream& stream); virtual void printErrors(std::ostream& stream); virtual void printFailures(std::ostream& stream); diff --git a/Foundation/include/Poco/Dynamic/Pair.h b/Foundation/include/Poco/Dynamic/Pair.h index 166dc28a9..e9bfa84c5 100644 --- a/Foundation/include/Poco/Dynamic/Pair.h +++ b/Foundation/include/Poco/Dynamic/Pair.h @@ -62,10 +62,8 @@ public: { } - virtual ~Pair() + virtual ~Pair() = default; /// Destroys the Pair. - { - } Pair& swap(Pair& other) noexcept /// Swaps the content of the two Pairs. @@ -122,62 +120,62 @@ public: return typeid(Pair); } - void convert(Int8& val) const + void convert(Int8&) const { throw BadCastException("Cannot cast Pair type to Int8"); } - void convert(Int16& val) const + void convert(Int16&) const { throw BadCastException("Cannot cast Pair type to Int16"); } - void convert(Int32& val) const + void convert(Int32&) const { throw BadCastException("Cannot cast Pair type to Int32"); } - void convert(Int64& val) const + void convert(Int64&) const { throw BadCastException("Cannot cast Pair type to Int64"); } - void convert(UInt8& val) const + void convert(UInt8&) const { throw BadCastException("Cannot cast Pair type to UInt8"); } - void convert(UInt16& val) const + void convert(UInt16&) const { throw BadCastException("Cannot cast Pair type to UInt16"); } - void convert(UInt32& val) const + void convert(UInt32&) const { throw BadCastException("Cannot cast Pair type to UInt32"); } - void convert(UInt64& val) const + void convert(UInt64&) const { throw BadCastException("Cannot cast Pair type to UInt64"); } - void convert(bool& val) const + void convert(bool&) const { throw BadCastException("Cannot cast Pair type to bool"); } - void convert(float& val) const + void convert(float&) const { throw BadCastException("Cannot cast Pair type to float"); } - void convert(double& val) const + void convert(double&) const { throw BadCastException("Cannot cast Pair type to double"); } - void convert(char& val) const + void convert(char&) const { throw BadCastException("Cannot cast Pair type to char"); } @@ -271,62 +269,62 @@ public: return typeid(Pair); } - void convert(Int8& val) const + void convert(Int8&) const { throw BadCastException("Cannot cast Pair type to Int8"); } - void convert(Int16& val) const + void convert(Int16&) const { throw BadCastException("Cannot cast Pair type to Int16"); } - void convert(Int32& val) const + void convert(Int32&) const { throw BadCastException("Cannot cast Pair type to Int32"); } - void convert(Int64& val) const + void convert(Int64&) const { throw BadCastException("Cannot cast Pair type to Int64"); } - void convert(UInt8& val) const + void convert(UInt8&) const { throw BadCastException("Cannot cast Pair type to UInt8"); } - void convert(UInt16& val) const + void convert(UInt16&) const { throw BadCastException("Cannot cast Pair type to UInt16"); } - void convert(UInt32& val) const + void convert(UInt32&) const { throw BadCastException("Cannot cast Pair type to UInt32"); } - void convert(UInt64& val) const + void convert(UInt64&) const { throw BadCastException("Cannot cast Pair type to UInt64"); } - void convert(bool& val) const + void convert(bool&) const { throw BadCastException("Cannot cast Pair type to bool"); } - void convert(float& val) const + void convert(float&) const { throw BadCastException("Cannot cast Pair type to float"); } - void convert(double& val) const + void convert(double&) const { throw BadCastException("Cannot cast Pair type to double"); } - void convert(char& val) const + void convert(char&) const { throw BadCastException("Cannot cast Pair type to char"); } diff --git a/Foundation/src/EventLogChannel.cpp b/Foundation/src/EventLogChannel.cpp index f9a9fb150..0f5b84f2b 100644 --- a/Foundation/src/EventLogChannel.cpp +++ b/Foundation/src/EventLogChannel.cpp @@ -234,9 +234,9 @@ std::wstring EventLogChannel::findLibrary(const wchar_t* name) if (dll) { const DWORD maxPathLen = MAX_PATH + 1; - wchar_t name[maxPathLen]; - int n = GetModuleFileNameW(dll, name, maxPathLen); - if (n > 0) path = name; + wchar_t moduleName[maxPathLen]; + int n = GetModuleFileNameW(dll, moduleName, maxPathLen); + if (n > 0) path = moduleName; FreeLibrary(dll); } return path; diff --git a/Foundation/src/ThreadPool.cpp b/Foundation/src/ThreadPool.cpp index 0aeb11d2b..e1d0d37cd 100644 --- a/Foundation/src/ThreadPool.cpp +++ b/Foundation/src/ThreadPool.cpp @@ -485,7 +485,7 @@ public: if (!_pPool) { _pPool = new ThreadPool("default"); - if (POCO_THREAD_STACK_SIZE > 0) + if constexpr (POCO_THREAD_STACK_SIZE > 0) _pPool->setStackSize(POCO_THREAD_STACK_SIZE); } return _pPool; diff --git a/Foundation/testsuite/src/VarTest.h b/Foundation/testsuite/src/VarTest.h index e71dd0e92..dfdbb150a 100644 --- a/Foundation/testsuite/src/VarTest.h +++ b/Foundation/testsuite/src/VarTest.h @@ -146,7 +146,7 @@ private: try { TU POCO_UNUSED i; i = dMin.convert(); fail("must fail"); } catch (Poco::RangeException&) {} - if(sizeof(TS) == sizeof(TU)) + if constexpr (sizeof(TS) == sizeof(TU)) { TU iMax = std::numeric_limits::max(); Poco::Dynamic::Var dMax = iMax;