Bug hunting; Fixed timeout

This commit is contained in:
Daniel Marjamäki 2020-12-18 20:41:10 +01:00
parent 1b0ca0811f
commit 62a11f6490
2 changed files with 3 additions and 7 deletions

View File

@ -2428,9 +2428,7 @@ static std::string execute(const Token *start, const Token *end, Data &data)
}; };
Recursion updateRecursion(&data.recursion, data.recursion); Recursion updateRecursion(&data.recursion, data.recursion);
const std::time_t stopTime = (data.settings->bugHuntingCheckFunctionMaxTime > 0) ? const std::time_t stopTime = data.startTime + data.settings->bugHuntingCheckFunctionMaxTime;
(data.startTime + data.settings->bugHuntingCheckFunctionMaxTime) :
~0ULL;
for (const Token *tok = start; tok != end; tok = tok->next()) { for (const Token *tok = start; tok != end; tok = tok->next()) {
if (Token::Match(tok, "[;{}]")) { if (Token::Match(tok, "[;{}]")) {
@ -2856,9 +2854,7 @@ void ExprEngine::executeFunction(const Scope *functionScope, ErrorLogger *errorL
data.contractConstraints(function, executeExpression1); data.contractConstraints(function, executeExpression1);
const std::time_t stopTime = (data.settings->bugHuntingCheckFunctionMaxTime > 0) ? const std::time_t stopTime = data.startTime + data.settings->bugHuntingCheckFunctionMaxTime;
(data.startTime + data.settings->bugHuntingCheckFunctionMaxTime) :
~0ULL;
try { try {
execute(functionScope->bodyStart, functionScope->bodyEnd, data); execute(functionScope->bodyStart, functionScope->bodyEnd, data);

View File

@ -31,7 +31,7 @@ const char Settings::SafeChecks::XmlExternalVariables[] = "external-variables";
Settings::Settings() Settings::Settings()
: mEnabled(0), : mEnabled(0),
bugHunting(false), bugHunting(false),
bugHuntingCheckFunctionMaxTime(0), bugHuntingCheckFunctionMaxTime(INT_MAX),
checkAllConfigurations(true), checkAllConfigurations(true),
checkConfiguration(false), checkConfiguration(false),
checkHeaders(true), checkHeaders(true),