Fixed #7243 (False positive unknownEvaluationOrder - comma operator inside while-clause)
This commit is contained in:
parent
5a28bce631
commit
79aec559d5
|
@ -2534,6 +2534,9 @@ void CheckOther::checkEvaluationOrder()
|
|||
// not function => break
|
||||
if (!(par && par->str() == "(" && par->astOperand2()))
|
||||
break;
|
||||
// control flow (if|while|etc) => break
|
||||
if (Token::simpleMatch(par->link(),") {"))
|
||||
break;
|
||||
// sequence point in function argument: dostuff((1,2),3) => break
|
||||
par = par->next();
|
||||
while (par && (par->previous() != parent))
|
||||
|
|
|
@ -6127,6 +6127,12 @@ private:
|
|||
" return dostuff(++exp, exp, 10);\n"
|
||||
"}", "test.c");
|
||||
ASSERT_EQUALS("[test.c:2]: (error) Expression '++exp,exp' depends on order of evaluation of side effects\n", errout.str());
|
||||
|
||||
check("void f() {\n"
|
||||
" int a;\n"
|
||||
" while (a=x(), a==123) {}\n"
|
||||
"}", "test.c");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void testEvaluationOrderSelfAssignment() {
|
||||
|
|
Loading…
Reference in New Issue