Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3557,7 +3557,7 @@ void CheckOther::checkVarFuncNullUB()
for (const Scope * scope : symbolDatabase->functionScopes) {
for (const Token* tok = scope->bodyStart; tok != scope->bodyEnd; tok = tok->next()) {
// Is NULL passed to a function?
if (Token::Match(tok,"[(,] NULL [,)]")) {
if (Token::Match(tok,"[(,] NULL )")) {
// Locate function name in this function call.
const Token *ftok = tok;
int argnr = 1;
Expand Down
6 changes: 6 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11295,6 +11295,12 @@ class TestOther : public TestFixture {
check("void a(char *p, ...);\n"
"void b() { a(NULL, 2); }");
ASSERT_EQUALS("", errout_str());

checkP("extern const int sentinel;\n"
"void a(int, ...);\n"
"#define b(x, ...) a((x), __VA_ARGS__, &sentinel)\n"
"void c() { b(1, NULL); }");
ASSERT_EQUALS("", errout_str());
}

void checkCastIntToCharAndBack() { // #160
Expand Down
Loading