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