Skip to content

Commit 692083a

Browse files
committed
Fix
1 parent a51ab1e commit 692083a

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/forwardanalyzer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,12 @@ namespace {
208208
bool checkThen, checkElse;
209209
std::tie(checkThen, checkElse) = evalCond(condTok);
210210
if (!checkThen && !checkElse) {
211+
const bool oldAnalyzeOnly = analyzeOnly;
211212
if (!traverseUnknown && stopOnCondition(condTok) && stopUpdates()) {
212-
if (tok->str() == "?")
213-
analyzeOnly = false;
214213
return Progress::Continue;
215214
}
215+
if (tok->str() == "?")
216+
analyzeOnly = oldAnalyzeOnly;
216217
checkThen = true;
217218
checkElse = true;
218219
}

test/testnullpointer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3372,7 +3372,7 @@ class TestNullPointer : public TestFixture {
33723372
" if (!p) {}\n"
33733373
" return q ? p->x : 0;\n"
33743374
"}");
3375-
TODO_ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (warning) Either the condition '!p' is redundant or there is possible null pointer dereference: p.\n", "", errout_str());
3375+
ASSERT_EQUALS("[test.cpp:2:9] -> [test.cpp:3:16]: (warning) Either the condition '!p' is redundant or there is possible null pointer dereference: p. [nullPointerRedundantCheck]\n", errout_str());
33763376

33773377
check("int f(ABC *p) {\n" // FP : return &&
33783378
" if (!p) {}\n"

0 commit comments

Comments
 (0)