CheckOther::checkRedundantAssignment(): Bail out on inline assembly (#6525)

This commit is contained in:
PKEuS 2015-02-22 12:03:53 +01:00
parent f04070940e
commit 5f31242ee8
2 changed files with 9 additions and 1 deletions

View File

@ -614,7 +614,7 @@ void CheckOther::checkRedundantAssignment()
memAssignments.clear(); memAssignments.clear();
} else if (Token::Match(tok, "for|if|while (")) { } else if (Token::Match(tok, "for|if|while (")) {
tok = tok->linkAt(1); tok = tok->linkAt(1);
} else if (Token::Match(tok, "break|return|continue|throw|goto")) { } else if (Token::Match(tok, "break|return|continue|throw|goto|asm")) {
varAssignments.clear(); varAssignments.clear();
memAssignments.clear(); memAssignments.clear();
} else if (tok->type() == Token::eVariable && !Token::Match(tok, "%name% (")) { } else if (tok->type() == Token::eVariable && !Token::Match(tok, "%name% (")) {

View File

@ -5450,6 +5450,14 @@ private:
" s->foo[s->x++] = 2;\n" " s->foo[s->x++] = 2;\n"
" s->d[1].fc.i++;\n" " s->d[1].fc.i++;\n"
"}"); "}");
// #6525 - inline assembly
check("void f(int i) {\n"
" i = 1;\n"
" asm(\"foo\");\n"
" i = 1;\n"
"}");
ASSERT_EQUALS("", errout.str());
} }
void redundantMemWrite() { void redundantMemWrite() {