Fixed #2584 (false positive 'variable n is never used')
This commit is contained in:
parent
f6872a7008
commit
54e0b60cc5
|
@ -4712,7 +4712,7 @@ void Tokenizer::simplifyCompoundAssignment()
|
||||||
// "a+=b" => "a = a + b"
|
// "a+=b" => "a = a + b"
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
if (Token::Match(tok, "[;{}:] *| (| %var%"))
|
if (Token::Match(tok, "[;{}] (") || Token::Match(tok, "[;{}:] *| (| %var%"))
|
||||||
{
|
{
|
||||||
if (tok->str() == ":")
|
if (tok->str() == ":")
|
||||||
{
|
{
|
||||||
|
|
|
@ -5196,6 +5196,7 @@ private:
|
||||||
ASSERT_EQUALS("{ x = x >> y ; }", tokenizeAndStringify("{ x >>= y;}"));
|
ASSERT_EQUALS("{ x = x >> y ; }", tokenizeAndStringify("{ x >>= y;}"));
|
||||||
|
|
||||||
ASSERT_EQUALS("; * p = * p + y ;", tokenizeAndStringify("; *p += y;"));
|
ASSERT_EQUALS("; * p = * p + y ;", tokenizeAndStringify("; *p += y;"));
|
||||||
|
ASSERT_EQUALS("; ( * p ) = ( * p ) + y ;", tokenizeAndStringify("; (*p) += y;"));
|
||||||
ASSERT_EQUALS("; * ( p [ 0 ] ) = * ( p [ 0 ] ) + y ;", tokenizeAndStringify("; *(p[0]) += y;"));
|
ASSERT_EQUALS("; * ( p [ 0 ] ) = * ( p [ 0 ] ) + y ;", tokenizeAndStringify("; *(p[0]) += y;"));
|
||||||
|
|
||||||
ASSERT_EQUALS("case 0 : x = x + y ; break ;", tokenizeAndStringify("case 0: x += y; break;"));
|
ASSERT_EQUALS("case 0 : x = x + y ; break ;", tokenizeAndStringify("case 0: x += y; break;"));
|
||||||
|
|
Loading…
Reference in New Issue