Skip to content

Commit a39a247

Browse files
committed
Travis: Fixed false positive in lib/checkbufferoverrun. Ticket: cppcheck-opensource#4486
1 parent 1de54ba commit a39a247

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

lib/check64bit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void Check64BitPortability::pointerassignment()
6565
continue;
6666

6767
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
68-
if (Token::Match(tok, "return %var%|%num% [;+]")) {
68+
if (Token::Match(tok, "return %var%|%num% [;+]") && !Token::simpleMatch(tok, "return 0 ;")) {
6969
enum { NO, INT, PTR, PTRDIFF } type = NO;
7070
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
7171
if ((type == NO || type == INT) && isaddr(tok2->variable()))

test/test64bit.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ class Test64BitPortability : public TestFixture {
151151
"}\n");
152152
ASSERT_EQUALS("", errout.str());
153153

154+
check("void* foo() {\n"
155+
" return 0;\n"
156+
"}\n");
157+
ASSERT_EQUALS("", errout.str());
158+
154159
check("int foo(int i) {\n"
155160
" return i;\n"
156161
"}\n");

0 commit comments

Comments
 (0)