From d4e3e7e20109cfc326b9b85c6c4dfad6470818be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 27 Dec 2010 21:18:36 +0100 Subject: [PATCH] Fixed #2367 (false positive: (error) Uninitialized variable: s) --- lib/checkuninitvar.cpp | 2 +- test/testuninitvar.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 32072b402..0e73d66d0 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -649,7 +649,7 @@ private: --parlevel; } - else if (Token::simpleMatch(tok2, "sizeof (")) + else if (Token::Match(tok2, "sizeof|typeof (")) { tok2 = tok2->next()->link(); if (!tok2) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index c23e67bdc..b69a977cd 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -1400,6 +1400,12 @@ private: " typeof(fred->x);\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + checkUninitVar("void f() {\n" + " struct SData * s;\n" + " ab(typeof(s->status));\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } };