From cefa695dba0835a16e4a1cc518c981a78a0e8703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 13 Jan 2010 19:37:55 +0100 Subject: [PATCH] Fixed #1265 ((error) Uninitialized variable on macro expansion) --- lib/executionpath.cpp | 4 +--- test/testother.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/executionpath.cpp b/lib/executionpath.cpp index 99b759572..f99aeaf1c 100644 --- a/lib/executionpath.cpp +++ b/lib/executionpath.cpp @@ -140,11 +140,9 @@ static const Token *checkExecutionPaths_(const Token *tok, std::listtokAt(2)->link(); - if (Token::Match(tok, "= {") || Token::Match(tok, "= ( %type% !!=")) + if (Token::Match(tok, "= {")) { tok = tok->next()->link(); - if (Token::simpleMatch(tok, ") {")) - tok = tok->next()->link(); if (!tok) { ExecutionPath::bailOut(checks); diff --git a/test/testother.cpp b/test/testother.cpp index 4202c3655..f95436579 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1209,6 +1209,14 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + checkUninitVar("void f()\n" + "{\n" + " int c;\n" + " a = (f2(&c));\n" + " c++;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + // += checkUninitVar("void f()\n" "{\n"