Travis: Fixed false positive in lib/checkbufferoverrun. Ticket: #4486

This commit is contained in:
Daniel Marjamäki 2013-02-04 19:02:42 +01:00
parent 1de54ba88e
commit a39a2479da
2 changed files with 6 additions and 1 deletions

View File

@ -65,7 +65,7 @@ void Check64BitPortability::pointerassignment()
continue;
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
if (Token::Match(tok, "return %var%|%num% [;+]")) {
if (Token::Match(tok, "return %var%|%num% [;+]") && !Token::simpleMatch(tok, "return 0 ;")) {
enum { NO, INT, PTR, PTRDIFF } type = NO;
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
if ((type == NO || type == INT) && isaddr(tok2->variable()))

View File

@ -151,6 +151,11 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
check("void* foo() {\n"
" return 0;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
check("int foo(int i) {\n"
" return i;\n"
"}\n");