ExprEngine; Activate bug hunting analysis for uninitialized variables/data. This analysis is pretty experimental right now.
This commit is contained in:
parent
275c8e84d2
commit
e508950f4f
|
@ -2189,7 +2189,6 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef BUG_HUNTING_UNINIT
|
||||
std::function<void(const Token *, const ExprEngine::Value &, ExprEngine::DataBase *)> 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<void(const Token *, const ExprEngine::Value &, ExprEngine::DataBase *)> 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<const ExprEngine::ArrayValue &>(value);
|
||||
|
@ -2368,7 +2365,6 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
std::function<void(const Token *, const ExprEngine::Value &, ExprEngine::DataBase *)> 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);
|
||||
|
|
Loading…
Reference in New Issue