Fixed #7242 (False positive unknownEvaluationOrder - comma expression in function argument)
This commit is contained in:
parent
83cb028963
commit
bd1037e95b
|
@ -2512,6 +2512,12 @@ void CheckOther::checkEvaluationOrder()
|
||||||
// not function => break
|
// not function => break
|
||||||
if (!(par && par->str() == "(" && par->astOperand2()))
|
if (!(par && par->str() == "(" && par->astOperand2()))
|
||||||
break;
|
break;
|
||||||
|
// sequence point in function argument: dostuff((1,2),3) => break
|
||||||
|
par = par->next();
|
||||||
|
while (par && (par->previous() != parent))
|
||||||
|
par = par->nextArgument();
|
||||||
|
if (!par)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (parent->str() == "(" && parent->astOperand2())
|
if (parent->str() == "(" && parent->astOperand2())
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -6165,6 +6165,12 @@ private:
|
||||||
" dostuff(t=1,t^c);\n"
|
" dostuff(t=1,t^c);\n"
|
||||||
"}", "test.c");
|
"}", "test.c");
|
||||||
ASSERT_EQUALS("[test.c:3]: (error) Expression 't=1,t^c' depends on order of evaluation of side effects\n", errout.str());
|
ASSERT_EQUALS("[test.c:3]: (error) Expression 't=1,t^c' depends on order of evaluation of side effects\n", errout.str());
|
||||||
|
|
||||||
|
check("void f(void) {\n"
|
||||||
|
" int t;\n"
|
||||||
|
" dostuff((t=1,t),2);\n"
|
||||||
|
"}", "test.c");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void testEvaluationOrderSizeof() {
|
void testEvaluationOrderSizeof() {
|
||||||
|
|
Loading…
Reference in New Issue