From ce50df804702e5577ead6df9ce2972c29a1bb2e0 Mon Sep 17 00:00:00 2001 From: IOBYTE Date: Tue, 15 May 2018 10:37:40 -0400 Subject: [PATCH] Fix override warnings. (#1234) --- cli/cppcheckexecutor.h | 8 +++---- cli/threadexecutor.h | 6 +++--- gui/csvreport.h | 8 +++---- gui/printablereport.h | 8 +++---- gui/test/benchmark/simple/benchmarksimple.h | 4 ++-- gui/threadresult.h | 4 ++-- gui/txtreport.h | 8 +++---- gui/xmlreportv2.h | 12 +++++------ lib/check64bit.h | 8 +++---- lib/checkassert.h | 6 +++--- lib/checkautovariables.h | 8 +++---- lib/checkbool.h | 8 +++---- lib/checkboost.h | 6 +++--- lib/checkbufferoverrun.h | 14 ++++++------ lib/checkclass.h | 8 +++---- lib/checkcondition.h | 8 +++---- lib/checkexceptionsafety.h | 6 +++--- lib/checkfunctions.h | 8 +++---- lib/checkinternal.h | 6 +++--- lib/checkio.h | 8 +++---- lib/checkleakautovar.h | 6 +++--- lib/checkmemoryleak.h | 24 ++++++++++----------- lib/checknullpointer.h | 8 +++---- lib/checkother.h | 8 +++---- lib/checkpostfixoperator.h | 8 +++---- lib/checksizeof.h | 8 +++---- lib/checkstl.h | 6 +++--- lib/checkstring.h | 8 +++---- lib/checktype.h | 8 +++---- lib/checkuninitvar.h | 6 +++--- lib/checkunusedfunctions.h | 8 +++---- lib/checkunusedvar.h | 8 +++---- lib/checkvaarg.h | 6 +++--- lib/cppcheck.h | 8 +++---- lib/timer.h | 2 +- test/test64bit.cpp | 2 +- test/testassert.cpp | 2 +- test/testastutils.cpp | 2 +- test/testautovariables.cpp | 2 +- test/testbool.cpp | 2 +- test/testboost.cpp | 2 +- test/testbufferoverrun.cpp | 2 +- test/testcharvar.cpp | 2 +- test/testclass.cpp | 2 +- test/testcmdlineparser.cpp | 2 +- test/testcondition.cpp | 2 +- test/testconstructors.cpp | 2 +- test/testcppcheck.cpp | 2 +- test/testerrorlogger.cpp | 2 +- test/testexceptionsafety.cpp | 2 +- test/testfilelister.cpp | 2 +- test/testfunctions.cpp | 2 +- test/testgarbage.cpp | 2 +- test/testimportproject.cpp | 2 +- test/testincompletestatement.cpp | 2 +- test/testinternal.cpp | 2 +- test/testio.cpp | 2 +- test/testleakautovar.cpp | 4 ++-- test/testlibrary.cpp | 2 +- test/testmathlib.cpp | 2 +- test/testmemleak.cpp | 14 ++++++------ test/testnullpointer.cpp | 2 +- test/testoptions.cpp | 2 +- test/testother.cpp | 2 +- test/testpath.cpp | 2 +- test/testpathmatch.cpp | 2 +- test/testplatform.cpp | 2 +- test/testpostfixoperator.cpp | 2 +- test/testpreprocessor.cpp | 2 +- test/testsamples.cpp | 2 +- test/testsimplifytemplate.cpp | 2 +- test/testsimplifytokens.cpp | 2 +- test/testsimplifytypedef.cpp | 2 +- test/testsizeof.cpp | 2 +- test/teststl.cpp | 2 +- test/teststring.cpp | 2 +- test/testsuite.h | 4 ++-- test/testsuppressions.cpp | 2 +- test/testsymboldatabase.cpp | 2 +- test/testthreadexecutor.cpp | 2 +- test/testtimer.cpp | 2 +- test/testtoken.cpp | 2 +- test/testtokenize.cpp | 2 +- test/testtokenlist.cpp | 2 +- test/testtype.cpp | 2 +- test/testuninitvar.cpp | 2 +- test/testunusedfunctions.cpp | 2 +- test/testunusedprivfunc.cpp | 2 +- test/testunusedvar.cpp | 2 +- test/testutils.h | 4 ++-- test/testvaarg.cpp | 2 +- test/testvalueflow.cpp | 2 +- test/testvarid.cpp | 2 +- 93 files changed, 204 insertions(+), 204 deletions(-) diff --git a/cli/cppcheckexecutor.h b/cli/cppcheckexecutor.h index 2799f81b0..6a10808b7 100644 --- a/cli/cppcheckexecutor.h +++ b/cli/cppcheckexecutor.h @@ -69,17 +69,17 @@ public: * * @param outmsg Progress message e.g. "Checking main.cpp..." */ - virtual void reportOut(const std::string &outmsg); + virtual void reportOut(const std::string &outmsg) override; /** xml output of errors */ - virtual void reportErr(const ErrorLogger::ErrorMessage &msg); + virtual void reportErr(const ErrorLogger::ErrorMessage &msg) override; - void reportProgress(const std::string &filename, const char stage[], const std::size_t value); + void reportProgress(const std::string &filename, const char stage[], const std::size_t value) override; /** * Output information messages. */ - virtual void reportInfo(const ErrorLogger::ErrorMessage &msg); + virtual void reportInfo(const ErrorLogger::ErrorMessage &msg) override; /** * Information about how many files have been checked diff --git a/cli/threadexecutor.h b/cli/threadexecutor.h index f6b9d5c53..af322bcf5 100644 --- a/cli/threadexecutor.h +++ b/cli/threadexecutor.h @@ -49,9 +49,9 @@ public: virtual ~ThreadExecutor(); unsigned int check(); - virtual void reportOut(const std::string &outmsg); - virtual void reportErr(const ErrorLogger::ErrorMessage &msg); - virtual void reportInfo(const ErrorLogger::ErrorMessage &msg); + virtual void reportOut(const std::string &outmsg) override; + virtual void reportErr(const ErrorLogger::ErrorMessage &msg) override; + virtual void reportInfo(const ErrorLogger::ErrorMessage &msg) override; /** * @brief Add content to a file, to be used in unit testing. diff --git a/gui/csvreport.h b/gui/csvreport.h index 18f01d2f1..d08dee1bc 100644 --- a/gui/csvreport.h +++ b/gui/csvreport.h @@ -42,23 +42,23 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool create(); + virtual bool create() override; /** * @brief Write report header. */ - virtual void writeHeader(); + virtual void writeHeader() override; /** * @brief Write report footer. */ - virtual void writeFooter(); + virtual void writeFooter() override; /** * @brief Write error to report. * @param error Error data. */ - virtual void writeError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error) override; private: diff --git a/gui/printablereport.h b/gui/printablereport.h index e933f7aeb..54f3c9196 100644 --- a/gui/printablereport.h +++ b/gui/printablereport.h @@ -38,23 +38,23 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool create(); + virtual bool create() override; /** * @brief Write report header. */ - virtual void writeHeader(); + virtual void writeHeader() override; /** * @brief Write report footer. */ - virtual void writeFooter(); + virtual void writeFooter() override; /** * @brief Write error to report. * @param error Error data. */ - virtual void writeError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error) override; /** * @brief Returns the formatted report. diff --git a/gui/test/benchmark/simple/benchmarksimple.h b/gui/test/benchmark/simple/benchmarksimple.h index ce0d01bbb..21c7391bc 100644 --- a/gui/test/benchmark/simple/benchmarksimple.h +++ b/gui/test/benchmark/simple/benchmarksimple.h @@ -31,8 +31,8 @@ private slots: private: // Empty implementations of ErrorLogger methods. // We don't care about the output in the benchmark tests. - void reportOut(const std::string & outmsg) { + void reportOut(const std::string & outmsg) override { } - void reportErr(const ErrorLogger::ErrorMessage &msg) { + void reportErr(const ErrorLogger::ErrorMessage &msg) override { } }; diff --git a/gui/threadresult.h b/gui/threadresult.h index 6b0e0787c..2f99574f3 100644 --- a/gui/threadresult.h +++ b/gui/threadresult.h @@ -72,8 +72,8 @@ public: /** * ErrorLogger methods */ - void reportOut(const std::string &outmsg); - void reportErr(const ErrorLogger::ErrorMessage &msg); + void reportOut(const std::string &outmsg) override; + void reportErr(const ErrorLogger::ErrorMessage &msg) override; public slots: diff --git a/gui/txtreport.h b/gui/txtreport.h index 446dd6d5a..e15a4e34f 100644 --- a/gui/txtreport.h +++ b/gui/txtreport.h @@ -42,23 +42,23 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool create(); + virtual bool create() override; /** * @brief Write report header. */ - virtual void writeHeader(); + virtual void writeHeader() override; /** * @brief Write report footer. */ - virtual void writeFooter(); + virtual void writeFooter() override; /** * @brief Write error to report. * @param error Error data. */ - virtual void writeError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error) override; private: diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index b06835d66..2657b09f1 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -43,33 +43,33 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool create(); + virtual bool create() override; /** * @brief Open existing report file. */ - bool open(); + virtual bool open() override; /** * @brief Write report header. */ - virtual void writeHeader(); + virtual void writeHeader() override; /** * @brief Write report footer. */ - virtual void writeFooter(); + virtual void writeFooter() override; /** * @brief Write error to report. * @param error Error data. */ - virtual void writeError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error) override; /** * @brief Read contents of the report file. */ - virtual QList read(); + virtual QList read() override; protected: /** diff --git a/lib/check64bit.h b/lib/check64bit.h index 98143c8af..2847a2707 100644 --- a/lib/check64bit.h +++ b/lib/check64bit.h @@ -52,13 +52,13 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { Check64BitPortability check64BitPortability(tokenizer, settings, errorLogger); check64BitPortability.pointerassignment(); } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { (void)tokenizer; (void)settings; (void)errorLogger; @@ -74,7 +74,7 @@ private: void returnIntegerError(const Token *tok); void returnPointerError(const Token *tok); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { Check64BitPortability c(nullptr, settings, errorLogger); c.assignmentAddressToIntegerError(nullptr); c.assignmentIntegerToAddressError(nullptr); @@ -86,7 +86,7 @@ private: return "64-bit portability"; } - std::string classInfo() const { + std::string classInfo() const override { return "Check if there is 64-bit portability issues:\n" "- assign address to/from int/long\n" "- casting address from/to integer when returning from function\n"; diff --git a/lib/checkassert.h b/lib/checkassert.h index aac42d743..5acfd7094 100644 --- a/lib/checkassert.h +++ b/lib/checkassert.h @@ -49,7 +49,7 @@ public: : Check(myName(), tokenizer, settings, errorLogger) { } - virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckAssert check(tokenizer, settings, errorLogger); check.assertWithSideEffects(); } @@ -64,7 +64,7 @@ private: void sideEffectInAssertError(const Token *tok, const std::string& functionName); void assignmentInAssertError(const Token *tok, const std::string &varname); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckAssert c(nullptr, settings, errorLogger); c.sideEffectInAssertError(nullptr, "function"); c.assignmentInAssertError(nullptr, "var"); @@ -74,7 +74,7 @@ private: return "Assert"; } - std::string classInfo() const { + std::string classInfo() const override { return "Warn if there are side effects in assert statements (since this cause different behaviour in debug/release builds).\n"; } }; diff --git a/lib/checkautovariables.h b/lib/checkautovariables.h index c973c956a..dee63419f 100644 --- a/lib/checkautovariables.h +++ b/lib/checkautovariables.h @@ -49,13 +49,13 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckAutoVariables checkAutoVariables(tokenizer, settings, errorLogger); checkAutoVariables.assignFunctionArg(); checkAutoVariables.returnReference(); } - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckAutoVariables checkAutoVariables(tokenizer, settings, errorLogger); checkAutoVariables.autoVariables(); checkAutoVariables.returnPointerToLocalArray(); @@ -94,7 +94,7 @@ private: void errorUselessAssignmentArg(const Token *tok); void errorUselessAssignmentPtrArg(const Token *tok); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckAutoVariables c(nullptr,settings,errorLogger); c.errorAutoVariableAssignment(nullptr, false); c.errorReturnAddressToAutoVariable(nullptr); @@ -112,7 +112,7 @@ private: return "Auto Variables"; } - std::string classInfo() const { + std::string classInfo() const override { return "A pointer to a variable is only valid as long as the variable is in scope.\n" "Check:\n" "- returning a pointer to auto or temporary variable\n" diff --git a/lib/checkbool.h b/lib/checkbool.h index b68f98b58..903e764f3 100644 --- a/lib/checkbool.h +++ b/lib/checkbool.h @@ -50,7 +50,7 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckBool checkBool(tokenizer, settings, errorLogger); // Checks @@ -61,7 +61,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckBool checkBool(tokenizer, settings, errorLogger); // Checks @@ -113,7 +113,7 @@ private: void comparisonOfBoolExpressionWithIntError(const Token *tok, bool n0o1); void pointerArithBoolError(const Token *tok); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckBool c(nullptr, settings, errorLogger); c.assignBoolToPointerError(nullptr); @@ -131,7 +131,7 @@ private: return "Boolean"; } - std::string classInfo() const { + std::string classInfo() const override { return "Boolean type checks\n" "- using increment on boolean\n" "- comparison of a boolean expression with an integer other than 0 or 1\n" diff --git a/lib/checkboost.h b/lib/checkboost.h index 6a9850b2e..a2f8fcc00 100644 --- a/lib/checkboost.h +++ b/lib/checkboost.h @@ -49,7 +49,7 @@ public: } /** Simplified checks. The token list is simplified. */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { if (!tokenizer->isCPP()) return; @@ -64,7 +64,7 @@ public: private: void boostForeachError(const Token *tok); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckBoost c(nullptr, settings, errorLogger); c.boostForeachError(nullptr); } @@ -73,7 +73,7 @@ private: return "Boost usage"; } - std::string classInfo() const { + std::string classInfo() const override { return "Check for invalid usage of Boost:\n" "- container modification during BOOST_FOREACH\n"; } diff --git a/lib/checkbufferoverrun.h b/lib/checkbufferoverrun.h index bf48c8e6a..c2cb5450e 100644 --- a/lib/checkbufferoverrun.h +++ b/lib/checkbufferoverrun.h @@ -74,7 +74,7 @@ public: , symbolDatabase(tokenizer?tokenizer->getSymbolDatabase():nullptr) { } - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckBufferOverrun checkBufferOverrun(tokenizer, settings, errorLogger); checkBufferOverrun.checkGlobalAndLocalVariable(); if (tokenizer && tokenizer->isMaxTime()) @@ -86,7 +86,7 @@ public: checkBufferOverrun.negativeArraySize(); } - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckBufferOverrun checkBufferOverrun(tokenizer, settings, errorLogger); checkBufferOverrun.bufferOverrun(); checkBufferOverrun.checkStringArgument(); @@ -223,7 +223,7 @@ public: /* data for multifile checking */ class MyFileInfo : public Check::FileInfo { public: - std::string toString() const; + std::string toString() const override; struct ArrayUsage { MathLib::bigint index; @@ -239,9 +239,9 @@ public: }; /** @brief Parse current TU and extract file info */ - Check::FileInfo *getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const; + Check::FileInfo *getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const override; - Check::FileInfo * loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const; + Check::FileInfo * loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const override; /** @brief Analyse all file infos for all TU */ bool analyseWholeProgram(const std::list &fileInfo, const Settings& settings, ErrorLogger &errorLogger); @@ -278,7 +278,7 @@ private: void valueFlowCheckArrayIndex(const Token * const tok, const ArrayInfo &arrayInfo); public: - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckBufferOverrun c(nullptr, settings, errorLogger); const std::vector indexes(2, 1); c.arrayIndexOutOfBoundsError(nullptr, ArrayInfo(0, "array", 1, 2), indexes); @@ -304,7 +304,7 @@ private: return "Bounds checking"; } - std::string classInfo() const { + std::string classInfo() const override { return "Out of bounds checking:\n" "- Array index out of bounds detection by value flow analysis\n" "- Dangerous usage of strncat()\n" diff --git a/lib/checkclass.h b/lib/checkclass.h index 317e3afd3..88f0bbbf4 100644 --- a/lib/checkclass.h +++ b/lib/checkclass.h @@ -53,7 +53,7 @@ public: CheckClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger); /** @brief Run checks on the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { if (tokenizer->isC()) return; @@ -65,7 +65,7 @@ public: } /** @brief Run checks on the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { if (tokenizer->isC()) return; @@ -198,7 +198,7 @@ private: void unsafeClassDivZeroError(const Token *tok, const std::string &className, const std::string &methodName, const std::string &varName); void overrideError(const Function *funcInBase, const Function *funcInDerived); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckClass c(nullptr, settings, errorLogger); c.noConstructorError(nullptr, "classname", false); c.noExplicitConstructorError(nullptr, "classname", false); @@ -239,7 +239,7 @@ private: return "Class"; } - std::string classInfo() const { + std::string classInfo() const override { return "Check the code for each class.\n" "- Missing constructors and copy constructors\n" //"- Missing allocation of memory in copy constructor\n" diff --git a/lib/checkcondition.h b/lib/checkcondition.h index d05c277ef..8903067c5 100644 --- a/lib/checkcondition.h +++ b/lib/checkcondition.h @@ -51,7 +51,7 @@ public: : Check(myName(), tokenizer, settings, errorLogger) { } - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckCondition checkCondition(tokenizer, settings, errorLogger); checkCondition.multiCondition(); checkCondition.clarifyCondition(); // not simplified because ifAssign @@ -63,7 +63,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckCondition checkCondition(tokenizer, settings, errorLogger); checkCondition.assignIf(); checkCondition.checkBadBitmaskCheck(); @@ -149,7 +149,7 @@ private: void invalidTestForOverflow(const Token* tok, bool result); void pointerAdditionResultNotNullError(const Token *tok, const Token *calc); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckCondition c(nullptr, settings, errorLogger); c.assignIfError(nullptr, nullptr, emptyString, false); @@ -173,7 +173,7 @@ private: return "Condition"; } - std::string classInfo() const { + std::string classInfo() const override { return "Match conditions with assignments and other conditions:\n" "- Mismatching assignment and comparison => comparison is always true/false\n" "- Mismatching lhs and rhs in comparison => comparison is always true/false\n" diff --git a/lib/checkexceptionsafety.h b/lib/checkexceptionsafety.h index 0d78b20d0..53a5b5764 100644 --- a/lib/checkexceptionsafety.h +++ b/lib/checkexceptionsafety.h @@ -62,7 +62,7 @@ public: } /** Checks that uses the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { if (tokenizer->isC()) return; @@ -137,7 +137,7 @@ private: } /** Generate all possible errors (for --errorlist) */ - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckExceptionSafety c(nullptr, settings, errorLogger); c.destructorsError(nullptr, "Class"); c.deallocThrowError(nullptr, "p"); @@ -153,7 +153,7 @@ private: } /** wiki formatted description of the class (for --doc) */ - std::string classInfo() const { + std::string classInfo() const override { return "Checking exception safety\n" "- Throwing exceptions in destructors\n" "- Throwing exception during invalid state\n" diff --git a/lib/checkfunctions.h b/lib/checkfunctions.h index 937bb0749..7a351e743 100644 --- a/lib/checkfunctions.h +++ b/lib/checkfunctions.h @@ -58,7 +58,7 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckFunctions checkFunctions(tokenizer, settings, errorLogger); // Checks @@ -69,7 +69,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckFunctions checkFunctions(tokenizer, settings, errorLogger); checkFunctions.checkProhibitedFunctions(); @@ -117,7 +117,7 @@ private: void memsetFloatError(const Token *tok, const std::string &var_value); void memsetValueOutOfRangeError(const Token *tok, const std::string &value); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckFunctions c(nullptr, settings, errorLogger); for (std::map::const_iterator i = settings->library.functionwarn.cbegin(); i != settings->library.functionwarn.cend(); ++i) { @@ -138,7 +138,7 @@ private: return "Check function usage"; } - std::string classInfo() const { + std::string classInfo() const override { return "Check function usage:\n" "- return value of certain functions not used\n" "- invalid input values for functions\n" diff --git a/lib/checkinternal.h b/lib/checkinternal.h index b582139e8..7aa5a10df 100644 --- a/lib/checkinternal.h +++ b/lib/checkinternal.h @@ -44,7 +44,7 @@ public: } /** Simplified checks. The token list is simplified. */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { if (!settings->isEnabled(Settings::INTERNAL)) return; @@ -94,7 +94,7 @@ private: void extraWhitespaceError(const Token *tok, const std::string &pattern, const std::string &funcname); void checkRedundantTokCheckError(const Token *tok); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckInternal c(nullptr, settings, errorLogger); c.multiComparePatternError(nullptr, ";|%type%", "Match"); c.simplePatternError(nullptr, "class {", "Match"); @@ -111,7 +111,7 @@ private: return "cppcheck internal API usage"; } - std::string classInfo() const { + std::string classInfo() const override { // Don't include these checks on the WIKI where people can read what // checks there are. These checks are not intended for users. return ""; diff --git a/lib/checkio.h b/lib/checkio.h index ce6bc889f..9d8440f69 100644 --- a/lib/checkio.h +++ b/lib/checkio.h @@ -50,14 +50,14 @@ public: } /** @brief Run checks on the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckIO checkIO(tokenizer, settings, errorLogger); checkIO.checkWrongPrintfScanfArguments(); } /** @brief Run checks on the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckIO checkIO(tokenizer, settings, errorLogger); checkIO.checkCoutCerrMisusage(); @@ -139,7 +139,7 @@ private: static void argumentType(std::ostream & os, const ArgumentInfo * argInfo); static Severity::SeverityType getSeverity(const ArgumentInfo *argInfo); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckIO c(nullptr, settings, errorLogger); c.coutCerrMisusageError(nullptr, "cout"); @@ -169,7 +169,7 @@ private: return "IO using format string"; } - std::string classInfo() const { + std::string classInfo() const override { return "Check format string input/output operations.\n" "- Bad usage of the function 'sprintf' (overlapping data)\n" "- Missing or wrong width specifiers in 'scanf' format string\n" diff --git a/lib/checkleakautovar.h b/lib/checkleakautovar.h index cd2a43418..aef45f436 100644 --- a/lib/checkleakautovar.h +++ b/lib/checkleakautovar.h @@ -104,7 +104,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckLeakAutoVar checkLeakAutoVar(tokenizer, settings, errorLogger); checkLeakAutoVar.check(); } @@ -140,7 +140,7 @@ private: /** message: user configuration is needed to complete analysis */ void configurationInfo(const Token* tok, const std::string &functionName); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckLeakAutoVar c(nullptr, settings, errorLogger); c.deallocReturnError(nullptr, "p"); c.configurationInfo(nullptr, "f"); // user configuration is needed to complete analysis @@ -151,7 +151,7 @@ private: return "Leaks (auto variables)"; } - std::string classInfo() const { + std::string classInfo() const override { return "Detect when a auto variable is allocated but not deallocated or deallocated twice.\n"; } }; diff --git a/lib/checkmemoryleak.h b/lib/checkmemoryleak.h index 12b026c8d..147863162 100644 --- a/lib/checkmemoryleak.h +++ b/lib/checkmemoryleak.h @@ -195,7 +195,7 @@ public: } /** @brief run all simplified checks */ - void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) { + void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) override { CheckMemoryLeakInFunction checkMemoryLeak(tokenizr, settings, errLog); checkMemoryLeak.checkReallocUsage(); checkMemoryLeak.check(); @@ -288,7 +288,7 @@ public: private: /** Report all possible errors (for the --errorlist) */ - void getErrorMessages(ErrorLogger *e, const Settings *settings) const { + void getErrorMessages(ErrorLogger *e, const Settings *settings) const override { CheckMemoryLeakInFunction c(nullptr, settings, e); c.memleakError(nullptr, "varname"); @@ -314,7 +314,7 @@ private: * Get class information (--doc) * @return Wiki formatted information about this class */ - std::string classInfo() const { + std::string classInfo() const override { return "Is there any allocated memory when a function goes out of scope\n"; } @@ -336,7 +336,7 @@ public: : Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings) { } - void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) { + void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) override { if (!tokenizr->isCPP()) return; @@ -355,7 +355,7 @@ private: void unsafeClassError(const Token *tok, const std::string &classname, const std::string &varname); - void getErrorMessages(ErrorLogger *e, const Settings *settings) const { + void getErrorMessages(ErrorLogger *e, const Settings *settings) const override { CheckMemoryLeakInClass c(nullptr, settings, e); c.publicAllocationError(nullptr, "varname"); c.unsafeClassError(nullptr, "class", "class::varname"); @@ -365,7 +365,7 @@ private: return "Memory leaks (class variables)"; } - std::string classInfo() const { + std::string classInfo() const override { return "If the constructor allocate memory then the destructor must deallocate it.\n"; } }; @@ -383,7 +383,7 @@ public: : Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings) { } - void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) { + void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) override { CheckMemoryLeakStructMember checkMemoryLeak(tokenizr, settings, errLog); checkMemoryLeak.check(); } @@ -397,14 +397,14 @@ private: void checkStructVariable(const Variable * const variable); - void getErrorMessages(ErrorLogger * /*errorLogger*/, const Settings * /*settings*/) const { + void getErrorMessages(ErrorLogger * /*errorLogger*/, const Settings * /*settings*/) const override { } static std::string myName() { return "Memory leaks (struct members)"; } - std::string classInfo() const { + std::string classInfo() const override { return "Don't forget to deallocate struct members\n"; } }; @@ -422,7 +422,7 @@ public: : Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings) { } - void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) { + void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) override { CheckMemoryLeakNoVar checkMemoryLeak(tokenizr, settings, errLog); checkMemoryLeak.check(); } @@ -446,7 +446,7 @@ private: void returnValueNotUsedError(const Token* tok, const std::string &alloc); void unsafeArgAllocError(const Token *tok, const std::string &funcName, const std::string &ptrType, const std::string &objType); - void getErrorMessages(ErrorLogger *e, const Settings *settings) const { + void getErrorMessages(ErrorLogger *e, const Settings *settings) const override { CheckMemoryLeakNoVar c(nullptr, settings, e); c.functionCallLeak(nullptr, "funcName", "funcName"); @@ -458,7 +458,7 @@ private: return "Memory leaks (address not taken)"; } - std::string classInfo() const { + std::string classInfo() const override { return "Not taking the address to allocated memory\n"; } }; diff --git a/lib/checknullpointer.h b/lib/checknullpointer.h index 430e05059..30168c4e8 100644 --- a/lib/checknullpointer.h +++ b/lib/checknullpointer.h @@ -54,14 +54,14 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckNullPointer checkNullPointer(tokenizer, settings, errorLogger); checkNullPointer.nullPointer(); checkNullPointer.arithmetic(); } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckNullPointer checkNullPointer(tokenizer, settings, errorLogger); checkNullPointer.nullConstantDereference(); } @@ -102,7 +102,7 @@ public: private: /** Get error messages. Used by --errorlist */ - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckNullPointer c(nullptr, settings, errorLogger); c.nullPointerError(nullptr, "pointer", nullptr, false); c.arithmeticError(nullptr, nullptr); @@ -114,7 +114,7 @@ private: } /** class info in WIKI format. Used by --doc */ - std::string classInfo() const { + std::string classInfo() const override { return "Null pointers\n" "- null pointer dereferencing\n" "- undefined null pointer arithmetic\n"; diff --git a/lib/checkother.h b/lib/checkother.h index 13600a3d4..1e4dc95c5 100644 --- a/lib/checkother.h +++ b/lib/checkother.h @@ -54,7 +54,7 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckOther checkOther(tokenizer, settings, errorLogger); // Checks @@ -84,7 +84,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckOther checkOther(tokenizer, settings, errorLogger); // Checks @@ -264,7 +264,7 @@ private: void funcArgNamesDifferent(const std::string & functionName, size_t index, const Token* declaration, const Token* definition); void funcArgOrderDifferent(const std::string & functionName, const Token * declaration, const Token * definition, const std::vector & declarations, const std::vector & definitions); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckOther c(nullptr, settings, errorLogger); // error @@ -329,7 +329,7 @@ private: return "Other"; } - std::string classInfo() const { + std::string classInfo() const override { return "Other checks\n" // error diff --git a/lib/checkpostfixoperator.h b/lib/checkpostfixoperator.h index 5d046e88d..682008857 100644 --- a/lib/checkpostfixoperator.h +++ b/lib/checkpostfixoperator.h @@ -50,14 +50,14 @@ public: : Check(myName(), tokenizer, settings, errorLogger) { } - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { if (tokenizer->isC()) return; CheckPostfixOperator checkPostfixOperator(tokenizer, settings, errorLogger); checkPostfixOperator.postfixOperator(); } - void runSimplifiedChecks(const Tokenizer * /*tokenizer*/, const Settings * /*settings*/, ErrorLogger * /*errorLogger*/) { + void runSimplifiedChecks(const Tokenizer * /*tokenizer*/, const Settings * /*settings*/, ErrorLogger * /*errorLogger*/) override { } /** Check postfix operators */ @@ -67,7 +67,7 @@ private: /** Report Error */ void postfixOperatorError(const Token *tok); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckPostfixOperator c(nullptr, settings, errorLogger); c.postfixOperatorError(nullptr); } @@ -76,7 +76,7 @@ private: return "Using postfix operators"; } - std::string classInfo() const { + std::string classInfo() const override { return "Warn if using postfix operators ++ or -- rather than prefix operator\n"; } }; diff --git a/lib/checksizeof.h b/lib/checksizeof.h index 6e367aebc..81a9762bf 100644 --- a/lib/checksizeof.h +++ b/lib/checksizeof.h @@ -50,7 +50,7 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger) { + void runChecks(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger) override { CheckSizeof checkSizeof(tokenizer, settings, errorLogger); // Checks @@ -65,7 +65,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer* /*tokenizer*/, const Settings* /*settings*/, ErrorLogger* /*errorLogger*/) { + void runSimplifiedChecks(const Tokenizer* /*tokenizer*/, const Settings* /*settings*/, ErrorLogger* /*errorLogger*/) override { } /** @brief %Check for 'sizeof sizeof ..' */ @@ -107,7 +107,7 @@ private: void sizeofDereferencedVoidPointerError(const Token *tok, const std::string &varname); void arithOperationsOnVoidPointerError(const Token* tok, const std::string &varname, const std::string &vartype); - void getErrorMessages(ErrorLogger* errorLogger, const Settings* settings) const { + void getErrorMessages(ErrorLogger* errorLogger, const Settings* settings) const override { CheckSizeof c(nullptr, settings, errorLogger); c.sizeofForArrayParameterError(nullptr); @@ -128,7 +128,7 @@ private: return "Sizeof"; } - std::string classInfo() const { + std::string classInfo() const override { return "sizeof() usage checks\n" "- sizeof for array given as function argument\n" "- sizeof for numeric given as function argument\n" diff --git a/lib/checkstl.h b/lib/checkstl.h index ff2180fde..21fccfe44 100644 --- a/lib/checkstl.h +++ b/lib/checkstl.h @@ -54,7 +54,7 @@ public: } /** Simplified checks. The token list is simplified. */ - void runSimplifiedChecks(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger) { + void runSimplifiedChecks(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger) override { if (!tokenizer->isCPP()) { return; } @@ -205,7 +205,7 @@ private: void readingEmptyStlContainerError(const Token* tok); - void getErrorMessages(ErrorLogger* errorLogger, const Settings* settings) const { + void getErrorMessages(ErrorLogger* errorLogger, const Settings* settings) const override { CheckStl c(nullptr, settings, errorLogger); c.invalidIteratorError(nullptr, "iterator"); c.iteratorsError(nullptr, "container1", "container2"); @@ -241,7 +241,7 @@ private: return "STL usage"; } - std::string classInfo() const { + std::string classInfo() const override { return "Check for invalid usage of STL:\n" "- out of bounds errors\n" "- misuse of iterators when iterating through a container\n" diff --git a/lib/checkstring.h b/lib/checkstring.h index 99fd18b29..7905898ba 100644 --- a/lib/checkstring.h +++ b/lib/checkstring.h @@ -50,7 +50,7 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckString checkString(tokenizer, settings, errorLogger); // Checks @@ -61,7 +61,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckString checkString(tokenizer, settings, errorLogger); // Checks @@ -103,7 +103,7 @@ private: void suspiciousStringCompareError_char(const Token* tok, const std::string& var); void overlappingStrcmpError(const Token* eq0, const Token *ne0); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckString c(nullptr, settings, errorLogger); c.stringLiteralWriteError(nullptr, nullptr); @@ -122,7 +122,7 @@ private: return "String"; } - std::string classInfo() const { + std::string classInfo() const override { return "Detect misusage of C-style strings:\n" "- overlapping buffers passed to sprintf as source and destination\n" "- incorrect length arguments for 'substr' and 'strncmp'\n" diff --git a/lib/checktype.h b/lib/checktype.h index 63c0a2273..4de80bc37 100644 --- a/lib/checktype.h +++ b/lib/checktype.h @@ -49,7 +49,7 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { // These are not "simplified" because casts can't be ignored CheckType checkType(tokenizer, settings, errorLogger); checkType.checkTooBigBitwiseShift(); @@ -60,7 +60,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { (void)tokenizer; (void)settings; (void)errorLogger; @@ -91,7 +91,7 @@ private: void longCastReturnError(const Token *tok); void floatToIntegerOverflowError(const Token *tok, const ValueFlow::Value &value); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckType c(nullptr, settings, errorLogger); c.tooBigBitwiseShiftError(nullptr, 32, ValueFlow::Value(64)); c.tooBigSignedBitwiseShiftError(nullptr, 31, ValueFlow::Value(31)); @@ -109,7 +109,7 @@ private: return "Type"; } - std::string classInfo() const { + std::string classInfo() const override { return "Type checks\n" "- bitwise shift by too many bits (only enabled when --platform is used)\n" "- signed integer overflow (only enabled when --platform is used)\n" diff --git a/lib/checkuninitvar.h b/lib/checkuninitvar.h index a8f46a4eb..aaedb128a 100644 --- a/lib/checkuninitvar.h +++ b/lib/checkuninitvar.h @@ -60,7 +60,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckUninitVar checkUninitVar(tokenizer, settings, errorLogger); checkUninitVar.check(); checkUninitVar.deadPointer(); @@ -100,7 +100,7 @@ public: void uninitStructMemberError(const Token *tok, const std::string &membername); private: - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckUninitVar c(nullptr, settings, errorLogger); // error @@ -115,7 +115,7 @@ private: return "Uninitialized variables"; } - std::string classInfo() const { + std::string classInfo() const override { return "Uninitialized variables\n" "- using uninitialized local variables\n" "- using allocated data before it has been initialized\n" diff --git a/lib/checkunusedfunctions.h b/lib/checkunusedfunctions.h index ae41c8df4..2fb1486c2 100644 --- a/lib/checkunusedfunctions.h +++ b/lib/checkunusedfunctions.h @@ -64,7 +64,7 @@ public: bool check(ErrorLogger * const errorLogger, const Settings& settings); /** @brief Parse current TU and extract file info */ - Check::FileInfo *getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const; + Check::FileInfo *getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const override; /** @brief Analyse all file infos for all TU */ bool analyseWholeProgram(const std::list &fileInfo, const Settings& settings, ErrorLogger &errorLogger); @@ -78,7 +78,7 @@ public: private: - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckUnusedFunctions c(nullptr, settings, errorLogger); c.unusedFunctionError(errorLogger, emptyString, 0, "funcName"); } @@ -93,14 +93,14 @@ private: /** * Dummy implementation, just to provide error for --errorlist */ - void runSimplifiedChecks(const Tokenizer* /*tokenizer*/, const Settings* /*settings*/, ErrorLogger* /*errorLogger*/) { + void runSimplifiedChecks(const Tokenizer* /*tokenizer*/, const Settings* /*settings*/, ErrorLogger* /*errorLogger*/) override { } static std::string myName() { return "Unused functions"; } - std::string classInfo() const { + std::string classInfo() const override { return "Check for functions that are never called\n"; } diff --git a/lib/checkunusedvar.h b/lib/checkunusedvar.h index b7b5f7dc1..0c39466fe 100644 --- a/lib/checkunusedvar.h +++ b/lib/checkunusedvar.h @@ -53,7 +53,7 @@ public: } /** @brief Run checks against the normal token list */ - void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckUnusedVar checkUnusedVar(tokenizer, settings, errorLogger); // Coding style checks @@ -62,7 +62,7 @@ public: } /** @brief Run checks against the simplified token list */ - void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { (void)tokenizer; (void)settings; (void)errorLogger; @@ -86,7 +86,7 @@ private: void unreadVariableError(const Token *tok, const std::string &varname, bool modified); void unassignedVariableError(const Token *tok, const std::string &varname); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckUnusedVar c(nullptr, settings, errorLogger); // style/warning @@ -101,7 +101,7 @@ private: return "UnusedVar"; } - std::string classInfo() const { + std::string classInfo() const override { return "UnusedVar checks\n" // style diff --git a/lib/checkvaarg.h b/lib/checkvaarg.h index b36a199cf..bc125eb42 100644 --- a/lib/checkvaarg.h +++ b/lib/checkvaarg.h @@ -48,7 +48,7 @@ public: : Check(myName(), tokenizer, settings, errorLogger) { } - virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { + virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override { CheckVaarg check(tokenizer, settings, errorLogger); check.va_start_argument(); check.va_list_usage(); @@ -64,7 +64,7 @@ private: void va_list_usedBeforeStartedError(const Token *tok, const std::string& varname); void va_start_subsequentCallsError(const Token *tok, const std::string& varname); - void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { + void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override { CheckVaarg c(nullptr, settings, errorLogger); c.wrongParameterTo_va_start_error(nullptr, "arg1", "arg2"); c.referenceAs_va_start_error(nullptr, "arg1"); @@ -77,7 +77,7 @@ private: return "Vaarg"; } - std::string classInfo() const { + std::string classInfo() const override { return "Check for misusage of variable argument lists:\n" "- Wrong parameter passed to va_start()\n" "- Reference passed to va_start()\n" diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 3dc25715b..877feb67f 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -189,24 +189,24 @@ private: * "[filepath:line number] Message", e.g. * "[main.cpp:4] Uninitialized member variable" */ - virtual void reportErr(const ErrorLogger::ErrorMessage &msg); + virtual void reportErr(const ErrorLogger::ErrorMessage &msg) override; /** * @brief Information about progress is directed here. * * @param outmsg Message to show, e.g. "Checking main.cpp..." */ - virtual void reportOut(const std::string &outmsg); + virtual void reportOut(const std::string &outmsg) override; std::list _errorList; Settings _settings; - void reportProgress(const std::string &filename, const char stage[], const std::size_t value); + void reportProgress(const std::string &filename, const char stage[], const std::size_t value) override; /** * Output information messages. */ - virtual void reportInfo(const ErrorLogger::ErrorMessage &msg); + virtual void reportInfo(const ErrorLogger::ErrorMessage &msg) override; ErrorLogger &_errorLogger; diff --git a/lib/timer.h b/lib/timer.h index 296f10f73..6fdebc418 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -61,7 +61,7 @@ public: } void ShowResults(SHOWTIME_MODES mode) const; - virtual void AddResults(const std::string& str, std::clock_t clocks); + virtual void AddResults(const std::string& str, std::clock_t clocks) override; private: std::map _results; diff --git a/test/test64bit.cpp b/test/test64bit.cpp index 2b45bd012..19af8e382 100644 --- a/test/test64bit.cpp +++ b/test/test64bit.cpp @@ -31,7 +31,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("portability"); TEST_CASE(novardecl); diff --git a/test/testassert.cpp b/test/testassert.cpp index 751df9332..14cdaa231 100644 --- a/test/testassert.cpp +++ b/test/testassert.cpp @@ -44,7 +44,7 @@ private: checkAssert.runSimplifiedChecks(&tokenizer, &settings, this); } - void run() { + void run() override { settings.addEnabled("warning"); TEST_CASE(assignmentInAssert); diff --git a/test/testastutils.cpp b/test/testastutils.cpp index b07454f21..fc36754a0 100644 --- a/test/testastutils.cpp +++ b/test/testastutils.cpp @@ -32,7 +32,7 @@ public: private: - void run() { + void run() override { TEST_CASE(isReturnScope); TEST_CASE(isVariableChanged); TEST_CASE(isVariableChangedByFunctionCall); diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index 1bdd8e8e7..05e00724f 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -55,7 +55,7 @@ private: } } - void run() { + void run() override { settings.addEnabled("warning"); settings.addEnabled("style"); LOAD_LIB_2(settings.library, "std.cfg"); diff --git a/test/testbool.cpp b/test/testbool.cpp index ecc8e19e9..fd8f770b8 100644 --- a/test/testbool.cpp +++ b/test/testbool.cpp @@ -31,7 +31,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("style"); settings.addEnabled("warning"); settings.inconclusive = true; diff --git a/test/testboost.cpp b/test/testboost.cpp index a54c7f2d6..3633cd80e 100644 --- a/test/testboost.cpp +++ b/test/testboost.cpp @@ -31,7 +31,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("style"); settings.addEnabled("performance"); diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 322218606..af51a4f0d 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -73,7 +73,7 @@ private: checkBufferOverrun.runSimplifiedChecks(&tokenizer, &settings, this); } - void run() { + void run() override { settings0.addEnabled("warning"); settings0.addEnabled("style"); settings0.addEnabled("portability"); diff --git a/test/testcharvar.cpp b/test/testcharvar.cpp index b53778a58..0fc47edab 100644 --- a/test/testcharvar.cpp +++ b/test/testcharvar.cpp @@ -32,7 +32,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.platform(Settings::Unspecified); settings.addEnabled("warning"); settings.addEnabled("portability"); diff --git a/test/testclass.cpp b/test/testclass.cpp index 20ece9261..744abb25a 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -34,7 +34,7 @@ private: Settings settings0; Settings settings1; - void run() { + void run() override { settings0.addEnabled("style"); settings1.addEnabled("warning"); diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 542c706ec..78a018666 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -42,7 +42,7 @@ private: Settings settings; CmdLineParser defParser; - void run() { + void run() override { TEST_CASE(nooptions); TEST_CASE(helpshort); TEST_CASE(helplong); diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 4ea80d75d..5ee9766ff 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -36,7 +36,7 @@ private: Settings settings0; Settings settings1; - void run() { + void run() override { LOAD_LIB_2(settings0.library, "qt.cfg"); settings0.addEnabled("style"); diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 7629b6209..2fac2774c 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -48,7 +48,7 @@ private: checkClass.constructors(); } - void run() { + void run() override { settings.addEnabled("style"); settings.addEnabled("warning"); diff --git a/test/testcppcheck.cpp b/test/testcppcheck.cpp index 6d264d163..28c120af0 100644 --- a/test/testcppcheck.cpp +++ b/test/testcppcheck.cpp @@ -45,7 +45,7 @@ private: } }; - void run() { + void run() override { TEST_CASE(instancesSorted); TEST_CASE(classInfoFormat); TEST_CASE(getErrorMessages); diff --git a/test/testerrorlogger.cpp b/test/testerrorlogger.cpp index fde974684..2d38c05bf 100644 --- a/test/testerrorlogger.cpp +++ b/test/testerrorlogger.cpp @@ -35,7 +35,7 @@ private: const ErrorLogger::ErrorMessage::FileLocation fooCpp5; const ErrorLogger::ErrorMessage::FileLocation barCpp8; - void run() { + void run() override { TEST_CASE(PatternSearchReplace); TEST_CASE(FileLocationDefaults); TEST_CASE(FileLocationSetFile); diff --git a/test/testexceptionsafety.cpp b/test/testexceptionsafety.cpp index a5ca0da33..65fed6c12 100644 --- a/test/testexceptionsafety.cpp +++ b/test/testexceptionsafety.cpp @@ -31,7 +31,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("all"); TEST_CASE(destructors); diff --git a/test/testfilelister.cpp b/test/testfilelister.cpp index fe8a4481d..1639da267 100644 --- a/test/testfilelister.cpp +++ b/test/testfilelister.cpp @@ -37,7 +37,7 @@ public: } private: - void run() { + void run() override { // bail out if the tests are not executed from the base folder { std::ifstream fin("test/testfilelister.cpp"); diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index c90f2a87c..39a28200f 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -34,7 +34,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("style"); settings.addEnabled("warning"); settings.addEnabled("portability"); diff --git a/test/testgarbage.cpp b/test/testgarbage.cpp index 6274f0b30..d0501b193 100644 --- a/test/testgarbage.cpp +++ b/test/testgarbage.cpp @@ -34,7 +34,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.debugwarnings = true; settings.addEnabled("style"); settings.addEnabled("warning"); diff --git a/test/testimportproject.cpp b/test/testimportproject.cpp index 96a1fd4c7..4742b2230 100644 --- a/test/testimportproject.cpp +++ b/test/testimportproject.cpp @@ -38,7 +38,7 @@ public: private: - void run() { + void run() override { TEST_CASE(setDefines); TEST_CASE(setIncludePaths1); TEST_CASE(setIncludePaths2); diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index ab4c079a5..e2225aa1e 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -59,7 +59,7 @@ private: checkOther.checkIncompleteStatement(); } - void run() { + void run() override { settings.addEnabled("warning"); TEST_CASE(test1); diff --git a/test/testinternal.cpp b/test/testinternal.cpp index 54b219190..2c3f729d6 100644 --- a/test/testinternal.cpp +++ b/test/testinternal.cpp @@ -31,7 +31,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("internal"); TEST_CASE(simplePatternInTokenMatch) diff --git a/test/testio.cpp b/test/testio.cpp index b24fdc478..345cad93b 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -32,7 +32,7 @@ public: private: Settings settings; - void run() { + void run() override { LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "windows.cfg"); LOAD_LIB_2(settings.library, "qt.cfg"); diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 24cb0849e..5cc651780 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -32,7 +32,7 @@ public: private: Settings settings; - void run() { + void run() override { int id = 0; while (!settings.library.ismemory(++id)); settings.library.setalloc("malloc", id, -1); @@ -1566,7 +1566,7 @@ private: checkLeak.runSimplifiedChecks(&tokenizer, &settings, this); } - void run() { + void run() override { LOAD_LIB_2(settings.library, "windows.cfg"); TEST_CASE(heapDoubleFree); diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 86fd951b6..1fedf4393 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -39,7 +39,7 @@ public: private: Settings settings; - void run() { + void run() override { TEST_CASE(empty); TEST_CASE(function); TEST_CASE(function_match_scope); diff --git a/test/testmathlib.cpp b/test/testmathlib.cpp index 7355ede37..bf80de532 100644 --- a/test/testmathlib.cpp +++ b/test/testmathlib.cpp @@ -30,7 +30,7 @@ public: private: - void run() { + void run() override { TEST_CASE(isint); TEST_CASE(isbin); TEST_CASE(isdec); diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 11fb5b88d..79567da46 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -42,7 +42,7 @@ public: private: Settings settings; - void run() { + void run() override { TEST_CASE(testFunctionReturnType); TEST_CASE(open); } @@ -153,7 +153,7 @@ private: } - void run() { + void run() override { LOAD_LIB_2(settings1.library, "std.cfg"); LOAD_LIB_2(settings1.library, "posix.cfg"); LOAD_LIB_2(settings2.library, "std.cfg"); @@ -4108,7 +4108,7 @@ private: checkMemoryLeak.check(); } - void run() { + void run() override { settings.addEnabled("warning"); settings.addEnabled("style"); @@ -5282,7 +5282,7 @@ private: checkMemoryLeakStructMember.check(); } - void run() { + void run() override { LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "posix.cfg"); @@ -5730,7 +5730,7 @@ private: checkMemoryLeakNoVar.check(); } - void run() { + void run() override { settings.inconclusive = true; settings.standards.posix = true; settings.addEnabled("warning"); @@ -6065,7 +6065,7 @@ private: checkMemoryLeak4.check(); } - void run() { + void run() override { LOAD_LIB_2(settings.library, "gtk.cfg"); settings.addEnabled("all"); @@ -6180,7 +6180,7 @@ private: checkMemoryLeak.check(); } - void run() { + void run() override { LOAD_LIB_2(settings.library, "windows.cfg"); TEST_CASE(openfileNoLeak); diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index 8932fcf6b..7afad077e 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -38,7 +38,7 @@ public: private: Settings settings; - void run() { + void run() override { // Load std.cfg configuration { const char xmldata[] = "\n" diff --git a/test/testoptions.cpp b/test/testoptions.cpp index 113a45da1..1eaa26522 100644 --- a/test/testoptions.cpp +++ b/test/testoptions.cpp @@ -26,7 +26,7 @@ public: private: - void run() { + void run() override { TEST_CASE(which_test); TEST_CASE(which_test_method); TEST_CASE(no_test_method); diff --git a/test/testother.cpp b/test/testother.cpp index f83fb4b6a..aa8884ae4 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -38,7 +38,7 @@ public: private: Settings _settings; - void run() { + void run() override { LOAD_LIB_2(_settings.library, "std.cfg"); diff --git a/test/testpath.cpp b/test/testpath.cpp index 0263f010f..ae0656f24 100644 --- a/test/testpath.cpp +++ b/test/testpath.cpp @@ -29,7 +29,7 @@ public: private: - void run() { + void run() override { TEST_CASE(removeQuotationMarks); TEST_CASE(acceptFile); TEST_CASE(getCurrentPath); diff --git a/test/testpathmatch.cpp b/test/testpathmatch.cpp index 9c79ce0d2..858e4e52e 100644 --- a/test/testpathmatch.cpp +++ b/test/testpathmatch.cpp @@ -39,7 +39,7 @@ private: const PathMatch fooCppMatcher; const PathMatch srcFooCppMatcher; - void run() { + void run() override { TEST_CASE(emptymaskemptyfile); TEST_CASE(emptymaskpath1); TEST_CASE(emptymaskpath2); diff --git a/test/testplatform.cpp b/test/testplatform.cpp index 67c779ded..b2db0a382 100644 --- a/test/testplatform.cpp +++ b/test/testplatform.cpp @@ -28,7 +28,7 @@ public: TestPlatform() : TestFixture("TestPlatform") { } private: - void run() { + void run() override { TEST_CASE(empty); TEST_CASE(valid_config_native_1); TEST_CASE(valid_config_native_2); diff --git a/test/testpostfixoperator.cpp b/test/testpostfixoperator.cpp index ca52a6231..0ec9a5c93 100644 --- a/test/testpostfixoperator.cpp +++ b/test/testpostfixoperator.cpp @@ -46,7 +46,7 @@ private: checkPostfixOperator.postfixOperator(); } - void run() { + void run() override { settings.addEnabled("performance"); TEST_CASE(testsimple); diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 4abb0f8dc..72090e8ec 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -68,7 +68,7 @@ private: Settings settings0; Preprocessor preprocessor0; - void run() { + void run() override { // The bug that started the whole work with the new preprocessor TEST_CASE(Bug2190219); diff --git a/test/testsamples.cpp b/test/testsamples.cpp index a0f5a8959..d0e01e76e 100644 --- a/test/testsamples.cpp +++ b/test/testsamples.cpp @@ -44,7 +44,7 @@ public: private: - void run() { + void run() override { TEST_CASE(runSamples); TEST_CASE(runConsoleCodePageTranslationOnWindows); } diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index 464fdf985..32f6f94a0 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -36,7 +36,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("portability"); TEST_CASE(template1); diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 79a026006..86cc57039 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -39,7 +39,7 @@ private: Settings settings_std; Settings settings_windows; - void run() { + void run() override { LOAD_LIB_2(settings_std.library, "std.cfg"); LOAD_LIB_2(settings_windows.library, "windows.cfg"); settings0.addEnabled("portability"); diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 70bf6c727..fbbe2fc5f 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -38,7 +38,7 @@ private: Settings settings1; Settings settings2; - void run() { + void run() override { settings0.addEnabled("style"); settings2.addEnabled("style"); diff --git a/test/testsizeof.cpp b/test/testsizeof.cpp index 9d86d5096..848ed7864 100644 --- a/test/testsizeof.cpp +++ b/test/testsizeof.cpp @@ -33,7 +33,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("warning"); settings.addEnabled("portability"); settings.inconclusive = true; diff --git a/test/teststl.cpp b/test/teststl.cpp index c833911ac..006e23fd7 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -34,7 +34,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("warning"); settings.addEnabled("style"); settings.addEnabled("performance"); diff --git a/test/teststring.cpp b/test/teststring.cpp index d542bba0e..a9dbdfba5 100644 --- a/test/teststring.cpp +++ b/test/teststring.cpp @@ -31,7 +31,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("warning"); settings.addEnabled("style"); diff --git a/test/testsuite.h b/test/testsuite.h index 056ac8b5e..31da17a15 100644 --- a/test/testsuite.h +++ b/test/testsuite.h @@ -69,8 +69,8 @@ protected: void processOptions(const options& args); public: - virtual void reportOut(const std::string &outmsg); - virtual void reportErr(const ErrorLogger::ErrorMessage &msg); + virtual void reportOut(const std::string &outmsg) override; + virtual void reportErr(const ErrorLogger::ErrorMessage &msg) override; void run(const std::string &str); const std::string classname; diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index 564547ba3..a9f5e5b50 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -37,7 +37,7 @@ public: private: - void run() { + void run() override { TEST_CASE(suppressionsBadId1); TEST_CASE(suppressionsDosFormat); // Ticket #1836 TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index ec39205eb..035e5c5c1 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -110,7 +110,7 @@ private: return 0; } - void run() { + void run() override { LOAD_LIB_2(settings1.library, "std.cfg"); settings2.platform(Settings::Unspecified); diff --git a/test/testthreadexecutor.cpp b/test/testthreadexecutor.cpp index 71d3b7589..7a2d4603e 100644 --- a/test/testthreadexecutor.cpp +++ b/test/testthreadexecutor.cpp @@ -61,7 +61,7 @@ private: ASSERT_EQUALS(result, executor.check()); } - void run() { + void run() override { LOAD_LIB_2(settings.library, "std.cfg"); TEST_CASE(deadlock_with_many_errors); diff --git a/test/testtimer.cpp b/test/testtimer.cpp index 87604fba3..136cc56d3 100644 --- a/test/testtimer.cpp +++ b/test/testtimer.cpp @@ -29,7 +29,7 @@ public: private: - void run() { + void run() override { TEST_CASE(result); } diff --git a/test/testtoken.cpp b/test/testtoken.cpp index 4769c6704..b1ec308a4 100644 --- a/test/testtoken.cpp +++ b/test/testtoken.cpp @@ -42,7 +42,7 @@ private: std::vector extendedOps; std::vector assignmentOps; - void run() { + void run() override { arithmeticalOps = { "+", "-", "*", "/", "%", "<<", ">>" }; logicalOps = { "&&", "||", "!" }; comparisonOps = { "==", "!=", "<", "<=", ">", ">=" }; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 566b51bd2..1135c7a70 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -44,7 +44,7 @@ private: Settings settings2; Settings settings_windows; - void run() { + void run() override { LOAD_LIB_2(settings_windows.library, "windows.cfg"); TEST_CASE(tokenize1); diff --git a/test/testtokenlist.cpp b/test/testtokenlist.cpp index 7d0949f30..08724e4cb 100644 --- a/test/testtokenlist.cpp +++ b/test/testtokenlist.cpp @@ -32,7 +32,7 @@ public: private: Settings settings; - void run() { + void run() override { TEST_CASE(testaddtoken1); TEST_CASE(testaddtoken2); TEST_CASE(inc); diff --git a/test/testtype.cpp b/test/testtype.cpp index 464461006..9b2410186 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -32,7 +32,7 @@ public: private: - void run() { + void run() override { TEST_CASE(checkTooBigShift_Unix32); TEST_CASE(checkIntegerOverflow); TEST_CASE(signConversion); diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 8cf87ad46..e7dfab55f 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -36,7 +36,7 @@ public: private: Settings settings; - void run() { + void run() override { LOAD_LIB_2(settings.library, "std.cfg"); TEST_CASE(uninitvar1); diff --git a/test/testunusedfunctions.cpp b/test/testunusedfunctions.cpp index d178ae6cb..28b12ee85 100644 --- a/test/testunusedfunctions.cpp +++ b/test/testunusedfunctions.cpp @@ -33,7 +33,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("style"); TEST_CASE(incondition); diff --git a/test/testunusedprivfunc.cpp b/test/testunusedprivfunc.cpp index cfeeefdb3..a9e22425b 100644 --- a/test/testunusedprivfunc.cpp +++ b/test/testunusedprivfunc.cpp @@ -34,7 +34,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("style"); TEST_CASE(test1); diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index e92961195..01da57917 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -31,7 +31,7 @@ public: private: Settings settings; - void run() { + void run() override { settings.addEnabled("style"); TEST_CASE(emptyclass); // #5355 - False positive: Variable is not assigned a value. diff --git a/test/testutils.h b/test/testutils.h index 1e47e763e..406953896 100644 --- a/test/testutils.h +++ b/test/testutils.h @@ -50,10 +50,10 @@ public: SimpleSuppressor(Settings &settings, ErrorLogger *next) : _settings(settings), _next(next) { } - virtual void reportOut(const std::string &outmsg) { + virtual void reportOut(const std::string &outmsg) override { _next->reportOut(outmsg); } - virtual void reportErr(const ErrorLogger::ErrorMessage &msg) { + virtual void reportErr(const ErrorLogger::ErrorMessage &msg) override { if (!msg._callStack.empty() && !_settings.nomsg.isSuppressed(msg.toSuppressionsErrorMessage())) _next->reportErr(msg); } diff --git a/test/testvaarg.cpp b/test/testvaarg.cpp index 458ad1f6b..08bb056c0 100644 --- a/test/testvaarg.cpp +++ b/test/testvaarg.cpp @@ -44,7 +44,7 @@ private: checkVaarg.runSimplifiedChecks(&tokenizer, &settings, this); } - void run() { + void run() override { settings.addEnabled("warning"); TEST_CASE(wrongParameterTo_va_start); diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 821c7c918..70222d766 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -41,7 +41,7 @@ public: private: Settings settings; - void run() { + void run() override { // strcpy, abort cfg const char cfg[] = "\n" "\n" diff --git a/test/testvarid.cpp b/test/testvarid.cpp index c8f1d5d81..8e37b8e5a 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -34,7 +34,7 @@ public: } private: - void run() { + void run() override { TEST_CASE(varid1); TEST_CASE(varid2); TEST_CASE(varid3);