Correct exit code when there are no unmatched suppressions
This commit is contained in:
parent
4b37f276c2
commit
4119cfd3d1
|
@ -914,13 +914,15 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
|
|||
|
||||
if (settings.jointSuppressionReport && !settings.checkLibrary) {
|
||||
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
|
||||
reportUnmatchedSuppressions(settings.nomsg.getUnmatchedLocalSuppressions(i->first, enableUnusedFunctionCheck));
|
||||
if (returnValue == 0)
|
||||
const bool err = reportUnmatchedSuppressions(settings.nomsg.getUnmatchedLocalSuppressions(i->first, enableUnusedFunctionCheck));
|
||||
if (err && returnValue == 0)
|
||||
returnValue = settings.exitCode;
|
||||
}
|
||||
}
|
||||
|
||||
reportUnmatchedSuppressions(settings.nomsg.getUnmatchedGlobalSuppressions(enableUnusedFunctionCheck));
|
||||
const bool err = reportUnmatchedSuppressions(settings.nomsg.getUnmatchedGlobalSuppressions(enableUnusedFunctionCheck));
|
||||
if (err && returnValue == 0)
|
||||
returnValue = settings.exitCode;
|
||||
}
|
||||
|
||||
if (!settings.checkConfiguration) {
|
||||
|
|
|
@ -536,7 +536,7 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string
|
|||
return result;
|
||||
}
|
||||
|
||||
void ErrorLogger::reportUnmatchedSuppressions(const std::list<Suppressions::Suppression> &unmatched)
|
||||
bool ErrorLogger::reportUnmatchedSuppressions(const std::list<Suppressions::Suppression> &unmatched)
|
||||
{
|
||||
// Report unmatched suppressions
|
||||
for (const Suppressions::Suppression &s : unmatched) {
|
||||
|
|
|
@ -368,10 +368,11 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Report list of unmatched suppressions
|
||||
* Report unmatched suppressions
|
||||
* @param unmatched list of unmatched suppressions (from Settings::Suppressions::getUnmatched(Local|Global)Suppressions)
|
||||
* @return true is returned if errors are reported
|
||||
*/
|
||||
void reportUnmatchedSuppressions(const std::list<Suppressions::Suppression> &unmatched);
|
||||
bool reportUnmatchedSuppressions(const std::list<Suppressions::Suppression> &unmatched);
|
||||
|
||||
static std::string callStackToString(const std::list<ErrorLogger::ErrorMessage::FileLocation> &callStack);
|
||||
|
||||
|
|
Loading…
Reference in New Issue