Fix override warnings. (#1234)

This commit is contained in:
IOBYTE 2018-05-15 10:37:40 -04:00 committed by Daniel Marjamäki
parent 6bd4bdb0f9
commit ce50df8047
93 changed files with 204 additions and 204 deletions

View File

@ -69,17 +69,17 @@ public:
* *
* @param outmsg Progress message e.g. "Checking main.cpp..." * @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 */ /** 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. * 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 * Information about how many files have been checked

View File

@ -49,9 +49,9 @@ public:
virtual ~ThreadExecutor(); virtual ~ThreadExecutor();
unsigned int check(); unsigned int check();
virtual void reportOut(const std::string &outmsg); virtual void reportOut(const std::string &outmsg) override;
virtual void reportErr(const ErrorLogger::ErrorMessage &msg); virtual void reportErr(const ErrorLogger::ErrorMessage &msg) override;
virtual void reportInfo(const ErrorLogger::ErrorMessage &msg); virtual void reportInfo(const ErrorLogger::ErrorMessage &msg) override;
/** /**
* @brief Add content to a file, to be used in unit testing. * @brief Add content to a file, to be used in unit testing.

View File

@ -42,23 +42,23 @@ public:
* @brief Create the report (file). * @brief Create the report (file).
* @return true if succeeded, false if file could not be created. * @return true if succeeded, false if file could not be created.
*/ */
virtual bool create(); virtual bool create() override;
/** /**
* @brief Write report header. * @brief Write report header.
*/ */
virtual void writeHeader(); virtual void writeHeader() override;
/** /**
* @brief Write report footer. * @brief Write report footer.
*/ */
virtual void writeFooter(); virtual void writeFooter() override;
/** /**
* @brief Write error to report. * @brief Write error to report.
* @param error Error data. * @param error Error data.
*/ */
virtual void writeError(const ErrorItem &error); virtual void writeError(const ErrorItem &error) override;
private: private:

View File

@ -38,23 +38,23 @@ public:
* @brief Create the report (file). * @brief Create the report (file).
* @return true if succeeded, false if file could not be created. * @return true if succeeded, false if file could not be created.
*/ */
virtual bool create(); virtual bool create() override;
/** /**
* @brief Write report header. * @brief Write report header.
*/ */
virtual void writeHeader(); virtual void writeHeader() override;
/** /**
* @brief Write report footer. * @brief Write report footer.
*/ */
virtual void writeFooter(); virtual void writeFooter() override;
/** /**
* @brief Write error to report. * @brief Write error to report.
* @param error Error data. * @param error Error data.
*/ */
virtual void writeError(const ErrorItem &error); virtual void writeError(const ErrorItem &error) override;
/** /**
* @brief Returns the formatted report. * @brief Returns the formatted report.

View File

@ -31,8 +31,8 @@ private slots:
private: private:
// Empty implementations of ErrorLogger methods. // Empty implementations of ErrorLogger methods.
// We don't care about the output in the benchmark tests. // 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 {
} }
}; };

View File

@ -72,8 +72,8 @@ public:
/** /**
* ErrorLogger methods * ErrorLogger methods
*/ */
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;
public slots: public slots:

View File

@ -42,23 +42,23 @@ public:
* @brief Create the report (file). * @brief Create the report (file).
* @return true if succeeded, false if file could not be created. * @return true if succeeded, false if file could not be created.
*/ */
virtual bool create(); virtual bool create() override;
/** /**
* @brief Write report header. * @brief Write report header.
*/ */
virtual void writeHeader(); virtual void writeHeader() override;
/** /**
* @brief Write report footer. * @brief Write report footer.
*/ */
virtual void writeFooter(); virtual void writeFooter() override;
/** /**
* @brief Write error to report. * @brief Write error to report.
* @param error Error data. * @param error Error data.
*/ */
virtual void writeError(const ErrorItem &error); virtual void writeError(const ErrorItem &error) override;
private: private:

View File

@ -43,33 +43,33 @@ public:
* @brief Create the report (file). * @brief Create the report (file).
* @return true if succeeded, false if file could not be created. * @return true if succeeded, false if file could not be created.
*/ */
virtual bool create(); virtual bool create() override;
/** /**
* @brief Open existing report file. * @brief Open existing report file.
*/ */
bool open(); virtual bool open() override;
/** /**
* @brief Write report header. * @brief Write report header.
*/ */
virtual void writeHeader(); virtual void writeHeader() override;
/** /**
* @brief Write report footer. * @brief Write report footer.
*/ */
virtual void writeFooter(); virtual void writeFooter() override;
/** /**
* @brief Write error to report. * @brief Write error to report.
* @param error Error data. * @param error Error data.
*/ */
virtual void writeError(const ErrorItem &error); virtual void writeError(const ErrorItem &error) override;
/** /**
* @brief Read contents of the report file. * @brief Read contents of the report file.
*/ */
virtual QList<ErrorItem> read(); virtual QList<ErrorItem> read() override;
protected: protected:
/** /**

View File

@ -52,13 +52,13 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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 check64BitPortability(tokenizer, settings, errorLogger);
check64BitPortability.pointerassignment(); check64BitPortability.pointerassignment();
} }
/** @brief Run checks against the simplified token list */ /** @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)tokenizer;
(void)settings; (void)settings;
(void)errorLogger; (void)errorLogger;
@ -74,7 +74,7 @@ private:
void returnIntegerError(const Token *tok); void returnIntegerError(const Token *tok);
void returnPointerError(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); Check64BitPortability c(nullptr, settings, errorLogger);
c.assignmentAddressToIntegerError(nullptr); c.assignmentAddressToIntegerError(nullptr);
c.assignmentIntegerToAddressError(nullptr); c.assignmentIntegerToAddressError(nullptr);
@ -86,7 +86,7 @@ private:
return "64-bit portability"; return "64-bit portability";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Check if there is 64-bit portability issues:\n" return "Check if there is 64-bit portability issues:\n"
"- assign address to/from int/long\n" "- assign address to/from int/long\n"
"- casting address from/to integer when returning from function\n"; "- casting address from/to integer when returning from function\n";

View File

@ -49,7 +49,7 @@ public:
: Check(myName(), tokenizer, settings, errorLogger) { : 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); CheckAssert check(tokenizer, settings, errorLogger);
check.assertWithSideEffects(); check.assertWithSideEffects();
} }
@ -64,7 +64,7 @@ private:
void sideEffectInAssertError(const Token *tok, const std::string& functionName); void sideEffectInAssertError(const Token *tok, const std::string& functionName);
void assignmentInAssertError(const Token *tok, const std::string &varname); 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); CheckAssert c(nullptr, settings, errorLogger);
c.sideEffectInAssertError(nullptr, "function"); c.sideEffectInAssertError(nullptr, "function");
c.assignmentInAssertError(nullptr, "var"); c.assignmentInAssertError(nullptr, "var");
@ -74,7 +74,7 @@ private:
return "Assert"; 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"; return "Warn if there are side effects in assert statements (since this cause different behaviour in debug/release builds).\n";
} }
}; };

View File

@ -49,13 +49,13 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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 checkAutoVariables(tokenizer, settings, errorLogger);
checkAutoVariables.assignFunctionArg(); checkAutoVariables.assignFunctionArg();
checkAutoVariables.returnReference(); 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 checkAutoVariables(tokenizer, settings, errorLogger);
checkAutoVariables.autoVariables(); checkAutoVariables.autoVariables();
checkAutoVariables.returnPointerToLocalArray(); checkAutoVariables.returnPointerToLocalArray();
@ -94,7 +94,7 @@ private:
void errorUselessAssignmentArg(const Token *tok); void errorUselessAssignmentArg(const Token *tok);
void errorUselessAssignmentPtrArg(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); CheckAutoVariables c(nullptr,settings,errorLogger);
c.errorAutoVariableAssignment(nullptr, false); c.errorAutoVariableAssignment(nullptr, false);
c.errorReturnAddressToAutoVariable(nullptr); c.errorReturnAddressToAutoVariable(nullptr);
@ -112,7 +112,7 @@ private:
return "Auto Variables"; 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" return "A pointer to a variable is only valid as long as the variable is in scope.\n"
"Check:\n" "Check:\n"
"- returning a pointer to auto or temporary variable\n" "- returning a pointer to auto or temporary variable\n"

View File

@ -50,7 +50,7 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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); CheckBool checkBool(tokenizer, settings, errorLogger);
// Checks // Checks
@ -61,7 +61,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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); CheckBool checkBool(tokenizer, settings, errorLogger);
// Checks // Checks
@ -113,7 +113,7 @@ private:
void comparisonOfBoolExpressionWithIntError(const Token *tok, bool n0o1); void comparisonOfBoolExpressionWithIntError(const Token *tok, bool n0o1);
void pointerArithBoolError(const Token *tok); 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); CheckBool c(nullptr, settings, errorLogger);
c.assignBoolToPointerError(nullptr); c.assignBoolToPointerError(nullptr);
@ -131,7 +131,7 @@ private:
return "Boolean"; return "Boolean";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Boolean type checks\n" return "Boolean type checks\n"
"- using increment on boolean\n" "- using increment on boolean\n"
"- comparison of a boolean expression with an integer other than 0 or 1\n" "- comparison of a boolean expression with an integer other than 0 or 1\n"

View File

@ -49,7 +49,7 @@ public:
} }
/** Simplified checks. The token list is simplified. */ /** 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()) if (!tokenizer->isCPP())
return; return;
@ -64,7 +64,7 @@ public:
private: private:
void boostForeachError(const Token *tok); 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); CheckBoost c(nullptr, settings, errorLogger);
c.boostForeachError(nullptr); c.boostForeachError(nullptr);
} }
@ -73,7 +73,7 @@ private:
return "Boost usage"; return "Boost usage";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Check for invalid usage of Boost:\n" return "Check for invalid usage of Boost:\n"
"- container modification during BOOST_FOREACH\n"; "- container modification during BOOST_FOREACH\n";
} }

View File

@ -74,7 +74,7 @@ public:
, symbolDatabase(tokenizer?tokenizer->getSymbolDatabase():nullptr) { , 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 checkBufferOverrun(tokenizer, settings, errorLogger);
checkBufferOverrun.checkGlobalAndLocalVariable(); checkBufferOverrun.checkGlobalAndLocalVariable();
if (tokenizer && tokenizer->isMaxTime()) if (tokenizer && tokenizer->isMaxTime())
@ -86,7 +86,7 @@ public:
checkBufferOverrun.negativeArraySize(); 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 checkBufferOverrun(tokenizer, settings, errorLogger);
checkBufferOverrun.bufferOverrun(); checkBufferOverrun.bufferOverrun();
checkBufferOverrun.checkStringArgument(); checkBufferOverrun.checkStringArgument();
@ -223,7 +223,7 @@ public:
/* data for multifile checking */ /* data for multifile checking */
class MyFileInfo : public Check::FileInfo { class MyFileInfo : public Check::FileInfo {
public: public:
std::string toString() const; std::string toString() const override;
struct ArrayUsage { struct ArrayUsage {
MathLib::bigint index; MathLib::bigint index;
@ -239,9 +239,9 @@ public:
}; };
/** @brief Parse current TU and extract file info */ /** @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 */ /** @brief Analyse all file infos for all TU */
bool analyseWholeProgram(const std::list<Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger); bool analyseWholeProgram(const std::list<Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger);
@ -278,7 +278,7 @@ private:
void valueFlowCheckArrayIndex(const Token * const tok, const ArrayInfo &arrayInfo); void valueFlowCheckArrayIndex(const Token * const tok, const ArrayInfo &arrayInfo);
public: public:
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckBufferOverrun c(nullptr, settings, errorLogger); CheckBufferOverrun c(nullptr, settings, errorLogger);
const std::vector<MathLib::bigint> indexes(2, 1); const std::vector<MathLib::bigint> indexes(2, 1);
c.arrayIndexOutOfBoundsError(nullptr, ArrayInfo(0, "array", 1, 2), indexes); c.arrayIndexOutOfBoundsError(nullptr, ArrayInfo(0, "array", 1, 2), indexes);
@ -304,7 +304,7 @@ private:
return "Bounds checking"; return "Bounds checking";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Out of bounds checking:\n" return "Out of bounds checking:\n"
"- Array index out of bounds detection by value flow analysis\n" "- Array index out of bounds detection by value flow analysis\n"
"- Dangerous usage of strncat()\n" "- Dangerous usage of strncat()\n"

View File

@ -53,7 +53,7 @@ public:
CheckClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger); CheckClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger);
/** @brief Run checks on the normal token list */ /** @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()) if (tokenizer->isC())
return; return;
@ -65,7 +65,7 @@ public:
} }
/** @brief Run checks on the simplified token list */ /** @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()) if (tokenizer->isC())
return; return;
@ -198,7 +198,7 @@ private:
void unsafeClassDivZeroError(const Token *tok, const std::string &className, const std::string &methodName, const std::string &varName); 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 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); CheckClass c(nullptr, settings, errorLogger);
c.noConstructorError(nullptr, "classname", false); c.noConstructorError(nullptr, "classname", false);
c.noExplicitConstructorError(nullptr, "classname", false); c.noExplicitConstructorError(nullptr, "classname", false);
@ -239,7 +239,7 @@ private:
return "Class"; return "Class";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Check the code for each class.\n" return "Check the code for each class.\n"
"- Missing constructors and copy constructors\n" "- Missing constructors and copy constructors\n"
//"- Missing allocation of memory in copy constructor\n" //"- Missing allocation of memory in copy constructor\n"

View File

@ -51,7 +51,7 @@ public:
: Check(myName(), tokenizer, settings, errorLogger) { : 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 checkCondition(tokenizer, settings, errorLogger);
checkCondition.multiCondition(); checkCondition.multiCondition();
checkCondition.clarifyCondition(); // not simplified because ifAssign checkCondition.clarifyCondition(); // not simplified because ifAssign
@ -63,7 +63,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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 checkCondition(tokenizer, settings, errorLogger);
checkCondition.assignIf(); checkCondition.assignIf();
checkCondition.checkBadBitmaskCheck(); checkCondition.checkBadBitmaskCheck();
@ -149,7 +149,7 @@ private:
void invalidTestForOverflow(const Token* tok, bool result); void invalidTestForOverflow(const Token* tok, bool result);
void pointerAdditionResultNotNullError(const Token *tok, const Token *calc); 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); CheckCondition c(nullptr, settings, errorLogger);
c.assignIfError(nullptr, nullptr, emptyString, false); c.assignIfError(nullptr, nullptr, emptyString, false);
@ -173,7 +173,7 @@ private:
return "Condition"; return "Condition";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Match conditions with assignments and other conditions:\n" return "Match conditions with assignments and other conditions:\n"
"- Mismatching assignment and comparison => comparison is always true/false\n" "- Mismatching assignment and comparison => comparison is always true/false\n"
"- Mismatching lhs and rhs in comparison => comparison is always true/false\n" "- Mismatching lhs and rhs in comparison => comparison is always true/false\n"

View File

@ -62,7 +62,7 @@ public:
} }
/** Checks that uses the simplified token list */ /** 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()) if (tokenizer->isC())
return; return;
@ -137,7 +137,7 @@ private:
} }
/** Generate all possible errors (for --errorlist) */ /** 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); CheckExceptionSafety c(nullptr, settings, errorLogger);
c.destructorsError(nullptr, "Class"); c.destructorsError(nullptr, "Class");
c.deallocThrowError(nullptr, "p"); c.deallocThrowError(nullptr, "p");
@ -153,7 +153,7 @@ private:
} }
/** wiki formatted description of the class (for --doc) */ /** wiki formatted description of the class (for --doc) */
std::string classInfo() const { std::string classInfo() const override {
return "Checking exception safety\n" return "Checking exception safety\n"
"- Throwing exceptions in destructors\n" "- Throwing exceptions in destructors\n"
"- Throwing exception during invalid state\n" "- Throwing exception during invalid state\n"

View File

@ -58,7 +58,7 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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); CheckFunctions checkFunctions(tokenizer, settings, errorLogger);
// Checks // Checks
@ -69,7 +69,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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 checkFunctions(tokenizer, settings, errorLogger);
checkFunctions.checkProhibitedFunctions(); checkFunctions.checkProhibitedFunctions();
@ -117,7 +117,7 @@ private:
void memsetFloatError(const Token *tok, const std::string &var_value); void memsetFloatError(const Token *tok, const std::string &var_value);
void memsetValueOutOfRangeError(const Token *tok, const std::string &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); CheckFunctions c(nullptr, settings, errorLogger);
for (std::map<std::string, Library::WarnInfo>::const_iterator i = settings->library.functionwarn.cbegin(); i != settings->library.functionwarn.cend(); ++i) { for (std::map<std::string, Library::WarnInfo>::const_iterator i = settings->library.functionwarn.cbegin(); i != settings->library.functionwarn.cend(); ++i) {
@ -138,7 +138,7 @@ private:
return "Check function usage"; return "Check function usage";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Check function usage:\n" return "Check function usage:\n"
"- return value of certain functions not used\n" "- return value of certain functions not used\n"
"- invalid input values for functions\n" "- invalid input values for functions\n"

View File

@ -44,7 +44,7 @@ public:
} }
/** Simplified checks. The token list is simplified. */ /** 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)) if (!settings->isEnabled(Settings::INTERNAL))
return; return;
@ -94,7 +94,7 @@ private:
void extraWhitespaceError(const Token *tok, const std::string &pattern, const std::string &funcname); void extraWhitespaceError(const Token *tok, const std::string &pattern, const std::string &funcname);
void checkRedundantTokCheckError(const Token *tok); 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); CheckInternal c(nullptr, settings, errorLogger);
c.multiComparePatternError(nullptr, ";|%type%", "Match"); c.multiComparePatternError(nullptr, ";|%type%", "Match");
c.simplePatternError(nullptr, "class {", "Match"); c.simplePatternError(nullptr, "class {", "Match");
@ -111,7 +111,7 @@ private:
return "cppcheck internal API usage"; 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 // Don't include these checks on the WIKI where people can read what
// checks there are. These checks are not intended for users. // checks there are. These checks are not intended for users.
return ""; return "";

View File

@ -50,14 +50,14 @@ public:
} }
/** @brief Run checks on the normal token list */ /** @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 checkIO(tokenizer, settings, errorLogger);
checkIO.checkWrongPrintfScanfArguments(); checkIO.checkWrongPrintfScanfArguments();
} }
/** @brief Run checks on the simplified token list */ /** @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 checkIO(tokenizer, settings, errorLogger);
checkIO.checkCoutCerrMisusage(); checkIO.checkCoutCerrMisusage();
@ -139,7 +139,7 @@ private:
static void argumentType(std::ostream & os, const ArgumentInfo * argInfo); static void argumentType(std::ostream & os, const ArgumentInfo * argInfo);
static Severity::SeverityType getSeverity(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); CheckIO c(nullptr, settings, errorLogger);
c.coutCerrMisusageError(nullptr, "cout"); c.coutCerrMisusageError(nullptr, "cout");
@ -169,7 +169,7 @@ private:
return "IO using format string"; return "IO using format string";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Check format string input/output operations.\n" return "Check format string input/output operations.\n"
"- Bad usage of the function 'sprintf' (overlapping data)\n" "- Bad usage of the function 'sprintf' (overlapping data)\n"
"- Missing or wrong width specifiers in 'scanf' format string\n" "- Missing or wrong width specifiers in 'scanf' format string\n"

View File

@ -104,7 +104,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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 checkLeakAutoVar(tokenizer, settings, errorLogger);
checkLeakAutoVar.check(); checkLeakAutoVar.check();
} }
@ -140,7 +140,7 @@ private:
/** message: user configuration is needed to complete analysis */ /** message: user configuration is needed to complete analysis */
void configurationInfo(const Token* tok, const std::string &functionName); 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); CheckLeakAutoVar c(nullptr, settings, errorLogger);
c.deallocReturnError(nullptr, "p"); c.deallocReturnError(nullptr, "p");
c.configurationInfo(nullptr, "f"); // user configuration is needed to complete analysis c.configurationInfo(nullptr, "f"); // user configuration is needed to complete analysis
@ -151,7 +151,7 @@ private:
return "Leaks (auto variables)"; 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"; return "Detect when a auto variable is allocated but not deallocated or deallocated twice.\n";
} }
}; };

View File

@ -195,7 +195,7 @@ public:
} }
/** @brief run all simplified checks */ /** @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); CheckMemoryLeakInFunction checkMemoryLeak(tokenizr, settings, errLog);
checkMemoryLeak.checkReallocUsage(); checkMemoryLeak.checkReallocUsage();
checkMemoryLeak.check(); checkMemoryLeak.check();
@ -288,7 +288,7 @@ public:
private: private:
/** Report all possible errors (for the --errorlist) */ /** 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); CheckMemoryLeakInFunction c(nullptr, settings, e);
c.memleakError(nullptr, "varname"); c.memleakError(nullptr, "varname");
@ -314,7 +314,7 @@ private:
* Get class information (--doc) * Get class information (--doc)
* @return Wiki formatted information about this class * @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"; 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) { : 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()) if (!tokenizr->isCPP())
return; return;
@ -355,7 +355,7 @@ private:
void unsafeClassError(const Token *tok, const std::string &classname, const std::string &varname); 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); CheckMemoryLeakInClass c(nullptr, settings, e);
c.publicAllocationError(nullptr, "varname"); c.publicAllocationError(nullptr, "varname");
c.unsafeClassError(nullptr, "class", "class::varname"); c.unsafeClassError(nullptr, "class", "class::varname");
@ -365,7 +365,7 @@ private:
return "Memory leaks (class variables)"; 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"; 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) { : 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); CheckMemoryLeakStructMember checkMemoryLeak(tokenizr, settings, errLog);
checkMemoryLeak.check(); checkMemoryLeak.check();
} }
@ -397,14 +397,14 @@ private:
void checkStructVariable(const Variable * const variable); 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() { static std::string myName() {
return "Memory leaks (struct members)"; return "Memory leaks (struct members)";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Don't forget to deallocate struct members\n"; return "Don't forget to deallocate struct members\n";
} }
}; };
@ -422,7 +422,7 @@ public:
: Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings) { : 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); CheckMemoryLeakNoVar checkMemoryLeak(tokenizr, settings, errLog);
checkMemoryLeak.check(); checkMemoryLeak.check();
} }
@ -446,7 +446,7 @@ private:
void returnValueNotUsedError(const Token* tok, const std::string &alloc); 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 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); CheckMemoryLeakNoVar c(nullptr, settings, e);
c.functionCallLeak(nullptr, "funcName", "funcName"); c.functionCallLeak(nullptr, "funcName", "funcName");
@ -458,7 +458,7 @@ private:
return "Memory leaks (address not taken)"; return "Memory leaks (address not taken)";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Not taking the address to allocated memory\n"; return "Not taking the address to allocated memory\n";
} }
}; };

View File

@ -54,14 +54,14 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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 checkNullPointer(tokenizer, settings, errorLogger);
checkNullPointer.nullPointer(); checkNullPointer.nullPointer();
checkNullPointer.arithmetic(); checkNullPointer.arithmetic();
} }
/** @brief Run checks against the simplified token list */ /** @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 checkNullPointer(tokenizer, settings, errorLogger);
checkNullPointer.nullConstantDereference(); checkNullPointer.nullConstantDereference();
} }
@ -102,7 +102,7 @@ public:
private: private:
/** Get error messages. Used by --errorlist */ /** 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); CheckNullPointer c(nullptr, settings, errorLogger);
c.nullPointerError(nullptr, "pointer", nullptr, false); c.nullPointerError(nullptr, "pointer", nullptr, false);
c.arithmeticError(nullptr, nullptr); c.arithmeticError(nullptr, nullptr);
@ -114,7 +114,7 @@ private:
} }
/** class info in WIKI format. Used by --doc */ /** class info in WIKI format. Used by --doc */
std::string classInfo() const { std::string classInfo() const override {
return "Null pointers\n" return "Null pointers\n"
"- null pointer dereferencing\n" "- null pointer dereferencing\n"
"- undefined null pointer arithmetic\n"; "- undefined null pointer arithmetic\n";

View File

@ -54,7 +54,7 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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); CheckOther checkOther(tokenizer, settings, errorLogger);
// Checks // Checks
@ -84,7 +84,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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); CheckOther checkOther(tokenizer, settings, errorLogger);
// Checks // Checks
@ -264,7 +264,7 @@ private:
void funcArgNamesDifferent(const std::string & functionName, size_t index, const Token* declaration, const Token* definition); 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<const Token*> & declarations, const std::vector<const Token*> & definitions); void funcArgOrderDifferent(const std::string & functionName, const Token * declaration, const Token * definition, const std::vector<const Token*> & declarations, const std::vector<const Token*> & definitions);
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckOther c(nullptr, settings, errorLogger); CheckOther c(nullptr, settings, errorLogger);
// error // error
@ -329,7 +329,7 @@ private:
return "Other"; return "Other";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Other checks\n" return "Other checks\n"
// error // error

View File

@ -50,14 +50,14 @@ public:
: Check(myName(), tokenizer, settings, errorLogger) { : 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()) if (tokenizer->isC())
return; return;
CheckPostfixOperator checkPostfixOperator(tokenizer, settings, errorLogger); CheckPostfixOperator checkPostfixOperator(tokenizer, settings, errorLogger);
checkPostfixOperator.postfixOperator(); 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 */ /** Check postfix operators */
@ -67,7 +67,7 @@ private:
/** Report Error */ /** Report Error */
void postfixOperatorError(const Token *tok); 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); CheckPostfixOperator c(nullptr, settings, errorLogger);
c.postfixOperatorError(nullptr); c.postfixOperatorError(nullptr);
} }
@ -76,7 +76,7 @@ private:
return "Using postfix operators"; 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"; return "Warn if using postfix operators ++ or -- rather than prefix operator\n";
} }
}; };

View File

@ -50,7 +50,7 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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); CheckSizeof checkSizeof(tokenizer, settings, errorLogger);
// Checks // Checks
@ -65,7 +65,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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 ..' */ /** @brief %Check for 'sizeof sizeof ..' */
@ -107,7 +107,7 @@ private:
void sizeofDereferencedVoidPointerError(const Token *tok, const std::string &varname); void sizeofDereferencedVoidPointerError(const Token *tok, const std::string &varname);
void arithOperationsOnVoidPointerError(const Token* tok, const std::string &varname, const std::string &vartype); 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); CheckSizeof c(nullptr, settings, errorLogger);
c.sizeofForArrayParameterError(nullptr); c.sizeofForArrayParameterError(nullptr);
@ -128,7 +128,7 @@ private:
return "Sizeof"; return "Sizeof";
} }
std::string classInfo() const { std::string classInfo() const override {
return "sizeof() usage checks\n" return "sizeof() usage checks\n"
"- sizeof for array given as function argument\n" "- sizeof for array given as function argument\n"
"- sizeof for numeric given as function argument\n" "- sizeof for numeric given as function argument\n"

View File

@ -54,7 +54,7 @@ public:
} }
/** Simplified checks. The token list is simplified. */ /** 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()) { if (!tokenizer->isCPP()) {
return; return;
} }
@ -205,7 +205,7 @@ private:
void readingEmptyStlContainerError(const Token* tok); 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); CheckStl c(nullptr, settings, errorLogger);
c.invalidIteratorError(nullptr, "iterator"); c.invalidIteratorError(nullptr, "iterator");
c.iteratorsError(nullptr, "container1", "container2"); c.iteratorsError(nullptr, "container1", "container2");
@ -241,7 +241,7 @@ private:
return "STL usage"; return "STL usage";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Check for invalid usage of STL:\n" return "Check for invalid usage of STL:\n"
"- out of bounds errors\n" "- out of bounds errors\n"
"- misuse of iterators when iterating through a container\n" "- misuse of iterators when iterating through a container\n"

View File

@ -50,7 +50,7 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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); CheckString checkString(tokenizer, settings, errorLogger);
// Checks // Checks
@ -61,7 +61,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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); CheckString checkString(tokenizer, settings, errorLogger);
// Checks // Checks
@ -103,7 +103,7 @@ private:
void suspiciousStringCompareError_char(const Token* tok, const std::string& var); void suspiciousStringCompareError_char(const Token* tok, const std::string& var);
void overlappingStrcmpError(const Token* eq0, const Token *ne0); 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); CheckString c(nullptr, settings, errorLogger);
c.stringLiteralWriteError(nullptr, nullptr); c.stringLiteralWriteError(nullptr, nullptr);
@ -122,7 +122,7 @@ private:
return "String"; return "String";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Detect misusage of C-style strings:\n" return "Detect misusage of C-style strings:\n"
"- overlapping buffers passed to sprintf as source and destination\n" "- overlapping buffers passed to sprintf as source and destination\n"
"- incorrect length arguments for 'substr' and 'strncmp'\n" "- incorrect length arguments for 'substr' and 'strncmp'\n"

View File

@ -49,7 +49,7 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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 // These are not "simplified" because casts can't be ignored
CheckType checkType(tokenizer, settings, errorLogger); CheckType checkType(tokenizer, settings, errorLogger);
checkType.checkTooBigBitwiseShift(); checkType.checkTooBigBitwiseShift();
@ -60,7 +60,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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)tokenizer;
(void)settings; (void)settings;
(void)errorLogger; (void)errorLogger;
@ -91,7 +91,7 @@ private:
void longCastReturnError(const Token *tok); void longCastReturnError(const Token *tok);
void floatToIntegerOverflowError(const Token *tok, const ValueFlow::Value &value); 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); CheckType c(nullptr, settings, errorLogger);
c.tooBigBitwiseShiftError(nullptr, 32, ValueFlow::Value(64)); c.tooBigBitwiseShiftError(nullptr, 32, ValueFlow::Value(64));
c.tooBigSignedBitwiseShiftError(nullptr, 31, ValueFlow::Value(31)); c.tooBigSignedBitwiseShiftError(nullptr, 31, ValueFlow::Value(31));
@ -109,7 +109,7 @@ private:
return "Type"; return "Type";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Type checks\n" return "Type checks\n"
"- bitwise shift by too many bits (only enabled when --platform is used)\n" "- bitwise shift by too many bits (only enabled when --platform is used)\n"
"- signed integer overflow (only enabled when --platform is used)\n" "- signed integer overflow (only enabled when --platform is used)\n"

View File

@ -60,7 +60,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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 checkUninitVar(tokenizer, settings, errorLogger);
checkUninitVar.check(); checkUninitVar.check();
checkUninitVar.deadPointer(); checkUninitVar.deadPointer();
@ -100,7 +100,7 @@ public:
void uninitStructMemberError(const Token *tok, const std::string &membername); void uninitStructMemberError(const Token *tok, const std::string &membername);
private: private:
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckUninitVar c(nullptr, settings, errorLogger); CheckUninitVar c(nullptr, settings, errorLogger);
// error // error
@ -115,7 +115,7 @@ private:
return "Uninitialized variables"; return "Uninitialized variables";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Uninitialized variables\n" return "Uninitialized variables\n"
"- using uninitialized local variables\n" "- using uninitialized local variables\n"
"- using allocated data before it has been initialized\n" "- using allocated data before it has been initialized\n"

View File

@ -64,7 +64,7 @@ public:
bool check(ErrorLogger * const errorLogger, const Settings& settings); bool check(ErrorLogger * const errorLogger, const Settings& settings);
/** @brief Parse current TU and extract file info */ /** @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 */ /** @brief Analyse all file infos for all TU */
bool analyseWholeProgram(const std::list<Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger); bool analyseWholeProgram(const std::list<Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger);
@ -78,7 +78,7 @@ public:
private: private:
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const { void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckUnusedFunctions c(nullptr, settings, errorLogger); CheckUnusedFunctions c(nullptr, settings, errorLogger);
c.unusedFunctionError(errorLogger, emptyString, 0, "funcName"); c.unusedFunctionError(errorLogger, emptyString, 0, "funcName");
} }
@ -93,14 +93,14 @@ private:
/** /**
* Dummy implementation, just to provide error for --errorlist * 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() { static std::string myName() {
return "Unused functions"; return "Unused functions";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Check for functions that are never called\n"; return "Check for functions that are never called\n";
} }

View File

@ -53,7 +53,7 @@ public:
} }
/** @brief Run checks against the normal token list */ /** @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); CheckUnusedVar checkUnusedVar(tokenizer, settings, errorLogger);
// Coding style checks // Coding style checks
@ -62,7 +62,7 @@ public:
} }
/** @brief Run checks against the simplified token list */ /** @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)tokenizer;
(void)settings; (void)settings;
(void)errorLogger; (void)errorLogger;
@ -86,7 +86,7 @@ private:
void unreadVariableError(const Token *tok, const std::string &varname, bool modified); void unreadVariableError(const Token *tok, const std::string &varname, bool modified);
void unassignedVariableError(const Token *tok, const std::string &varname); 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); CheckUnusedVar c(nullptr, settings, errorLogger);
// style/warning // style/warning
@ -101,7 +101,7 @@ private:
return "UnusedVar"; return "UnusedVar";
} }
std::string classInfo() const { std::string classInfo() const override {
return "UnusedVar checks\n" return "UnusedVar checks\n"
// style // style

View File

@ -48,7 +48,7 @@ public:
: Check(myName(), tokenizer, settings, errorLogger) { : 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); CheckVaarg check(tokenizer, settings, errorLogger);
check.va_start_argument(); check.va_start_argument();
check.va_list_usage(); check.va_list_usage();
@ -64,7 +64,7 @@ private:
void va_list_usedBeforeStartedError(const Token *tok, const std::string& varname); void va_list_usedBeforeStartedError(const Token *tok, const std::string& varname);
void va_start_subsequentCallsError(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); CheckVaarg c(nullptr, settings, errorLogger);
c.wrongParameterTo_va_start_error(nullptr, "arg1", "arg2"); c.wrongParameterTo_va_start_error(nullptr, "arg1", "arg2");
c.referenceAs_va_start_error(nullptr, "arg1"); c.referenceAs_va_start_error(nullptr, "arg1");
@ -77,7 +77,7 @@ private:
return "Vaarg"; return "Vaarg";
} }
std::string classInfo() const { std::string classInfo() const override {
return "Check for misusage of variable argument lists:\n" return "Check for misusage of variable argument lists:\n"
"- Wrong parameter passed to va_start()\n" "- Wrong parameter passed to va_start()\n"
"- Reference passed to va_start()\n" "- Reference passed to va_start()\n"

View File

@ -189,24 +189,24 @@ private:
* "[filepath:line number] Message", e.g. * "[filepath:line number] Message", e.g.
* "[main.cpp:4] Uninitialized member variable" * "[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. * @brief Information about progress is directed here.
* *
* @param outmsg Message to show, e.g. "Checking main.cpp..." * @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<std::string> _errorList; std::list<std::string> _errorList;
Settings _settings; 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. * Output information messages.
*/ */
virtual void reportInfo(const ErrorLogger::ErrorMessage &msg); virtual void reportInfo(const ErrorLogger::ErrorMessage &msg) override;
ErrorLogger &_errorLogger; ErrorLogger &_errorLogger;

View File

@ -61,7 +61,7 @@ public:
} }
void ShowResults(SHOWTIME_MODES mode) const; 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: private:
std::map<std::string, struct TimerResultsData> _results; std::map<std::string, struct TimerResultsData> _results;

View File

@ -31,7 +31,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("portability"); settings.addEnabled("portability");
TEST_CASE(novardecl); TEST_CASE(novardecl);

View File

@ -44,7 +44,7 @@ private:
checkAssert.runSimplifiedChecks(&tokenizer, &settings, this); checkAssert.runSimplifiedChecks(&tokenizer, &settings, this);
} }
void run() { void run() override {
settings.addEnabled("warning"); settings.addEnabled("warning");
TEST_CASE(assignmentInAssert); TEST_CASE(assignmentInAssert);

View File

@ -32,7 +32,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(isReturnScope); TEST_CASE(isReturnScope);
TEST_CASE(isVariableChanged); TEST_CASE(isVariableChanged);
TEST_CASE(isVariableChangedByFunctionCall); TEST_CASE(isVariableChangedByFunctionCall);

View File

@ -55,7 +55,7 @@ private:
} }
} }
void run() { void run() override {
settings.addEnabled("warning"); settings.addEnabled("warning");
settings.addEnabled("style"); settings.addEnabled("style");
LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "std.cfg");

View File

@ -31,7 +31,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("style"); settings.addEnabled("style");
settings.addEnabled("warning"); settings.addEnabled("warning");
settings.inconclusive = true; settings.inconclusive = true;

View File

@ -31,7 +31,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("style"); settings.addEnabled("style");
settings.addEnabled("performance"); settings.addEnabled("performance");

View File

@ -73,7 +73,7 @@ private:
checkBufferOverrun.runSimplifiedChecks(&tokenizer, &settings, this); checkBufferOverrun.runSimplifiedChecks(&tokenizer, &settings, this);
} }
void run() { void run() override {
settings0.addEnabled("warning"); settings0.addEnabled("warning");
settings0.addEnabled("style"); settings0.addEnabled("style");
settings0.addEnabled("portability"); settings0.addEnabled("portability");

View File

@ -32,7 +32,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.platform(Settings::Unspecified); settings.platform(Settings::Unspecified);
settings.addEnabled("warning"); settings.addEnabled("warning");
settings.addEnabled("portability"); settings.addEnabled("portability");

View File

@ -34,7 +34,7 @@ private:
Settings settings0; Settings settings0;
Settings settings1; Settings settings1;
void run() { void run() override {
settings0.addEnabled("style"); settings0.addEnabled("style");
settings1.addEnabled("warning"); settings1.addEnabled("warning");

View File

@ -42,7 +42,7 @@ private:
Settings settings; Settings settings;
CmdLineParser defParser; CmdLineParser defParser;
void run() { void run() override {
TEST_CASE(nooptions); TEST_CASE(nooptions);
TEST_CASE(helpshort); TEST_CASE(helpshort);
TEST_CASE(helplong); TEST_CASE(helplong);

View File

@ -36,7 +36,7 @@ private:
Settings settings0; Settings settings0;
Settings settings1; Settings settings1;
void run() { void run() override {
LOAD_LIB_2(settings0.library, "qt.cfg"); LOAD_LIB_2(settings0.library, "qt.cfg");
settings0.addEnabled("style"); settings0.addEnabled("style");

View File

@ -48,7 +48,7 @@ private:
checkClass.constructors(); checkClass.constructors();
} }
void run() { void run() override {
settings.addEnabled("style"); settings.addEnabled("style");
settings.addEnabled("warning"); settings.addEnabled("warning");

View File

@ -45,7 +45,7 @@ private:
} }
}; };
void run() { void run() override {
TEST_CASE(instancesSorted); TEST_CASE(instancesSorted);
TEST_CASE(classInfoFormat); TEST_CASE(classInfoFormat);
TEST_CASE(getErrorMessages); TEST_CASE(getErrorMessages);

View File

@ -35,7 +35,7 @@ private:
const ErrorLogger::ErrorMessage::FileLocation fooCpp5; const ErrorLogger::ErrorMessage::FileLocation fooCpp5;
const ErrorLogger::ErrorMessage::FileLocation barCpp8; const ErrorLogger::ErrorMessage::FileLocation barCpp8;
void run() { void run() override {
TEST_CASE(PatternSearchReplace); TEST_CASE(PatternSearchReplace);
TEST_CASE(FileLocationDefaults); TEST_CASE(FileLocationDefaults);
TEST_CASE(FileLocationSetFile); TEST_CASE(FileLocationSetFile);

View File

@ -31,7 +31,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("all"); settings.addEnabled("all");
TEST_CASE(destructors); TEST_CASE(destructors);

View File

@ -37,7 +37,7 @@ public:
} }
private: private:
void run() { void run() override {
// bail out if the tests are not executed from the base folder // bail out if the tests are not executed from the base folder
{ {
std::ifstream fin("test/testfilelister.cpp"); std::ifstream fin("test/testfilelister.cpp");

View File

@ -34,7 +34,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("style"); settings.addEnabled("style");
settings.addEnabled("warning"); settings.addEnabled("warning");
settings.addEnabled("portability"); settings.addEnabled("portability");

View File

@ -34,7 +34,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.debugwarnings = true; settings.debugwarnings = true;
settings.addEnabled("style"); settings.addEnabled("style");
settings.addEnabled("warning"); settings.addEnabled("warning");

View File

@ -38,7 +38,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(setDefines); TEST_CASE(setDefines);
TEST_CASE(setIncludePaths1); TEST_CASE(setIncludePaths1);
TEST_CASE(setIncludePaths2); TEST_CASE(setIncludePaths2);

View File

@ -59,7 +59,7 @@ private:
checkOther.checkIncompleteStatement(); checkOther.checkIncompleteStatement();
} }
void run() { void run() override {
settings.addEnabled("warning"); settings.addEnabled("warning");
TEST_CASE(test1); TEST_CASE(test1);

View File

@ -31,7 +31,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("internal"); settings.addEnabled("internal");
TEST_CASE(simplePatternInTokenMatch) TEST_CASE(simplePatternInTokenMatch)

View File

@ -32,7 +32,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "std.cfg");
LOAD_LIB_2(settings.library, "windows.cfg"); LOAD_LIB_2(settings.library, "windows.cfg");
LOAD_LIB_2(settings.library, "qt.cfg"); LOAD_LIB_2(settings.library, "qt.cfg");

View File

@ -32,7 +32,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
int id = 0; int id = 0;
while (!settings.library.ismemory(++id)); while (!settings.library.ismemory(++id));
settings.library.setalloc("malloc", id, -1); settings.library.setalloc("malloc", id, -1);
@ -1566,7 +1566,7 @@ private:
checkLeak.runSimplifiedChecks(&tokenizer, &settings, this); checkLeak.runSimplifiedChecks(&tokenizer, &settings, this);
} }
void run() { void run() override {
LOAD_LIB_2(settings.library, "windows.cfg"); LOAD_LIB_2(settings.library, "windows.cfg");
TEST_CASE(heapDoubleFree); TEST_CASE(heapDoubleFree);

View File

@ -39,7 +39,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
TEST_CASE(empty); TEST_CASE(empty);
TEST_CASE(function); TEST_CASE(function);
TEST_CASE(function_match_scope); TEST_CASE(function_match_scope);

View File

@ -30,7 +30,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(isint); TEST_CASE(isint);
TEST_CASE(isbin); TEST_CASE(isbin);
TEST_CASE(isdec); TEST_CASE(isdec);

View File

@ -42,7 +42,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
TEST_CASE(testFunctionReturnType); TEST_CASE(testFunctionReturnType);
TEST_CASE(open); 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, "std.cfg");
LOAD_LIB_2(settings1.library, "posix.cfg"); LOAD_LIB_2(settings1.library, "posix.cfg");
LOAD_LIB_2(settings2.library, "std.cfg"); LOAD_LIB_2(settings2.library, "std.cfg");
@ -4108,7 +4108,7 @@ private:
checkMemoryLeak.check(); checkMemoryLeak.check();
} }
void run() { void run() override {
settings.addEnabled("warning"); settings.addEnabled("warning");
settings.addEnabled("style"); settings.addEnabled("style");
@ -5282,7 +5282,7 @@ private:
checkMemoryLeakStructMember.check(); checkMemoryLeakStructMember.check();
} }
void run() { void run() override {
LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "std.cfg");
LOAD_LIB_2(settings.library, "posix.cfg"); LOAD_LIB_2(settings.library, "posix.cfg");
@ -5730,7 +5730,7 @@ private:
checkMemoryLeakNoVar.check(); checkMemoryLeakNoVar.check();
} }
void run() { void run() override {
settings.inconclusive = true; settings.inconclusive = true;
settings.standards.posix = true; settings.standards.posix = true;
settings.addEnabled("warning"); settings.addEnabled("warning");
@ -6065,7 +6065,7 @@ private:
checkMemoryLeak4.check(); checkMemoryLeak4.check();
} }
void run() { void run() override {
LOAD_LIB_2(settings.library, "gtk.cfg"); LOAD_LIB_2(settings.library, "gtk.cfg");
settings.addEnabled("all"); settings.addEnabled("all");
@ -6180,7 +6180,7 @@ private:
checkMemoryLeak.check(); checkMemoryLeak.check();
} }
void run() { void run() override {
LOAD_LIB_2(settings.library, "windows.cfg"); LOAD_LIB_2(settings.library, "windows.cfg");
TEST_CASE(openfileNoLeak); TEST_CASE(openfileNoLeak);

View File

@ -38,7 +38,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
// Load std.cfg configuration // Load std.cfg configuration
{ {
const char xmldata[] = "<?xml version=\"1.0\"?>\n" const char xmldata[] = "<?xml version=\"1.0\"?>\n"

View File

@ -26,7 +26,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(which_test); TEST_CASE(which_test);
TEST_CASE(which_test_method); TEST_CASE(which_test_method);
TEST_CASE(no_test_method); TEST_CASE(no_test_method);

View File

@ -38,7 +38,7 @@ public:
private: private:
Settings _settings; Settings _settings;
void run() { void run() override {
LOAD_LIB_2(_settings.library, "std.cfg"); LOAD_LIB_2(_settings.library, "std.cfg");

View File

@ -29,7 +29,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(removeQuotationMarks); TEST_CASE(removeQuotationMarks);
TEST_CASE(acceptFile); TEST_CASE(acceptFile);
TEST_CASE(getCurrentPath); TEST_CASE(getCurrentPath);

View File

@ -39,7 +39,7 @@ private:
const PathMatch fooCppMatcher; const PathMatch fooCppMatcher;
const PathMatch srcFooCppMatcher; const PathMatch srcFooCppMatcher;
void run() { void run() override {
TEST_CASE(emptymaskemptyfile); TEST_CASE(emptymaskemptyfile);
TEST_CASE(emptymaskpath1); TEST_CASE(emptymaskpath1);
TEST_CASE(emptymaskpath2); TEST_CASE(emptymaskpath2);

View File

@ -28,7 +28,7 @@ public:
TestPlatform() : TestFixture("TestPlatform") { } TestPlatform() : TestFixture("TestPlatform") { }
private: private:
void run() { void run() override {
TEST_CASE(empty); TEST_CASE(empty);
TEST_CASE(valid_config_native_1); TEST_CASE(valid_config_native_1);
TEST_CASE(valid_config_native_2); TEST_CASE(valid_config_native_2);

View File

@ -46,7 +46,7 @@ private:
checkPostfixOperator.postfixOperator(); checkPostfixOperator.postfixOperator();
} }
void run() { void run() override {
settings.addEnabled("performance"); settings.addEnabled("performance");
TEST_CASE(testsimple); TEST_CASE(testsimple);

View File

@ -68,7 +68,7 @@ private:
Settings settings0; Settings settings0;
Preprocessor preprocessor0; Preprocessor preprocessor0;
void run() { void run() override {
// The bug that started the whole work with the new preprocessor // The bug that started the whole work with the new preprocessor
TEST_CASE(Bug2190219); TEST_CASE(Bug2190219);

View File

@ -44,7 +44,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(runSamples); TEST_CASE(runSamples);
TEST_CASE(runConsoleCodePageTranslationOnWindows); TEST_CASE(runConsoleCodePageTranslationOnWindows);
} }

View File

@ -36,7 +36,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("portability"); settings.addEnabled("portability");
TEST_CASE(template1); TEST_CASE(template1);

View File

@ -39,7 +39,7 @@ private:
Settings settings_std; Settings settings_std;
Settings settings_windows; Settings settings_windows;
void run() { void run() override {
LOAD_LIB_2(settings_std.library, "std.cfg"); LOAD_LIB_2(settings_std.library, "std.cfg");
LOAD_LIB_2(settings_windows.library, "windows.cfg"); LOAD_LIB_2(settings_windows.library, "windows.cfg");
settings0.addEnabled("portability"); settings0.addEnabled("portability");

View File

@ -38,7 +38,7 @@ private:
Settings settings1; Settings settings1;
Settings settings2; Settings settings2;
void run() { void run() override {
settings0.addEnabled("style"); settings0.addEnabled("style");
settings2.addEnabled("style"); settings2.addEnabled("style");

View File

@ -33,7 +33,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("warning"); settings.addEnabled("warning");
settings.addEnabled("portability"); settings.addEnabled("portability");
settings.inconclusive = true; settings.inconclusive = true;

View File

@ -34,7 +34,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("warning"); settings.addEnabled("warning");
settings.addEnabled("style"); settings.addEnabled("style");
settings.addEnabled("performance"); settings.addEnabled("performance");

View File

@ -31,7 +31,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("warning"); settings.addEnabled("warning");
settings.addEnabled("style"); settings.addEnabled("style");

View File

@ -69,8 +69,8 @@ protected:
void processOptions(const options& args); void processOptions(const options& args);
public: public:
virtual void reportOut(const std::string &outmsg); virtual void reportOut(const std::string &outmsg) override;
virtual void reportErr(const ErrorLogger::ErrorMessage &msg); virtual void reportErr(const ErrorLogger::ErrorMessage &msg) override;
void run(const std::string &str); void run(const std::string &str);
const std::string classname; const std::string classname;

View File

@ -37,7 +37,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(suppressionsBadId1); TEST_CASE(suppressionsBadId1);
TEST_CASE(suppressionsDosFormat); // Ticket #1836 TEST_CASE(suppressionsDosFormat); // Ticket #1836
TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon

View File

@ -110,7 +110,7 @@ private:
return 0; return 0;
} }
void run() { void run() override {
LOAD_LIB_2(settings1.library, "std.cfg"); LOAD_LIB_2(settings1.library, "std.cfg");
settings2.platform(Settings::Unspecified); settings2.platform(Settings::Unspecified);

View File

@ -61,7 +61,7 @@ private:
ASSERT_EQUALS(result, executor.check()); ASSERT_EQUALS(result, executor.check());
} }
void run() { void run() override {
LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "std.cfg");
TEST_CASE(deadlock_with_many_errors); TEST_CASE(deadlock_with_many_errors);

View File

@ -29,7 +29,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(result); TEST_CASE(result);
} }

View File

@ -42,7 +42,7 @@ private:
std::vector<std::string> extendedOps; std::vector<std::string> extendedOps;
std::vector<std::string> assignmentOps; std::vector<std::string> assignmentOps;
void run() { void run() override {
arithmeticalOps = { "+", "-", "*", "/", "%", "<<", ">>" }; arithmeticalOps = { "+", "-", "*", "/", "%", "<<", ">>" };
logicalOps = { "&&", "||", "!" }; logicalOps = { "&&", "||", "!" };
comparisonOps = { "==", "!=", "<", "<=", ">", ">=" }; comparisonOps = { "==", "!=", "<", "<=", ">", ">=" };

View File

@ -44,7 +44,7 @@ private:
Settings settings2; Settings settings2;
Settings settings_windows; Settings settings_windows;
void run() { void run() override {
LOAD_LIB_2(settings_windows.library, "windows.cfg"); LOAD_LIB_2(settings_windows.library, "windows.cfg");
TEST_CASE(tokenize1); TEST_CASE(tokenize1);

View File

@ -32,7 +32,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
TEST_CASE(testaddtoken1); TEST_CASE(testaddtoken1);
TEST_CASE(testaddtoken2); TEST_CASE(testaddtoken2);
TEST_CASE(inc); TEST_CASE(inc);

View File

@ -32,7 +32,7 @@ public:
private: private:
void run() { void run() override {
TEST_CASE(checkTooBigShift_Unix32); TEST_CASE(checkTooBigShift_Unix32);
TEST_CASE(checkIntegerOverflow); TEST_CASE(checkIntegerOverflow);
TEST_CASE(signConversion); TEST_CASE(signConversion);

View File

@ -36,7 +36,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
LOAD_LIB_2(settings.library, "std.cfg"); LOAD_LIB_2(settings.library, "std.cfg");
TEST_CASE(uninitvar1); TEST_CASE(uninitvar1);

View File

@ -33,7 +33,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("style"); settings.addEnabled("style");
TEST_CASE(incondition); TEST_CASE(incondition);

View File

@ -34,7 +34,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("style"); settings.addEnabled("style");
TEST_CASE(test1); TEST_CASE(test1);

View File

@ -31,7 +31,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
settings.addEnabled("style"); settings.addEnabled("style");
TEST_CASE(emptyclass); // #5355 - False positive: Variable is not assigned a value. TEST_CASE(emptyclass); // #5355 - False positive: Variable is not assigned a value.

View File

@ -50,10 +50,10 @@ public:
SimpleSuppressor(Settings &settings, ErrorLogger *next) SimpleSuppressor(Settings &settings, ErrorLogger *next)
: _settings(settings), _next(next) { : _settings(settings), _next(next) {
} }
virtual void reportOut(const std::string &outmsg) { virtual void reportOut(const std::string &outmsg) override {
_next->reportOut(outmsg); _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())) if (!msg._callStack.empty() && !_settings.nomsg.isSuppressed(msg.toSuppressionsErrorMessage()))
_next->reportErr(msg); _next->reportErr(msg);
} }

View File

@ -44,7 +44,7 @@ private:
checkVaarg.runSimplifiedChecks(&tokenizer, &settings, this); checkVaarg.runSimplifiedChecks(&tokenizer, &settings, this);
} }
void run() { void run() override {
settings.addEnabled("warning"); settings.addEnabled("warning");
TEST_CASE(wrongParameterTo_va_start); TEST_CASE(wrongParameterTo_va_start);

View File

@ -41,7 +41,7 @@ public:
private: private:
Settings settings; Settings settings;
void run() { void run() override {
// strcpy, abort cfg // strcpy, abort cfg
const char cfg[] = "<?xml version=\"1.0\"?>\n" const char cfg[] = "<?xml version=\"1.0\"?>\n"
"<def>\n" "<def>\n"

View File

@ -34,7 +34,7 @@ public:
} }
private: private:
void run() { void run() override {
TEST_CASE(varid1); TEST_CASE(varid1);
TEST_CASE(varid2); TEST_CASE(varid2);
TEST_CASE(varid3); TEST_CASE(varid3);