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:
parent
3c6ca35e09
commit
3d9383aabb
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue