Disable all simplified checks
This commit is contained in:
parent
0e88a17aca
commit
3dc34f1515
|
@ -68,11 +68,7 @@ public:
|
||||||
static std::list<Check *> &instances();
|
static std::list<Check *> &instances();
|
||||||
|
|
||||||
/** run checks, the token list is not simplified */
|
/** run checks, the token list is not simplified */
|
||||||
virtual void runChecks(const Tokenizer *, const Settings *, ErrorLogger *) {
|
virtual void runChecks(const Tokenizer *, const Settings *, ErrorLogger *) = 0;
|
||||||
}
|
|
||||||
|
|
||||||
/** run checks, the token list is simplified */
|
|
||||||
virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) = 0;
|
|
||||||
|
|
||||||
/** get error messages */
|
/** get error messages */
|
||||||
virtual void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const = 0;
|
virtual void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const = 0;
|
||||||
|
|
|
@ -57,13 +57,6 @@ public:
|
||||||
check64BitPortability.pointerassignment();
|
check64BitPortability.pointerassignment();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check for pointer assignment */
|
/** Check for pointer assignment */
|
||||||
void pointerassignment();
|
void pointerassignment();
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,6 @@ public:
|
||||||
checkAssert.assertWithSideEffects();
|
checkAssert.assertWithSideEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
void assertWithSideEffects();
|
void assertWithSideEffects();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -57,12 +57,6 @@ public:
|
||||||
checkAutoVariables.autoVariables();
|
checkAutoVariables.autoVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** assign function argument */
|
/** assign function argument */
|
||||||
void assignFunctionArg();
|
void assignFunctionArg();
|
||||||
|
|
||||||
|
|
|
@ -66,13 +66,6 @@ public:
|
||||||
checkBool.checkBitwiseOnBoolean();
|
checkBool.checkBitwiseOnBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief %Check for comparison of function returning bool*/
|
/** @brief %Check for comparison of function returning bool*/
|
||||||
void checkComparisonOfFuncReturningBool();
|
void checkComparisonOfFuncReturningBool();
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,6 @@ public:
|
||||||
checkBoost.checkBoostForeachModification();
|
checkBoost.checkBoostForeachModification();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Simplified checks. The token list is simplified. */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief %Check for container modification while using the BOOST_FOREACH macro */
|
/** @brief %Check for container modification while using the BOOST_FOREACH macro */
|
||||||
void checkBoostForeachModification();
|
void checkBoostForeachModification();
|
||||||
|
|
||||||
|
|
|
@ -67,12 +67,6 @@ public:
|
||||||
checkBufferOverrun.stringNotZeroTerminated();
|
checkBufferOverrun.stringNotZeroTerminated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
|
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const OVERRIDE {
|
||||||
CheckBufferOverrun c(nullptr, settings, errorLogger);
|
CheckBufferOverrun c(nullptr, settings, errorLogger);
|
||||||
c.arrayIndexError(nullptr, nullptr, nullptr);
|
c.arrayIndexError(nullptr, nullptr, nullptr);
|
||||||
|
|
|
@ -81,14 +81,6 @@ public:
|
||||||
checkClass.checkOverride();
|
checkClass.checkOverride();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks on the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** @brief %Check that all class constructors are ok */
|
/** @brief %Check that all class constructors are ok */
|
||||||
void constructors();
|
void constructors();
|
||||||
|
|
||||||
|
|
|
@ -67,13 +67,6 @@ public:
|
||||||
checkCondition.checkModuloAlwaysTrueFalse();
|
checkCondition.checkModuloAlwaysTrueFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** mismatching assignment / comparison */
|
/** mismatching assignment / comparison */
|
||||||
void assignIf();
|
void assignIf();
|
||||||
|
|
||||||
|
|
|
@ -74,12 +74,6 @@ public:
|
||||||
checkExceptionSafety.unhandledExceptionSpecification();
|
checkExceptionSafety.unhandledExceptionSpecification();
|
||||||
}
|
}
|
||||||
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Don't throw exceptions in destructors */
|
/** Don't throw exceptions in destructors */
|
||||||
void destructors();
|
void destructors();
|
||||||
|
|
||||||
|
|
|
@ -66,11 +66,6 @@ public:
|
||||||
|
|
||||||
// --check-library : functions with nonmatching configuration
|
// --check-library : functions with nonmatching configuration
|
||||||
checkFunctions.checkLibraryMatchFunctions();
|
checkFunctions.checkLibraryMatchFunctions();
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
CheckFunctions checkFunctions(tokenizer, settings, errorLogger);
|
|
||||||
|
|
||||||
checkFunctions.checkProhibitedFunctions();
|
checkFunctions.checkProhibitedFunctions();
|
||||||
checkFunctions.invalidFunctionUsage();
|
checkFunctions.invalidFunctionUsage();
|
||||||
|
|
|
@ -59,13 +59,6 @@ public:
|
||||||
checkInternal.checkStlUsage();
|
checkInternal.checkStlUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Simplified checks. The token list is simplified. */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief %Check if a simple pattern is used inside Token::Match or Token::findmatch */
|
/** @brief %Check if a simple pattern is used inside Token::Match or Token::findmatch */
|
||||||
void checkTokenMatchPatterns();
|
void checkTokenMatchPatterns();
|
||||||
|
|
||||||
|
|
|
@ -54,12 +54,6 @@ public:
|
||||||
CheckIO checkIO(tokenizer, settings, errorLogger);
|
CheckIO checkIO(tokenizer, settings, errorLogger);
|
||||||
|
|
||||||
checkIO.checkWrongPrintfScanfArguments();
|
checkIO.checkWrongPrintfScanfArguments();
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief Run checks on the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
CheckIO checkIO(tokenizer, settings, errorLogger);
|
|
||||||
|
|
||||||
checkIO.checkCoutCerrMisusage();
|
checkIO.checkCoutCerrMisusage();
|
||||||
checkIO.checkFileUsage();
|
checkIO.checkFileUsage();
|
||||||
checkIO.invalidScanf();
|
checkIO.invalidScanf();
|
||||||
|
|
|
@ -103,8 +103,7 @@ public:
|
||||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,8 +183,7 @@ public:
|
||||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief run all simplified checks */
|
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
CheckMemoryLeakInFunction checkMemoryLeak(tokenizer, settings, errorLogger);
|
CheckMemoryLeakInFunction checkMemoryLeak(tokenizer, settings, errorLogger);
|
||||||
checkMemoryLeak.checkReallocUsage();
|
checkMemoryLeak.checkReallocUsage();
|
||||||
}
|
}
|
||||||
|
@ -245,7 +244,7 @@ public:
|
||||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) OVERRIDE {
|
void runChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) OVERRIDE {
|
||||||
if (!tokenizr->isCPP())
|
if (!tokenizr->isCPP())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -292,7 +291,7 @@ public:
|
||||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||||
CheckMemoryLeakStructMember checkMemoryLeak(tokenizer, settings, errorLogger);
|
CheckMemoryLeakStructMember checkMemoryLeak(tokenizer, settings, errorLogger);
|
||||||
checkMemoryLeak.check();
|
checkMemoryLeak.check();
|
||||||
}
|
}
|
||||||
|
@ -331,7 +330,7 @@ public:
|
||||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||||
CheckMemoryLeakNoVar checkMemoryLeak(tokenizer, settings, errorLogger);
|
CheckMemoryLeakNoVar checkMemoryLeak(tokenizer, settings, errorLogger);
|
||||||
checkMemoryLeak.check();
|
checkMemoryLeak.check();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,11 +59,6 @@ public:
|
||||||
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 */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
CheckNullPointer checkNullPointer(tokenizer, settings, errorLogger);
|
|
||||||
checkNullPointer.nullConstantDereference();
|
checkNullPointer.nullConstantDereference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,18 +91,9 @@ public:
|
||||||
checkOther.checkPassByReference();
|
checkOther.checkPassByReference();
|
||||||
checkOther.checkComparisonFunctionIsAlwaysTrueOrFalse();
|
checkOther.checkComparisonFunctionIsAlwaysTrueOrFalse();
|
||||||
checkOther.checkInvalidFree();
|
checkOther.checkInvalidFree();
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
CheckOther checkOther(tokenizer, settings, errorLogger);
|
|
||||||
|
|
||||||
// Checks
|
|
||||||
checkOther.clarifyStatement();
|
checkOther.clarifyStatement();
|
||||||
checkOther.checkCastIntToCharAndBack();
|
checkOther.checkCastIntToCharAndBack();
|
||||||
|
|
||||||
checkOther.checkMisusedScopedObject();
|
checkOther.checkMisusedScopedObject();
|
||||||
|
|
||||||
checkOther.checkAccessOfMovedVariable();
|
checkOther.checkAccessOfMovedVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,6 @@ public:
|
||||||
CheckPostfixOperator checkPostfixOperator(tokenizer, settings, errorLogger);
|
CheckPostfixOperator checkPostfixOperator(tokenizer, settings, errorLogger);
|
||||||
checkPostfixOperator.postfixOperator();
|
checkPostfixOperator.postfixOperator();
|
||||||
}
|
}
|
||||||
void runSimplifiedChecks(const Tokenizer * /*tokenizer*/, const Settings * /*settings*/, ErrorLogger * /*errorLogger*/) OVERRIDE {
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check postfix operators */
|
/** Check postfix operators */
|
||||||
void postfixOperator();
|
void postfixOperator();
|
||||||
|
|
|
@ -64,10 +64,6 @@ public:
|
||||||
checkSizeof.sizeofVoid();
|
checkSizeof.sizeofVoid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer* /*tokenizer*/, const Settings* /*settings*/, ErrorLogger* /*errorLogger*/) OVERRIDE {
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief %Check for 'sizeof sizeof ..' */
|
/** @brief %Check for 'sizeof sizeof ..' */
|
||||||
void sizeofsizeof();
|
void sizeofsizeof();
|
||||||
|
|
||||||
|
|
|
@ -72,15 +72,6 @@ public:
|
||||||
checkStl.string_c_str();
|
checkStl.string_c_str();
|
||||||
checkStl.uselessCalls();
|
checkStl.uselessCalls();
|
||||||
checkStl.useStlAlgorithm();
|
checkStl.useStlAlgorithm();
|
||||||
}
|
|
||||||
|
|
||||||
/** Simplified checks. The token list is simplified. */
|
|
||||||
void runSimplifiedChecks(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger) OVERRIDE {
|
|
||||||
if (!tokenizer->isCPP()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckStl checkStl(tokenizer, settings, errorLogger);
|
|
||||||
|
|
||||||
checkStl.stlOutOfBounds();
|
checkStl.stlOutOfBounds();
|
||||||
checkStl.negativeIndex();
|
checkStl.negativeIndex();
|
||||||
|
|
|
@ -63,13 +63,6 @@ public:
|
||||||
checkString.checkAlwaysTrueOrFalseStringCompare();
|
checkString.checkAlwaysTrueOrFalseStringCompare();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief undefined behaviour, writing string literal */
|
/** @brief undefined behaviour, writing string literal */
|
||||||
void stringLiteralWrite();
|
void stringLiteralWrite();
|
||||||
|
|
||||||
|
|
|
@ -59,13 +59,6 @@ public:
|
||||||
checkType.checkFloatToIntegerOverflow();
|
checkType.checkFloatToIntegerOverflow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief %Check for bitwise shift with too big right operand */
|
/** @brief %Check for bitwise shift with too big right operand */
|
||||||
void checkTooBigBitwiseShift();
|
void checkTooBigBitwiseShift();
|
||||||
|
|
||||||
|
|
|
@ -68,13 +68,6 @@ public:
|
||||||
checkUninitVar.valueFlowUninit();
|
checkUninitVar.valueFlowUninit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check for uninitialized variables */
|
/** Check for uninitialized variables */
|
||||||
void check();
|
void check();
|
||||||
void checkScope(const Scope* scope, const std::set<std::string> &arrayTypeDefs);
|
void checkScope(const Scope* scope, const std::set<std::string> &arrayTypeDefs);
|
||||||
|
|
|
@ -83,6 +83,8 @@ private:
|
||||||
c.unusedFunctionError(errorLogger, emptyString, 0, "funcName");
|
c.unusedFunctionError(errorLogger, emptyString, 0, "funcName");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void runChecks(const Tokenizer * /*tokenizer*/, const Settings * /*settings*/, ErrorLogger * /*errorLogger*/) OVERRIDE {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy implementation, just to provide error for --errorlist
|
* Dummy implementation, just to provide error for --errorlist
|
||||||
*/
|
*/
|
||||||
|
@ -90,12 +92,6 @@ private:
|
||||||
const std::string &filename, unsigned int lineNumber,
|
const std::string &filename, unsigned int lineNumber,
|
||||||
const std::string &funcname);
|
const std::string &funcname);
|
||||||
|
|
||||||
/**
|
|
||||||
* Dummy implementation, just to provide error for --errorlist
|
|
||||||
*/
|
|
||||||
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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,13 +61,6 @@ public:
|
||||||
checkUnusedVar.checkFunctionVariableUsage();
|
checkUnusedVar.checkFunctionVariableUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
|
||||||
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
|
||||||
(void)tokenizer;
|
|
||||||
(void)settings;
|
|
||||||
(void)errorLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief %Check for unused function variables */
|
/** @brief %Check for unused function variables */
|
||||||
void checkFunctionVariableUsage_iterateScopes(const Scope* const scope, Variables& variables);
|
void checkFunctionVariableUsage_iterateScopes(const Scope* const scope, Variables& variables);
|
||||||
void checkFunctionVariableUsage();
|
void checkFunctionVariableUsage();
|
||||||
|
|
|
@ -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) OVERRIDE {
|
virtual void runChecks(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();
|
||||||
|
|
|
@ -610,19 +610,6 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
|
||||||
|
|
||||||
void CppCheck::checkSimplifiedTokens(const Tokenizer &tokenizer)
|
void CppCheck::checkSimplifiedTokens(const Tokenizer &tokenizer)
|
||||||
{
|
{
|
||||||
// call all "runSimplifiedChecks" in all registered Check classes
|
|
||||||
for (std::list<Check *>::const_iterator it = Check::instances().begin(); it != Check::instances().end(); ++it) {
|
|
||||||
if (mSettings.terminated())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (tokenizer.isMaxTime())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Timer timerSimpleChecks((*it)->name() + "::runSimplifiedChecks", mSettings.showtime, &S_timerResults);
|
|
||||||
(*it)->runSimplifiedChecks(&tokenizer, &mSettings, this);
|
|
||||||
timerSimpleChecks.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mSettings.terminated())
|
if (!mSettings.terminated())
|
||||||
executeRules("simple", tokenizer);
|
executeRules("simple", tokenizer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -515,8 +515,6 @@ private:
|
||||||
|
|
||||||
CheckCondition checkCondition;
|
CheckCondition checkCondition;
|
||||||
checkCondition.runChecks(&tokenizer, &settings1, this);
|
checkCondition.runChecks(&tokenizer, &settings1, this);
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
checkCondition.runSimplifiedChecks(&tokenizer, &settings1, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void duplicateIf() {
|
void duplicateIf() {
|
||||||
|
|
|
@ -62,7 +62,7 @@ private:
|
||||||
|
|
||||||
// Invalid function usage
|
// Invalid function usage
|
||||||
TEST_CASE(invalidFunctionUsage1);
|
TEST_CASE(invalidFunctionUsage1);
|
||||||
TEST_CASE(invalidFunctionUsageStrings);
|
// TODO TEST_CASE(invalidFunctionUsageStrings);
|
||||||
|
|
||||||
// Math function usage
|
// Math function usage
|
||||||
TEST_CASE(mathfunctionCall_fmod);
|
TEST_CASE(mathfunctionCall_fmod);
|
||||||
|
@ -96,12 +96,6 @@ private:
|
||||||
|
|
||||||
CheckFunctions checkFunctions(&tokenizer, settings_, this);
|
CheckFunctions checkFunctions(&tokenizer, settings_, this);
|
||||||
checkFunctions.runChecks(&tokenizer, settings_, this);
|
checkFunctions.runChecks(&tokenizer, settings_, this);
|
||||||
|
|
||||||
// Simplify...
|
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
|
|
||||||
// Check...
|
|
||||||
checkFunctions.runSimplifiedChecks(&tokenizer, settings_, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void prohibitedFunctions_posix() {
|
void prohibitedFunctions_posix() {
|
||||||
|
|
|
@ -277,10 +277,6 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenizer.simplifyTokenList2();
|
tokenizer.simplifyTokenList2();
|
||||||
// call all "runSimplifiedChecks" in all registered Check classes
|
|
||||||
for (std::list<Check *>::const_iterator it = Check::instances().begin(); it != Check::instances().end(); ++it) {
|
|
||||||
(*it)->runSimplifiedChecks(&tokenizer, &settings, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tokenizer.tokens()->stringifyList(false, false, false, true, false, 0, 0);
|
return tokenizer.tokens()->stringifyList(false, false, false, true, false, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,14 +54,14 @@ private:
|
||||||
TEST_CASE(assign10);
|
TEST_CASE(assign10);
|
||||||
TEST_CASE(assign11); // #3942: x = a(b(p));
|
TEST_CASE(assign11); // #3942: x = a(b(p));
|
||||||
TEST_CASE(assign12); // #4236: FP. bar(&x);
|
TEST_CASE(assign12); // #4236: FP. bar(&x);
|
||||||
TEST_CASE(assign13); // #4237: FP. char*&ref=p; p=malloc(10); free(ref);
|
// TODO TEST_CASE(assign13); // #4237: FP. char*&ref=p; p=malloc(10); free(ref);
|
||||||
TEST_CASE(assign14);
|
TEST_CASE(assign14);
|
||||||
|
|
||||||
TEST_CASE(deallocuse1);
|
TEST_CASE(deallocuse1);
|
||||||
TEST_CASE(deallocuse2);
|
TEST_CASE(deallocuse2);
|
||||||
TEST_CASE(deallocuse3);
|
TEST_CASE(deallocuse3);
|
||||||
TEST_CASE(deallocuse4);
|
TEST_CASE(deallocuse4);
|
||||||
TEST_CASE(deallocuse5); // #4018: FP. free(p), p = 0;
|
// TODO TEST_CASE(deallocuse5); // #4018: FP. free(p), p = 0;
|
||||||
TEST_CASE(deallocuse6); // #4034: FP. x = p = f();
|
TEST_CASE(deallocuse6); // #4034: FP. x = p = f();
|
||||||
TEST_CASE(deallocuse7); // #6467, #6469, #6473
|
TEST_CASE(deallocuse7); // #6467, #6469, #6473
|
||||||
|
|
||||||
|
@ -157,13 +157,12 @@ private:
|
||||||
Tokenizer tokenizer(&settings, this);
|
Tokenizer tokenizer(&settings, this);
|
||||||
std::istringstream istr(code);
|
std::istringstream istr(code);
|
||||||
tokenizer.tokenize(istr, cpp?"test.cpp":"test.c");
|
tokenizer.tokenize(istr, cpp?"test.cpp":"test.c");
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
|
|
||||||
// Check for leaks..
|
// Check for leaks..
|
||||||
CheckLeakAutoVar c;
|
CheckLeakAutoVar c;
|
||||||
settings.checkLibrary = true;
|
settings.checkLibrary = true;
|
||||||
settings.addEnabled("information");
|
settings.addEnabled("information");
|
||||||
c.runSimplifiedChecks(&tokenizer, &settings, this);
|
c.runChecks(&tokenizer, &settings, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void assign1() {
|
void assign1() {
|
||||||
|
@ -1649,11 +1648,10 @@ private:
|
||||||
Tokenizer tokenizer(&settings, this);
|
Tokenizer tokenizer(&settings, this);
|
||||||
std::istringstream istr(code);
|
std::istringstream istr(code);
|
||||||
tokenizer.tokenize(istr, "test.c");
|
tokenizer.tokenize(istr, "test.c");
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
|
|
||||||
// Check for leaks..
|
// Check for leaks..
|
||||||
CheckLeakAutoVar checkLeak;
|
CheckLeakAutoVar checkLeak;
|
||||||
checkLeak.runSimplifiedChecks(&tokenizer, &settings, this);
|
checkLeak.runChecks(&tokenizer, &settings, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void run() OVERRIDE {
|
void run() OVERRIDE {
|
||||||
|
|
|
@ -128,10 +128,6 @@ private:
|
||||||
// Check for null pointer dereferences..
|
// Check for null pointer dereferences..
|
||||||
CheckNullPointer checkNullPointer;
|
CheckNullPointer checkNullPointer;
|
||||||
checkNullPointer.runChecks(&tokenizer, &settings, this);
|
checkNullPointer.runChecks(&tokenizer, &settings, this);
|
||||||
|
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
|
|
||||||
checkNullPointer.runSimplifiedChecks(&tokenizer, &settings, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkP(const char code[]) {
|
void checkP(const char code[]) {
|
||||||
|
@ -158,10 +154,6 @@ private:
|
||||||
// Check for null pointer dereferences..
|
// Check for null pointer dereferences..
|
||||||
CheckNullPointer checkNullPointer;
|
CheckNullPointer checkNullPointer;
|
||||||
checkNullPointer.runChecks(&tokenizer, &settings, this);
|
checkNullPointer.runChecks(&tokenizer, &settings, this);
|
||||||
|
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
|
|
||||||
checkNullPointer.runSimplifiedChecks(&tokenizer, &settings, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1433,8 +1425,7 @@ private:
|
||||||
" }\n"
|
" }\n"
|
||||||
" return p;\n"
|
" return p;\n"
|
||||||
"}", true);
|
"}", true);
|
||||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Possible null pointer dereference: p\n"
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Possible null pointer dereference: p\n", errout.str());
|
||||||
"[test.cpp:7]: (error) Null pointer dereference\n", errout.str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nullpointer_cast() { // #4692
|
void nullpointer_cast() { // #4692
|
||||||
|
|
|
@ -254,10 +254,7 @@ private:
|
||||||
CheckOther checkOther(&tokenizer, settings, this);
|
CheckOther checkOther(&tokenizer, settings, this);
|
||||||
checkOther.runChecks(&tokenizer, settings, this);
|
checkOther.runChecks(&tokenizer, settings, this);
|
||||||
|
|
||||||
if (runSimpleChecks) {
|
(void)runSimpleChecks; // TODO Remove this
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
checkOther.runSimplifiedChecks(&tokenizer, settings, this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void check(const char code[], Settings *s) {
|
void check(const char code[], Settings *s) {
|
||||||
|
@ -296,8 +293,6 @@ private:
|
||||||
// Check..
|
// Check..
|
||||||
CheckOther checkOther(&tokenizer, settings, this);
|
CheckOther checkOther(&tokenizer, settings, this);
|
||||||
checkOther.runChecks(&tokenizer, settings, this);
|
checkOther.runChecks(&tokenizer, settings, this);
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
checkOther.runSimplifiedChecks(&tokenizer, settings, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkposix(const char code[]) {
|
void checkposix(const char code[]) {
|
||||||
|
|
|
@ -174,12 +174,8 @@ private:
|
||||||
|
|
||||||
tokenizer.tokenize(istr, "test.cpp");
|
tokenizer.tokenize(istr, "test.cpp");
|
||||||
checkStl.runChecks(&tokenizer, &settings, this);
|
checkStl.runChecks(&tokenizer, &settings, this);
|
||||||
|
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
|
|
||||||
// Check..
|
|
||||||
checkStl.runSimplifiedChecks(&tokenizer, &settings, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void check(const std::string &code, const bool inconclusive=false) {
|
void check(const std::string &code, const bool inconclusive=false) {
|
||||||
check(code.c_str(), inconclusive);
|
check(code.c_str(), inconclusive);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,6 @@ private:
|
||||||
// Check char variable usage..
|
// Check char variable usage..
|
||||||
CheckString checkString(&tokenizer, &settings, this);
|
CheckString checkString(&tokenizer, &settings, this);
|
||||||
checkString.runChecks(&tokenizer, &settings, this);
|
checkString.runChecks(&tokenizer, &settings, this);
|
||||||
|
|
||||||
tokenizer.simplifyTokenList2();
|
|
||||||
checkString.runSimplifiedChecks(&tokenizer, &settings, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void stringLiteralWrite() {
|
void stringLiteralWrite() {
|
||||||
|
|
|
@ -40,8 +40,8 @@ private:
|
||||||
tokenizer.tokenize(istr, "test.cpp");
|
tokenizer.tokenize(istr, "test.cpp");
|
||||||
|
|
||||||
// Check..
|
// Check..
|
||||||
CheckVaarg checkVaarg(&tokenizer, &settings, this);
|
CheckVaarg checkVaarg;
|
||||||
checkVaarg.runSimplifiedChecks(&tokenizer, &settings, this);
|
checkVaarg.runChecks(&tokenizer, &settings, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void run() OVERRIDE {
|
void run() OVERRIDE {
|
||||||
|
|
Loading…
Reference in New Issue