tools/reduce: speedup, terminate checking when error is found

This commit is contained in:
Daniel Marjamäki 2013-01-01 13:56:37 +01:00
parent d2e8ab9c86
commit 6ee32943f2
1 changed files with 9 additions and 3 deletions

View File

@ -20,19 +20,25 @@ public:
, cppcheck(*this,false) , cppcheck(*this,false)
, line(':' + l + ']') , line(':' + l + ']')
, foundLine(false) { , foundLine(false) {
cppcheck.settings().addEnabled("all");
cppcheck.settings().inconclusive = true;
} }
bool run(const char filename[]) { bool run(const char filename[]) {
foundLine = false; foundLine = false;
Settings settings;
settings.addEnabled("all");
settings.inconclusive = true;
settings._force = true;
cppcheck.settings() = settings;
cppcheck.check(filename); cppcheck.check(filename);
return foundLine; return foundLine;
} }
void reportOut(const std::string &outmsg) { } void reportOut(const std::string &outmsg) { }
void reportErr(const ErrorLogger::ErrorMessage &msg) { void reportErr(const ErrorLogger::ErrorMessage &msg) {
foundLine |= bool(msg.toString(false).find(line) != std::string::npos); if (msg.toString(false).find(line) != std::string::npos) {
foundLine = true;
cppcheck.terminate();
}
} }
void reportProgress(const std::string &filename, const char stage[], const unsigned int value) { } void reportProgress(const std::string &filename, const char stage[], const unsigned int value) { }
}; };