Ticket #7445: Properly represent integer types smaller than int in CheckIO::ArgumentInfo.
This commit is contained in:
parent
18fc288de9
commit
12a298b9cd
|
@ -1389,9 +1389,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings,
|
|||
tempToken->insertToken("a");
|
||||
tempToken = tempToken->next();
|
||||
}
|
||||
if (valuetype->pointer == 0U && valuetype->type <= ValueType::INT)
|
||||
tempToken->str("int");
|
||||
else if (valuetype->type == ValueType::BOOL)
|
||||
if (valuetype->type == ValueType::BOOL)
|
||||
tempToken->str("bool");
|
||||
else if (valuetype->type == ValueType::CHAR)
|
||||
tempToken->str("char");
|
||||
|
|
|
@ -2187,6 +2187,12 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:9]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'int'.\n"
|
||||
"[test.cpp:9]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'float'.\n", errout.str());
|
||||
|
||||
// Ticket #7445
|
||||
check("struct S { unsigned short x; } s = {0};\n"
|
||||
"void foo() {\n"
|
||||
" printf(\"%d\", s.x);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void testPosixPrintfScanfParameterPosition() { // #4900 - No support for parameters in format strings
|
||||
|
|
Loading…
Reference in New Issue