parent
e6091cbe54
commit
ca4e5ac527
|
@ -1386,6 +1386,8 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * arg, const Settings *settings,
|
|||
for (int p = 0; p < valuetype->pointer; p++)
|
||||
tempToken->insertToken("*");
|
||||
tempToken = const_cast<Token*>(typeToken);
|
||||
if (top->isBinaryOp() && valuetype->pointer == 1 && (valuetype->type == ValueType::CHAR || valuetype->type == ValueType::WCHAR_T))
|
||||
tempToken->tokType(Token::eString);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2113,6 +2113,11 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:3]: (warning) %s in format string (no. 1) requires a 'char *' but the argument type is 'const char *'.\n"
|
||||
"[test.cpp:3]: (warning) scanf() without field width limits can crash with huge input data.\n", errout.str());
|
||||
}
|
||||
|
||||
check("void f() {\n" // #7038
|
||||
" scanf(\"%i\", \"abc\" + 1);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) %i in format string (no. 1) requires 'int *' but the argument type is 'const char *'.\n", errout.str());
|
||||
}
|
||||
|
||||
void testPrintfArgument() {
|
||||
|
|
Loading…
Reference in New Issue