null pointer: Fixed better error message for 'possible null pointer' + removed redundant check in our Tokenizer.
This commit is contained in:
parent
4407aabe55
commit
6ca4b008d0
|
@ -1187,7 +1187,7 @@ void CheckOther::nullPointerLinkedList()
|
|||
// Is this variable a pointer?
|
||||
const Token *tempTok = Token::findmatch(_tokenizer->tokens(), "%type% * %varid% [;)=]", varid);
|
||||
if (tempTok)
|
||||
nullPointerError(tok1, varname);
|
||||
nullPointerError(tok1, varname, tok3->linenr());
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -850,7 +850,7 @@ void Tokenizer::simplifyTypedef()
|
|||
if (tok2->str() != "}")
|
||||
{
|
||||
int level = 0;
|
||||
while (tok2 && tok2->next() && (tok2->next()->str() != "}" || level))
|
||||
while (tok2->next() && (tok2->next()->str() != "}" || level))
|
||||
{
|
||||
if (tok2->next()->str() == "{")
|
||||
level++;
|
||||
|
|
|
@ -670,7 +670,7 @@ private:
|
|||
" tok = tok->next();\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: tok\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: tok - otherwise it is redundant to check if tok is null at line 5\n", errout.str());
|
||||
|
||||
checkNullPointer("void foo(Token &tok)\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue