From 0c086cf247bf6f5307e6193af3942fb4ebd4985b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 24 Dec 2014 21:47:37 +0100 Subject: [PATCH] Incomplete statement: tweaked bailout for '0;' statement using isExpandedMacro() --- lib/checkother.cpp | 2 +- test/testincompletestatement.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 5e230b1c8..a48d1eba6 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1734,7 +1734,7 @@ void CheckOther::checkIncompleteStatement() continue; // No warning for [;{}] (void *) 0 ; - if (Token::Match(tok, "[;{}] 0 ;") && tok->next()->isCast()) + if (Token::Match(tok, "[;{}] 0 ;") && (tok->next()->isCast() || tok->next()->isExpandedMacro())) continue; // bailout if there is a "? :" in this statement diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index d75982eef..16c01b1ec 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -154,6 +154,9 @@ private: void void0() { // #6327 check("void f() { (void*)0; }"); ASSERT_EQUALS("", errout.str()); + + check("void f() { $0; }"); + ASSERT_EQUALS("", errout.str()); } void intarray() {