From 6ee32943f2506e21f89b183dd502dc08141ab2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 1 Jan 2013 13:56:37 +0100 Subject: [PATCH] tools/reduce: speedup, terminate checking when error is found --- tools/reduce.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/reduce.cpp b/tools/reduce.cpp index a94b873c6..0adc239ba 100644 --- a/tools/reduce.cpp +++ b/tools/reduce.cpp @@ -20,19 +20,25 @@ public: , cppcheck(*this,false) , line(':' + l + ']') , foundLine(false) { - cppcheck.settings().addEnabled("all"); - cppcheck.settings().inconclusive = true; } bool run(const char filename[]) { foundLine = false; + Settings settings; + settings.addEnabled("all"); + settings.inconclusive = true; + settings._force = true; + cppcheck.settings() = settings; cppcheck.check(filename); return foundLine; } void reportOut(const std::string &outmsg) { } 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) { } };