Fixed #4975 (False positive: (warning) %s in format string (no. 3) requires a char* given in the argument list. (git/column.c))

This commit is contained in:
Robert Reif 2013-08-25 08:32:10 +02:00 committed by Daniel Marjamäki
parent 3c6ca35e09
commit 3d9383aabb
2 changed files with 9 additions and 2 deletions

View File

@ -793,8 +793,8 @@ bool CheckIO::getArgumentInfo(const Token * tok, const Variable **var, const Tok
tok1 = tok1->link();
else if (tok1->str() == "<" && tok1->link())
tok1 = tok1->link();
else if (tok1->str() == ";")
break;
else if (!(tok1->str() == "." || tok1->type() == Token::eVariable || tok1->type() == Token::eFunction))
return false;
}
if (varTok) {

View File

@ -948,6 +948,13 @@ private:
"[test.cpp:2]: (warning) %f in format string (no. 3) requires a floating point number given in the argument list.\n"
"[test.cpp:2]: (warning) %lf in format string (no. 4) requires a floating point number given in the argument list.\n"
"[test.cpp:2]: (warning) %p in format string (no. 5) requires an address given in the argument list.\n", errout.str());
// #4975
check("void f(int len, int newline) {\n"
" printf(\"%s\", newline ? a : str + len);\n"
" printf(\"%s\", newline + newline);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void testPosixPrintfScanfParameterPosition() { // #4900 - No support for parameters in format strings