Fixed #2234 (Variable is assigned a value that is never used)
This commit is contained in:
parent
ad91f414db
commit
0a744c0c6e
|
@ -4489,10 +4489,14 @@ void Tokenizer::simplifyCompoundAssignment()
|
|||
{
|
||||
// variable..
|
||||
tok = tok->tokAt(2);
|
||||
while (Token::Match(tok, ". %var%") || (tok && tok->str() == "["))
|
||||
while (Token::Match(tok, ". %var%") ||
|
||||
(tok && tok->str() == "[") ||
|
||||
Token::simpleMatch(tok, "( )"))
|
||||
{
|
||||
if (tok->str() != "[")
|
||||
tok = tok->tokAt(2);
|
||||
else if (tok->str() == "(")
|
||||
tok = tok->tokAt(2);
|
||||
else
|
||||
{
|
||||
// goto "]"
|
||||
|
|
|
@ -4708,6 +4708,8 @@ private:
|
|||
ASSERT_EQUALS(";", tokenizeAndStringify(";x |= 0;"));
|
||||
ASSERT_EQUALS(";", tokenizeAndStringify(";x *= 1;"));
|
||||
ASSERT_EQUALS(";", tokenizeAndStringify(";x /= 1;"));
|
||||
|
||||
ASSERT_EQUALS("; a . x ( ) = a . x ( ) + 1 ;", tokenizeAndStringify("; a.x() += 1;"));
|
||||
}
|
||||
|
||||
void simplifyAssignmentInFunctionCall()
|
||||
|
|
Loading…
Reference in New Issue