From e508950f4f0b4b6a8347c96fc66d62f77203fd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 15 May 2020 11:25:56 +0200 Subject: [PATCH] ExprEngine; Activate bug hunting analysis for uninitialized variables/data. This analysis is pretty experimental right now. --- lib/exprengine.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 8f469ec19..eec6924ca 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -2189,7 +2189,6 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, }; #endif -#ifdef BUG_HUNTING_UNINIT std::function uninit = [=](const Token *tok, const ExprEngine::Value &value, ExprEngine::DataBase *dataBase) { if (!tok->astParent()) return; @@ -2253,7 +2252,6 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingUninit", "Cannot determine that '" + tok->expressionString() + "' is initialized", CWE_USE_OF_UNINITIALIZED_VARIABLE, false); errorLogger->reportErr(errmsg); }; -#endif std::function checkFunctionCall = [=](const Token *tok, const ExprEngine::Value &value, ExprEngine::DataBase *dataBase) { if (!Token::Match(tok->astParent(), "[(,]")) @@ -2353,7 +2351,6 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, } } -#ifdef BUG_HUNTING_UNINIT // Uninitialized function argument.. if (settings->library.isuninitargbad(parent->astOperand1(), num) && settings->library.isnullargbad(parent->astOperand1(), num) && value.type == ExprEngine::ValueType::ArrayValue) { const ExprEngine::ArrayValue &arrayValue = static_cast(value); @@ -2368,7 +2365,6 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, } } } -#endif }; std::function checkAssignment = [=](const Token *tok, const ExprEngine::Value &value, ExprEngine::DataBase *dataBase) { @@ -2410,9 +2406,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, #ifdef BUG_HUNTING_INTEGEROVERFLOW callbacks.push_back(integerOverflow); #endif -#ifdef BUG_HUNTING_UNINIT callbacks.push_back(uninit); -#endif std::ostringstream report; ExprEngine::executeAllFunctions(errorLogger, tokenizer, settings, callbacks, report);