Merge pull request #2688 from jpyllman/fix_chklibfunc

not report locally declared functions as missing configuration of --check-library
This commit is contained in:
Daniel Marjamäki 2020-06-27 06:53:09 +02:00 committed by GitHub
commit c3749625f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -436,6 +436,9 @@ void CheckFunctions::checkLibraryMatchFunctions()
if (tok->linkAt(1)->strAt(1) == "(") if (tok->linkAt(1)->strAt(1) == "(")
continue; continue;
if (tok->function())
continue;
if (!mSettings->library.isNotLibraryFunction(tok)) if (!mSettings->library.isNotLibraryFunction(tok))
continue; continue;

View File

@ -364,15 +364,11 @@ public:
void MacroTest2_test() void MacroTest2_test()
{ {
// TODO: remove suppression when #9002 is fixed
// cppcheck-suppress checkLibraryFunction
QString str = MacroTest2::tr("hello"); QString str = MacroTest2::tr("hello");
QByteArray ba = str.toLatin1(); QByteArray ba = str.toLatin1();
printf(ba.data()); printf(ba.data());
#ifndef QT_NO_DEPRECATED #ifndef QT_NO_DEPRECATED
// TODO: remove suppression when #9002 is fixed
// cppcheck-suppress checkLibraryFunction
str = MacroTest2::trUtf8("test2"); str = MacroTest2::trUtf8("test2");
ba = str.toLatin1(); ba = str.toLatin1();
printf(ba.data()); printf(ba.data());

View File

@ -3882,7 +3882,6 @@ void valid_vsprintf_helper(const char * format, ...)
void valid_vsprintf() void valid_vsprintf()
{ {
// buffer will contain "2\0" => no bufferAccessOutOfBounds // buffer will contain "2\0" => no bufferAccessOutOfBounds
// cppcheck-suppress checkLibraryFunction
// cppcheck-suppress checkLibraryNoReturn // cppcheck-suppress checkLibraryNoReturn
valid_vsprintf_helper("%1.0f", 2.0f); valid_vsprintf_helper("%1.0f", 2.0f);
} }