From 62a11f6490f016a4e76da53281e8f6fd5d1748de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 18 Dec 2020 20:41:10 +0100 Subject: [PATCH] Bug hunting; Fixed timeout --- lib/exprengine.cpp | 8 ++------ lib/settings.cpp | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 9cc525879..52a2e9fef 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -2428,9 +2428,7 @@ static std::string execute(const Token *start, const Token *end, Data &data) }; Recursion updateRecursion(&data.recursion, data.recursion); - const std::time_t stopTime = (data.settings->bugHuntingCheckFunctionMaxTime > 0) ? - (data.startTime + data.settings->bugHuntingCheckFunctionMaxTime) : - ~0ULL; + const std::time_t stopTime = data.startTime + data.settings->bugHuntingCheckFunctionMaxTime; for (const Token *tok = start; tok != end; tok = tok->next()) { if (Token::Match(tok, "[;{}]")) { @@ -2856,9 +2854,7 @@ void ExprEngine::executeFunction(const Scope *functionScope, ErrorLogger *errorL data.contractConstraints(function, executeExpression1); - const std::time_t stopTime = (data.settings->bugHuntingCheckFunctionMaxTime > 0) ? - (data.startTime + data.settings->bugHuntingCheckFunctionMaxTime) : - ~0ULL; + const std::time_t stopTime = data.startTime + data.settings->bugHuntingCheckFunctionMaxTime; try { execute(functionScope->bodyStart, functionScope->bodyEnd, data); diff --git a/lib/settings.cpp b/lib/settings.cpp index 815eea9d9..b7d15b9b0 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -31,7 +31,7 @@ const char Settings::SafeChecks::XmlExternalVariables[] = "external-variables"; Settings::Settings() : mEnabled(0), bugHunting(false), - bugHuntingCheckFunctionMaxTime(0), + bugHuntingCheckFunctionMaxTime(INT_MAX), checkAllConfigurations(true), checkConfiguration(false), checkHeaders(true),