CheckIO: Handle library types

This commit is contained in:
Daniel Marjamäki 2014-06-12 07:01:44 +02:00
parent 977af89fa9
commit 86ef5f8ae7
2 changed files with 7 additions and 1 deletions

View File

@ -652,7 +652,7 @@ void CheckIO::checkWrongPrintfScanfArguments()
// Perform type checks
ArgumentInfo argInfo(argListTok, _settings);
if (argInfo.typeToken) {
if (argInfo.typeToken && !argInfo.isLibraryType(_settings)) {
if (scan) {
std::string specifier;
bool done = false;
@ -1618,6 +1618,11 @@ bool CheckIO::ArgumentInfo::isKnownType() const
return typeToken->isStandardType() || Token::Match(typeToken, "std :: string|wstring");
}
bool CheckIO::ArgumentInfo::isLibraryType(const Settings *settings) const
{
return typeToken && typeToken->isStandardType() && settings->library.podtype(typeToken->str());
}
void CheckIO::wrongPrintfScanfArgumentsError(const Token* tok,
const std::string &functionName,
unsigned int numFormat,

View File

@ -78,6 +78,7 @@ private:
bool isKnownType() const;
bool isStdVectorOrString();
bool isStdContainer(const Token *tok);
bool isLibraryType(const Settings *settings) const;
const Variable *variableInfo;
const Token *typeToken;