Fixed #7242 (False positive unknownEvaluationOrder - comma expression in function argument)

This commit is contained in:
Daniel Marjamäki 2015-12-29 12:06:42 +01:00
parent 83cb028963
commit bd1037e95b
2 changed files with 12 additions and 0 deletions

View File

@ -2512,6 +2512,12 @@ void CheckOther::checkEvaluationOrder()
// not function => break
if (!(par && par->str() == "(" && par->astOperand2()))
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())
break;

View File

@ -6165,6 +6165,12 @@ private:
" dostuff(t=1,t^c);\n"
"}", "test.c");
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() {