Fix ticket #563 (set variable id for **p)
http://sourceforge.net/apps/trac/cppcheck/ticket/563
This commit is contained in:
parent
5087dc6b46
commit
80953633ee
|
@ -248,10 +248,6 @@ void CheckBufferOverrun::checkScope(const Token *tok, const char *varname[], con
|
|||
else
|
||||
continue;
|
||||
|
||||
/** @todo this condition should be redundant, the variable id should never be 0 for variables */
|
||||
if (counter_varid == 0)
|
||||
continue;
|
||||
|
||||
if (Token::Match(tok2, "%varid% < %num% ;", counter_varid))
|
||||
{
|
||||
max_counter_value = MathLib::toString<long>(atol(tok2->strAt(2)) - 1);
|
||||
|
|
|
@ -2292,6 +2292,14 @@ bool Tokenizer::simplifyVarDecl()
|
|||
tok2 = NULL;
|
||||
}
|
||||
|
||||
else if (Token::Match(tok2, "%type% * * %var% ,|="))
|
||||
{
|
||||
if (tok2->tokAt(3)->str() != "operator")
|
||||
tok2 = tok2->tokAt(4); // The ',' token
|
||||
else
|
||||
tok2 = NULL;
|
||||
}
|
||||
|
||||
else if (Token::Match(tok2, "%type% * const %var% ,|="))
|
||||
{
|
||||
if (tok2->tokAt(3)->str() != "operator")
|
||||
|
|
|
@ -1040,6 +1040,14 @@ private:
|
|||
ASSERT_EQUALS(" void foo ( ) { char * a ; char * b ; delete a ; delete b ; }", sizeof_(code));
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "void foo()\n"
|
||||
"{\n"
|
||||
" char **a, **b, **c;\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS(" void foo ( ) { char * * a ; char * * b ; char * * c ; }", sizeof_(code));
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "int f()\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue