Skip to content

Commit 256f3c3

Browse files
Update testincompletestatement.cpp
1 parent 84bf3bf commit 256f3c3

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

test/testincompletestatement.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,25 @@ class TestIncompleteStatement : public TestFixture {
180180
}
181181

182182
void void0() { // #6327
183-
check("void f() { (void*)0; }");
183+
check("#define assert(x) ((void)0)\n"
184+
"void f(int* p) {\n"
185+
" assert(p);\n"
186+
"}\n");
184187
ASSERT_EQUALS("", errout_str());
185188

189+
check("void f() { (void*)0; }");
190+
ASSERT_EQUALS("[test.cpp:1:12]: (warning) Redundant code: Found a statement that begins with numeric constant. [constStatement]\n", errout_str());
191+
192+
check("void f() {\n" // #13148
193+
" static_cast<void>(1);\n"
194+
" static_cast<void>(nullptr);\n"
195+
" (void)NULL;\n"
196+
"}\n");
197+
ASSERT_EQUALS("[test.cpp:2:22]: (warning) Redundant code: Found a statement that begins with numeric constant. [constStatement]\n"
198+
"[test.cpp:3:22]: (warning) Redundant code: Found a statement that begins with NULL constant. [constStatement]\n"
199+
"[test.cpp:4:5]: (warning) Redundant code: Found a statement that begins with NULL constant. [constStatement]\n",
200+
errout_str());
201+
186202
check("#define X 0\n"
187203
"void f() { X; }");
188204
ASSERT_EQUALS("", errout_str());

0 commit comments

Comments
 (0)