CheckOther::checkRedundantAssignment(): Bail out on inline assembly (#6525)
This commit is contained in:
parent
f04070940e
commit
5f31242ee8
|
@ -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% (")) {
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue