diff --git a/lib/bughuntingchecks.cpp b/lib/bughuntingchecks.cpp index 4dac08a20..c97a3172d 100644 --- a/lib/bughuntingchecks.cpp +++ b/lib/bughuntingchecks.cpp @@ -250,6 +250,8 @@ static void uninit(const Token *tok, const ExprEngine::Value &value, ExprEngine: return; if (uninitData && argvar && !argvar->isConst()) return; + if (!uninitStructMember.empty() && dataBase->isC() && argvar && !argvar->isConst()) + return; } else if (uninitData) { if (dataBase->settings->library.getFunction(parent->astOperand1())) return; diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 62716bf8a..b38cda6b3 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -371,6 +371,9 @@ namespace { int recursion; std::time_t startTime; + bool isC() const OVERRIDE { return tokenizer->isC(); } + bool isCPP() const OVERRIDE { return tokenizer->isCPP(); } + ExprEngine::ValuePtr executeContract(const Function *function, ExprEngine::ValuePtr(*executeExpression)(const Token*, Data&)) { const auto it = settings->functionContracts.find(function->fullName()); if (it == settings->functionContracts.end()) diff --git a/lib/exprengine.h b/lib/exprengine.h index c10fc2914..52574a8ee 100644 --- a/lib/exprengine.h +++ b/lib/exprengine.h @@ -79,6 +79,8 @@ namespace ExprEngine { virtual std::string getNewSymbolName() = 0; const std::string currentFunction; const Settings * const settings; + virtual bool isC() const = 0; + virtual bool isCPP() const = 0; virtual void reportError(const Token *tok, Severity::SeverityType severity, const char id[], diff --git a/test/bug-hunting/itc.py b/test/bug-hunting/itc.py index a5f0f3f6d..df9c79abb 100644 --- a/test/bug-hunting/itc.py +++ b/test/bug-hunting/itc.py @@ -36,8 +36,6 @@ def get_error_lines(filename): if testfile.find('uninit_') >= 0: if linenr == 177: linenr = 176 - elif linenr == 200: - linenr = 225 # warn about function call elif linenr == 241: linenr = 242 # warn about usage elif linenr == 266: