Uninitialized variables: fixed FP when there are function calls where type* is converted to unknown_type
This commit is contained in:
parent
f381058293
commit
f16c30248a
|
@ -1378,7 +1378,7 @@ bool CheckUninitVar::isVariableUsage(const Scope* scope, const Token *vartok, bo
|
|||
const Token *argStart = arg->typeStartToken();
|
||||
while (argStart->previous() && argStart->previous()->isName())
|
||||
argStart = argStart->previous();
|
||||
if (Token::Match(argStart, "const| %type% %var% [,)]"))
|
||||
if (!address && Token::Match(argStart, "const| %type% %var% [,)]"))
|
||||
return true;
|
||||
if (Token::Match(argStart, "const %type% & %var% [,)]"))
|
||||
return true;
|
||||
|
|
|
@ -2408,6 +2408,13 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar2("void a(pstr s);\n" // address => no error
|
||||
"void b() {\n"
|
||||
" char c;\n"
|
||||
" a(&c);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar2("void a(const char *c);\n" // const address => error
|
||||
"void b() {\n"
|
||||
" char c;\n"
|
||||
|
|
Loading…
Reference in New Issue