From 379440e2a4469a2876725dbff555ec20affe2e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 28 Dec 2011 08:17:58 +0100 Subject: [PATCH] CheckNullPointer: Use Tokenizer::IsScopeNoReturn --- lib/checknullpointer.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index c64f97c8b..051e1f3d6 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -894,6 +894,16 @@ void CheckNullPointer::nullPointerByCheckAndDeRef() break; --indentlevel; + // calling exit function? + bool unknown = false; + if (_tokenizer->IsScopeNoReturn(tok2, &unknown)) + { + if (_settings->inconclusive && unknown) + inconclusive = true; + else + break; + } + if (null && indentlevel == 0) { // skip all "else" blocks because they are not executed in this execution path while (Token::simpleMatch(tok2, "} else {")) @@ -912,10 +922,6 @@ void CheckNullPointer::nullPointerByCheckAndDeRef() break; } - if (Token::Match(tok2, "exit ( %num% ) ;")) { - break; - } - // parameters to sizeof are not dereferenced if (Token::Match(tok2, "decltype|sizeof")) { if (tok2->strAt(1) != "(")