--check-library: Report unconfigured scoped functions also
This commit is contained in:
parent
2a6fbe2e3c
commit
a1053dd7dd
|
@ -413,21 +413,33 @@ void CheckFunctions::checkLibraryMatchFunctions()
|
||||||
if (!_settings->checkLibrary || !_settings->isEnabled(Settings::INFORMATION))
|
if (!_settings->checkLibrary || !_settings->isEnabled(Settings::INFORMATION))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool New = false;
|
||||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
|
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
|
||||||
if (Token::Match(tok, "%name% (") &&
|
if (!tok->scope() || !tok->scope()->isExecutable())
|
||||||
!Token::Match(tok, "for|if|while|switch|sizeof|catch|asm|return") &&
|
continue;
|
||||||
!tok->function() &&
|
|
||||||
!tok->varId() &&
|
if (tok->str() == "new")
|
||||||
!tok->type() &&
|
New = true;
|
||||||
!tok->isStandardType() &&
|
else if (tok->str() == ";")
|
||||||
tok->linkAt(1)->strAt(1) != "(" &&
|
New = false;
|
||||||
!Token::simpleMatch(tok->astParent(), "new") &&
|
else if (New)
|
||||||
tok->astParent() == tok->next() &&
|
continue;
|
||||||
_settings->library.isNotLibraryFunction(tok)) {
|
|
||||||
reportError(tok,
|
if (!Token::Match(tok, "%name% (") || Token::Match(tok, "for|if|while|switch|sizeof|catch|asm|return"))
|
||||||
Severity::information,
|
continue;
|
||||||
"checkLibraryFunction",
|
|
||||||
"--check-library: There is no matching configuration for function " + _settings->library.getFunctionName(tok) + "()");
|
if (tok->varId() != 0 || tok->type() || tok->isStandardType())
|
||||||
}
|
continue;
|
||||||
|
|
||||||
|
if (tok->linkAt(1)->strAt(1) == "(")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!_settings->library.isNotLibraryFunction(tok))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
reportError(tok,
|
||||||
|
Severity::information,
|
||||||
|
"checkLibraryFunction",
|
||||||
|
"--check-library: There is no matching configuration for function " + _settings->library.getFunctionName(tok) + "()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue