You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -3373,7 +3375,7 @@ class TestNullPointer : public TestFixture {
3373
3375
" if (!p) {}\n"
3374
3376
" return q ? p->x : 0;\n"
3375
3377
"}");
3376
-
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());
3378
+
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());
3377
3379
3378
3380
check("int f(ABC *p) {\n"// FP : return &&
3379
3381
" if (!p) {}\n"
@@ -3393,6 +3395,20 @@ class TestNullPointer : public TestFixture {
3393
3395
" pointer = func(sizeof pointer[0]);\n"
3394
3396
"}");
3395
3397
ASSERT_EQUALS("", errout_str());
3398
+
3399
+
check("struct T {\n"// #14164
3400
+
" T* next;\n"
3401
+
" char op;\n"
3402
+
"};\n"
3403
+
"void h(int, char);\n"
3404
+
"void g(const T* tok, bool b) {\n"
3405
+
" if (tok->op == '<') {\n"
3406
+
" while ((tok = tok->next) && tok->op != '>') {}\n"
3407
+
" }\n"
3408
+
" h(b ? 1 : 0, tok->op);\n"
3409
+
"}\n");
3410
+
ASSERT_EQUALS("[test.cpp:8:21] -> [test.cpp:10:18]: (warning) Either the condition 'tok=tok->next' is redundant or there is possible null pointer dereference: tok. [nullPointerRedundantCheck]\n",
0 commit comments