From 6363c1359d8c8c4564ae76a2c55c5ca9167e0553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 17 Feb 2015 18:16:29 +0100 Subject: [PATCH] TestUninitVar: moved out posix.cfg testing --- test/cfg/posix.c | 10 ++++++++++ test/testuninitvar.cpp | 17 ----------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/test/cfg/posix.c b/test/cfg/posix.c index b1d4f372f..6b9381e95 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -125,3 +125,13 @@ void uninitvar(int fd) { // cppcheck-suppress uninitvar write(fd,"ab",x); } + +void uninitvar_types(void) { + blkcnt_t b; + // cppcheck-suppress uninitvar + return b; + + dirent d; + // cppcheck-suppress uninitvar + return d.d_ino; +} diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index aa497b22d..e3759715c 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -75,8 +75,6 @@ private: TEST_CASE(syntax_error); // Ticket #5073 - TEST_CASE(uninitvar_posix_types); - // dead pointer TEST_CASE(deadPointer); } @@ -3915,21 +3913,6 @@ private: "}"); ASSERT_EQUALS("[test.cpp:7]: (error) Dead pointer usage. Pointer 'former_hover' is dead if it has been assigned '&item' at line 5.\n", errout.str()); } - - void uninitvar_posix_types() { - checkUninitVarB("blkcnt_t* f() {blkcnt_t *b; return b;}"); - ASSERT_EQUALS("[test.cpp:1]: (error) Uninitialized variable: b\n", errout.str()); - - checkUninitVarB("blkcnt_t f() {blkcnt_t b; return b;}"); - ASSERT_EQUALS("[test.cpp:1]: (error) Uninitialized variable: b\n", errout.str()); - - // dirent - checkUninitVarB("char f() { dirent d; return d.d_name[0]; }"); - ASSERT_EQUALS("[test.cpp:1]: (error) Uninitialized variable: d\n", errout.str()); - - checkUninitVarB("ino_t f2() { dirent d; return d.d_ino; }"); - ASSERT_EQUALS("[test.cpp:1]: (error) Uninitialized variable: d\n", errout.str()); - } }; REGISTER_TEST(TestUninitVar)