Fix issue 9001: FP: Found suspicious operator ',' [constStatement]

This commit is contained in:
Paul Fultz II 2019-02-27 07:09:22 +01:00 committed by Daniel Marjamäki
parent 9d75b718d3
commit 032020c40d
2 changed files with 10 additions and 1 deletions

View File

@ -1374,7 +1374,7 @@ static bool isConstStatement(const Token *tok)
if (Token::Match(tok, "%var%"))
return true;
if (Token::Match(tok, "*|&|&&") &&
(Token::Match(tok->previous(), "::|.") || isVarDeclOp(tok)))
(Token::Match(tok->previous(), "::|.|const|volatile|restrict") || isVarDeclOp(tok)))
return false;
if (Token::Match(tok, "<<|>>") && !astIsIntegral(tok, false))
return false;

View File

@ -356,6 +356,15 @@ private:
check("void f() { std::vector<b> &&c; }", true);
ASSERT_EQUALS("", errout.str());
check("void f() { char * const * a, * const * b; }", true);
ASSERT_EQUALS("", errout.str());
check("void f() { char * const * a = 0, * volatile restrict * b; }", true);
ASSERT_EQUALS("", errout.str());
check("void f() { char * const * a = 0, * volatile const * b; }", true);
ASSERT_EQUALS("", errout.str());
}
};