This is a fix of commit 97ffec8
.
This commit is contained in:
parent
8a3c25210d
commit
f487182075
|
@ -2108,7 +2108,7 @@ bool CheckBufferOverrun::analyseWholeProgram(const std::list<Check::FileInfo*> &
|
|||
errors = true;
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
return errors && errorLogger.hasErrors();
|
||||
}
|
||||
|
||||
unsigned int CheckBufferOverrun::sizeOfType(const Token *type) const
|
||||
|
|
|
@ -1606,6 +1606,5 @@ bool CheckUninitVar::analyseWholeProgram(const std::list<Check::FileInfo*> &file
|
|||
}
|
||||
}
|
||||
|
||||
return foundErrors;
|
||||
return foundErrors && errorLogger.hasErrors();
|
||||
}
|
||||
|
||||
|
|
|
@ -264,7 +264,7 @@ bool CheckUnusedFunctions::check(ErrorLogger * const errorLogger, const Settings
|
|||
*/
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
return errors && errorLogger->hasErrors();
|
||||
}
|
||||
|
||||
void CheckUnusedFunctions::unusedFunctionError(ErrorLogger * const errorLogger,
|
||||
|
|
|
@ -191,6 +191,8 @@ private:
|
|||
*/
|
||||
virtual void reportErr(const ErrorLogger::ErrorMessage &msg);
|
||||
|
||||
virtual bool hasErrors() const { return exitcode > 0; }
|
||||
|
||||
/**
|
||||
* @brief Information about progress is directed here.
|
||||
*
|
||||
|
|
|
@ -331,6 +331,12 @@ public:
|
|||
*/
|
||||
virtual void reportErr(const ErrorLogger::ErrorMessage &msg) = 0;
|
||||
|
||||
/**
|
||||
* Returns true if an error has been reported which should
|
||||
* cause a non-zero cppcheck exit code.
|
||||
*/
|
||||
virtual bool hasErrors() const { return false; }
|
||||
|
||||
/**
|
||||
* Report progress to client
|
||||
* @param filename main file that is checked
|
||||
|
|
|
@ -77,11 +77,7 @@ private:
|
|||
// Check for unused functions..
|
||||
CheckUnusedFunctions checkUnusedFunctions(&tokenizer, &settings, this);
|
||||
checkUnusedFunctions.parseTokens(tokenizer, "someFile.c", &settings);
|
||||
// check() returns error if and only if errout is not empty.
|
||||
if (checkUnusedFunctions.check(this, settings))
|
||||
ASSERT(errout.str() != "");
|
||||
else
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
ASSERT(!checkUnusedFunctions.check(this, settings));
|
||||
}
|
||||
|
||||
void incondition() {
|
||||
|
|
Loading…
Reference in New Issue