From de1a91f30d2aa5923b97326079ea4bb31b0374f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 23 Dec 2014 18:19:33 +0100 Subject: [PATCH] Incomplete statement: tweaked bailout for '(void*)0' using isCasted() --- lib/checkother.cpp | 4 ++-- test/testincompletestatement.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 9295a0995..8fc49c78d 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1733,8 +1733,8 @@ void CheckOther::checkIncompleteStatement() if (Token::Match(tok->next(), "%num% [,.]")) continue; - // No warning for [;{}] 0 ; - if (Token::Match(tok, "[;{}] 0 ;")) + // No warning for [;{}] (void *) 0 ; + if (Token::Match(tok, "[;{}] 0 ;") && tok->next()->isCasted()) continue; // bailout if there is a "? :" in this statement diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index f1b43f223..d75982eef 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -152,7 +152,7 @@ private: } void void0() { // #6327 - check("void f() { 0; }"); + check("void f() { (void*)0; }"); ASSERT_EQUALS("", errout.str()); }