From a39a2479da6f603451645910d7cdb4e11cb0e6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 4 Feb 2013 19:02:42 +0100 Subject: [PATCH] Travis: Fixed false positive in lib/checkbufferoverrun. Ticket: #4486 --- lib/check64bit.cpp | 2 +- test/test64bit.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/check64bit.cpp b/lib/check64bit.cpp index 81fc94610..65018177b 100644 --- a/lib/check64bit.cpp +++ b/lib/check64bit.cpp @@ -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())) diff --git a/test/test64bit.cpp b/test/test64bit.cpp index 2919ddc8f..22eb6ba1f 100644 --- a/test/test64bit.cpp +++ b/test/test64bit.cpp @@ -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");