From e723ef0569b3a3707122901508e9ab0585f8bfdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 16 Dec 2011 18:04:10 +0100 Subject: [PATCH] Uninitialized variables: Fix false positives for '= { .. }'. Ticket: #3369 --- lib/checkuninitvar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index fe8a4a32d..56dc764cf 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -1123,6 +1123,10 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const unsigned int } } + // skip = { .. } + if (Token::simpleMatch(tok, "= {")) + tok = tok->next()->link(); + // TODO: handle loops, try, etc if (tok->str() == "for" || Token::simpleMatch(tok, ") {") || Token::Match(tok, "%var% {")) { return true;