Evaluation order: ignore usage in sizeof
This commit is contained in:
parent
e9635fd393
commit
908bc664a4
|
@ -2537,6 +2537,8 @@ void CheckOther::checkEvaluationOrder()
|
||||||
continue;
|
continue;
|
||||||
if (tok3->str() == "&" && !tok3->astOperand2())
|
if (tok3->str() == "&" && !tok3->astOperand2())
|
||||||
continue; // don't handle adress-of for now
|
continue; // don't handle adress-of for now
|
||||||
|
if (tok3->str() == "(" && Token::simpleMatch(tok3->previous(), "sizeof"))
|
||||||
|
continue; // don't care about sizeof usage
|
||||||
tokens.push(tok3->astOperand1());
|
tokens.push(tok3->astOperand1());
|
||||||
tokens.push(tok3->astOperand2());
|
tokens.push(tok3->astOperand2());
|
||||||
if (isSameExpression(_tokenizer->isCPP(), false, tok->astOperand1(), tok3, _settings->library.functionpure)) {
|
if (isSameExpression(_tokenizer->isCPP(), false, tok->astOperand1(), tok3, _settings->library.functionpure)) {
|
||||||
|
|
|
@ -6143,6 +6143,12 @@ private:
|
||||||
"}", "test.c");
|
"}", "test.c");
|
||||||
TODO_ASSERT_EQUALS("error", "", errout.str());
|
TODO_ASSERT_EQUALS("error", "", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sizeof
|
||||||
|
check("void f(char *buf) {\n"
|
||||||
|
" dostuff(buf++, sizeof(*buf));"
|
||||||
|
"}", "test.c");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue