* No need to check smart pointers, since they take template arguments * Fix #7375 static_assert shouldn't be reported by --check-library
This commit is contained in:
parent
b31e40f578
commit
49117f5aeb
|
@ -608,10 +608,10 @@ void CheckFunctions::checkLibraryMatchFunctions()
|
|||
else if (insideNew)
|
||||
continue;
|
||||
|
||||
if (!Token::Match(tok, "%name% (") || Token::Match(tok, "asm|sizeof|catch"))
|
||||
if (tok->isKeyword() || !Token::Match(tok, "%name% ("))
|
||||
continue;
|
||||
|
||||
if (tok->varId() != 0 || tok->type() || tok->isStandardType() || tok->isControlFlowKeyword())
|
||||
if (tok->varId() != 0 || tok->type() || tok->isStandardType())
|
||||
continue;
|
||||
|
||||
if (tok->linkAt(1)->strAt(1) == "(")
|
||||
|
@ -630,9 +630,6 @@ void CheckFunctions::checkLibraryMatchFunctions()
|
|||
if (mSettings->library.functions.find(functionName) != mSettings->library.functions.end())
|
||||
continue;
|
||||
|
||||
if (mSettings->library.smartPointers.find(functionName) != mSettings->library.smartPointers.end())
|
||||
continue;
|
||||
|
||||
const Token* start = tok;
|
||||
while (Token::Match(start->tokAt(-2), "%name% ::"))
|
||||
start = start->tokAt(-2);
|
||||
|
|
|
@ -1813,6 +1813,20 @@ private:
|
|||
"}");
|
||||
TODO_ASSERT_EQUALS("", "[test.cpp:6]: (information) --check-library: There is no matching configuration for function cb()\n", errout.str());
|
||||
|
||||
// #7375
|
||||
check("void f() {\n"
|
||||
" struct S { int i; char c; };\n"
|
||||
" size_t s = sizeof(S);\n"
|
||||
" static_assert(s == 9);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(char) {}\n"
|
||||
"void g() {\n"
|
||||
" f(int8_t(1));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
settings.severity = severity_old;
|
||||
settings.checkLibrary = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue