Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions cli/cppcheckexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#define CPPCHECKEXECUTOR_H

#include "color.h"
#include "config.h"
#include "errorlogger.h"

#include <cstdio>
Expand Down Expand Up @@ -54,7 +53,7 @@ class CppCheckExecutor : public ErrorLogger {
/**
* Destructor
*/
~CppCheckExecutor() OVERRIDE;
~CppCheckExecutor() override;

/**
* Starts the checking.
Expand All @@ -75,19 +74,19 @@ class CppCheckExecutor : public ErrorLogger {
*
* @param outmsg Progress message e.g. "Checking main.cpp..."
*/
void reportOut(const std::string &outmsg, Color c = Color::Reset) OVERRIDE;
void reportOut(const std::string &outmsg, Color c = Color::Reset) override;

/** xml output of errors */
void reportErr(const ErrorMessage &msg) OVERRIDE;
void reportErr(const ErrorMessage &msg) override;

void reportProgress(const std::string &filename, const char stage[], const std::size_t value) OVERRIDE;
void reportProgress(const std::string &filename, const char stage[], const std::size_t value) override;

/**
* Output information messages.
*/
void reportInfo(const ErrorMessage &msg) OVERRIDE;
void reportInfo(const ErrorMessage &msg) override;

void bughuntingReport(const std::string &str) OVERRIDE;
void bughuntingReport(const std::string &str) override;

/**
* Information about how many files have been checked
Expand Down
11 changes: 5 additions & 6 deletions cli/threadexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#define THREADEXECUTOR_H

#include "color.h"
#include "config.h"
#include "errorlogger.h"

#include <cstddef>
Expand Down Expand Up @@ -51,14 +50,14 @@ class ThreadExecutor : public ErrorLogger {
public:
ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger);
ThreadExecutor(const ThreadExecutor &) = delete;
~ThreadExecutor() OVERRIDE;
~ThreadExecutor() override;
void operator=(const ThreadExecutor &) = delete;
unsigned int check();

void reportOut(const std::string &outmsg, Color c) OVERRIDE;
void reportErr(const ErrorMessage &msg) OVERRIDE;
void reportInfo(const ErrorMessage &msg) OVERRIDE;
void bughuntingReport(const std::string &str) OVERRIDE;
void reportOut(const std::string &outmsg, Color c) override;
void reportErr(const ErrorMessage &msg) override;
void reportInfo(const ErrorMessage &msg) override;
void bughuntingReport(const std::string &str) override;

/**
* @brief Add content to a file, to be used in unit testing.
Expand Down
6 changes: 3 additions & 3 deletions lib/check64bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CPPCHECKLIB Check64BitPortability : public Check {
: Check(myName(), tokenizer, settings, errorLogger) {}

/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
Check64BitPortability check64BitPortability(tokenizer, settings, errorLogger);
check64BitPortability.pointerassignment();
}
Expand All @@ -65,7 +65,7 @@ class CPPCHECKLIB Check64BitPortability : public Check {
void returnIntegerError(const Token *tok);
void returnPointerError(const Token *tok);

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
Check64BitPortability c(nullptr, settings, errorLogger);
c.assignmentAddressToIntegerError(nullptr);
c.assignmentIntegerToAddressError(nullptr);
Expand All @@ -77,7 +77,7 @@ class CPPCHECKLIB Check64BitPortability : public Check {
return "64-bit portability";
}

std::string classInfo() const OVERRIDE {
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";
Expand Down
6 changes: 3 additions & 3 deletions lib/checkassert.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CPPCHECKLIB CheckAssert : public Check {
: Check(myName(), tokenizer, settings, errorLogger) {}

/** run checks, the token list is not simplified */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
CheckAssert checkAssert(tokenizer, settings, errorLogger);
checkAssert.assertWithSideEffects();
}
Expand All @@ -63,7 +63,7 @@ class CPPCHECKLIB CheckAssert : public Check {
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 OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckAssert c(nullptr, settings, errorLogger);
c.sideEffectInAssertError(nullptr, "function");
c.assignmentInAssertError(nullptr, "var");
Expand All @@ -73,7 +73,7 @@ class CPPCHECKLIB CheckAssert : public Check {
return "Assert";
}

std::string classInfo() const OVERRIDE {
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";
}
};
Expand Down
6 changes: 3 additions & 3 deletions lib/checkautovariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CPPCHECKLIB CheckAutoVariables : public Check {
: Check(myName(), tokenizer, settings, errorLogger) {}

/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
CheckAutoVariables checkAutoVariables(tokenizer, settings, errorLogger);
checkAutoVariables.assignFunctionArg();
checkAutoVariables.checkVarLifetime();
Expand Down Expand Up @@ -93,7 +93,7 @@ class CPPCHECKLIB CheckAutoVariables : public Check {
void errorUselessAssignmentArg(const Token *tok);
void errorUselessAssignmentPtrArg(const Token *tok);

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
ErrorPath errorPath;
CheckAutoVariables c(nullptr,settings,errorLogger);
c.errorAutoVariableAssignment(nullptr, false);
Expand All @@ -117,7 +117,7 @@ class CPPCHECKLIB CheckAutoVariables : public Check {
return "Auto Variables";
}

std::string classInfo() const OVERRIDE {
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"
Expand Down
6 changes: 3 additions & 3 deletions lib/checkbool.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CPPCHECKLIB CheckBool : public Check {
: Check(myName(), tokenizer, settings, errorLogger) {}

/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
CheckBool checkBool(tokenizer, settings, errorLogger);

// Checks
Expand Down Expand Up @@ -109,7 +109,7 @@ class CPPCHECKLIB CheckBool : public Check {
void pointerArithBoolError(const Token *tok);
void returnValueBoolError(const Token *tok);

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckBool c(nullptr, settings, errorLogger);

c.assignBoolToPointerError(nullptr);
Expand All @@ -129,7 +129,7 @@ class CPPCHECKLIB CheckBool : public Check {
return "Boolean";
}

std::string classInfo() const OVERRIDE {
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"
Expand Down
6 changes: 3 additions & 3 deletions lib/checkboost.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CPPCHECKLIB CheckBoost : public Check {
: Check(myName(), tokenizer, settings, errorLogger) {}

/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
if (!tokenizer->isCPP())
return;

Expand All @@ -61,7 +61,7 @@ class CPPCHECKLIB CheckBoost : public Check {
private:
void boostForeachError(const Token *tok);

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckBoost c(nullptr, settings, errorLogger);
c.boostForeachError(nullptr);
}
Expand All @@ -70,7 +70,7 @@ class CPPCHECKLIB CheckBoost : public Check {
return "Boost usage";
}

std::string classInfo() const OVERRIDE {
std::string classInfo() const override {
return "Check for invalid usage of Boost:\n"
"- container modification during BOOST_FOREACH\n";
}
Expand Down
14 changes: 7 additions & 7 deletions lib/checkbufferoverrun.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CPPCHECKLIB CheckBufferOverrun : public Check {
CheckBufferOverrun(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger) {}

void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
CheckBufferOverrun checkBufferOverrun(tokenizer, settings, errorLogger);
checkBufferOverrun.arrayIndex();
checkBufferOverrun.pointerArithmetic();
Expand All @@ -78,7 +78,7 @@ class CPPCHECKLIB CheckBufferOverrun : public Check {
checkBufferOverrun.argumentSize();
}

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckBufferOverrun c(nullptr, settings, errorLogger);
c.arrayIndexError(nullptr, std::vector<Dimension>(), std::vector<ValueFlow::Value>());
c.pointerArithmeticError(nullptr, nullptr, nullptr);
Expand All @@ -90,10 +90,10 @@ class CPPCHECKLIB CheckBufferOverrun : public Check {
}

/** @brief Parse current TU and extract file info */
Check::FileInfo *getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const OVERRIDE;
Check::FileInfo *getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const override;

/** @brief Analyse all file infos for all TU */
bool analyseWholeProgram(const CTU::FileInfo *ctu, const std::list<Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger) OVERRIDE;
bool analyseWholeProgram(const CTU::FileInfo *ctu, const std::list<Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger) override;

private:

Expand Down Expand Up @@ -137,22 +137,22 @@ class CPPCHECKLIB CheckBufferOverrun : public Check {
std::list<CTU::FileInfo::UnsafeUsage> unsafePointerArith;

/** Convert MyFileInfo data into xml string */
std::string toString() const OVERRIDE;
std::string toString() const override;
};

static bool isCtuUnsafeBufferUsage(const Check *check, const Token *argtok, MathLib::bigint *offset, int type);
static bool isCtuUnsafeArrayIndex(const Check *check, const Token *argtok, MathLib::bigint *offset);
static bool isCtuUnsafePointerArith(const Check *check, const Token *argtok, MathLib::bigint *offset);

Check::FileInfo * loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const OVERRIDE;
Check::FileInfo * loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const override;
static bool analyseWholeProgram1(const std::map<std::string, std::list<const CTU::FileInfo::CallBase *>> &callsMap, const CTU::FileInfo::UnsafeUsage &unsafeUsage, int type, ErrorLogger &errorLogger);


static std::string myName() {
return "Bounds checking";
}

std::string classInfo() const OVERRIDE {
std::string classInfo() const override {
return "Out of bounds checking:\n"
"- Array index out of bounds\n"
"- Pointer arithmetic overflow\n"
Expand Down
14 changes: 7 additions & 7 deletions lib/checkclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CPPCHECKLIB CheckClass : public Check {
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) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
if (tokenizer->isC())
return;

Expand Down Expand Up @@ -177,16 +177,16 @@ class CPPCHECKLIB CheckClass : public Check {
std::vector<NameLoc> classDefinitions;

/** Convert MyFileInfo data into xml string */
std::string toString() const OVERRIDE;
std::string toString() const override;
};

/** @brief Parse current TU and extract file info */
Check::FileInfo *getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const OVERRIDE;
Check::FileInfo *getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const override;

Check::FileInfo * loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const OVERRIDE;
Check::FileInfo * loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const override;

/** @brief Analyse all file infos for all TU */
bool analyseWholeProgram(const CTU::FileInfo *ctu, const std::list<Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger) OVERRIDE;
bool analyseWholeProgram(const CTU::FileInfo *ctu, const std::list<Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger) override;

private:
const SymbolDatabase *mSymbolDatabase;
Expand Down Expand Up @@ -228,7 +228,7 @@ class CPPCHECKLIB CheckClass : public Check {
void unsafeClassRefMemberError(const Token *tok, const std::string &varname);
void checkDuplInheritedMembersRecursive(const Type* typeCurrent, const Type* typeBase);

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckClass c(nullptr, settings, errorLogger);
c.noConstructorError(nullptr, "classname", false);
c.noExplicitConstructorError(nullptr, "classname", false);
Expand Down Expand Up @@ -273,7 +273,7 @@ class CPPCHECKLIB CheckClass : public Check {
return "Class";
}

std::string classInfo() const OVERRIDE {
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"
Expand Down
6 changes: 3 additions & 3 deletions lib/checkcondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CPPCHECKLIB CheckCondition : public Check {
CheckCondition(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger) {}

void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
CheckCondition checkCondition(tokenizer, settings, errorLogger);
checkCondition.multiCondition();
checkCondition.clarifyCondition(); // not simplified because ifAssign
Expand Down Expand Up @@ -173,7 +173,7 @@ class CPPCHECKLIB CheckCondition : public Check {
void checkCompareValueOutOfTypeRange();
void compareValueOutOfTypeRangeError(const Token *comparison, const std::string &type, long long value, bool result);

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckCondition c(nullptr, settings, errorLogger);

ErrorPath errorPath;
Expand Down Expand Up @@ -203,7 +203,7 @@ class CPPCHECKLIB CheckCondition : public Check {
return "Condition";
}

std::string classInfo() const OVERRIDE {
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"
Expand Down
6 changes: 3 additions & 3 deletions lib/checkexceptionsafety.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CPPCHECKLIB CheckExceptionSafety : public Check {
CheckExceptionSafety(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger) {}

void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
if (tokenizer->isC())
return;

Expand Down Expand Up @@ -107,7 +107,7 @@ class CPPCHECKLIB CheckExceptionSafety : public Check {
void rethrowNoCurrentExceptionError(const Token *tok);

/** Generate all possible errors (for --errorlist) */
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckExceptionSafety c(nullptr, settings, errorLogger);
c.destructorsError(nullptr, "Class");
c.deallocThrowError(nullptr, "p");
Expand All @@ -124,7 +124,7 @@ class CPPCHECKLIB CheckExceptionSafety : public Check {
}

/** wiki formatted description of the class (for --doc) */
std::string classInfo() const OVERRIDE {
std::string classInfo() const override {
return "Checking exception safety\n"
"- Throwing exceptions in destructors\n"
"- Throwing exception during invalid state\n"
Expand Down
6 changes: 3 additions & 3 deletions lib/checkfunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CPPCHECKLIB CheckFunctions : public Check {
: Check(myName(), tokenizer, settings, errorLogger) {}

/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) override {
CheckFunctions checkFunctions(tokenizer, settings, errorLogger);

checkFunctions.checkIgnoredReturnValue();
Expand Down Expand Up @@ -124,7 +124,7 @@ class CPPCHECKLIB CheckFunctions : public Check {
void missingReturnError(const Token *tok);
void copyElisionError(const Token *tok);

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
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) {
Expand All @@ -148,7 +148,7 @@ class CPPCHECKLIB CheckFunctions : public Check {
return "Check function usage";
}

std::string classInfo() const OVERRIDE {
std::string classInfo() const override {
return "Check function usage:\n"
"- missing 'return' in non-void function\n"
"- return value of certain functions not used\n"
Expand Down
Loading