Browse Source

[trac613] canceled the workaround change for 'selfassignment' in tests.
exclude these warnings in the suppress list instead.
also added some comments about the suppress list.

JINMEI Tatuya 14 years ago
parent
commit
be8886364d

+ 11 - 2
src/cppcheck-suppress.lst

@@ -1,5 +1,14 @@
+// On some systems cppcheck produces false alarms about 'missing includes'.
+// the following two will suppress, depending on the cppcheck version
+debug
+missingInclude
+// This is a template, and should be excluded from the check
 unreadVariable:src/lib/dns/rdata/template.cc:59
+// These two trigger warnings due to the incomplete implementation.  This is
+// our problem, but we need to suppress the warnings for now.
 functionConst:src/lib/cache/message_cache.h
 functionConst:src/lib/cache/rrset_cache.h
-debug
-missingInclude
+// Intentional self assignment tests.  Suppress warning about them.
+selfAssignment:src/lib/dns/tests/name_unittest.cc:292
+selfAssignment:src/lib/dns/tests/rdata_unittest.cc:227
+selfAssignment:src/lib/dns/tests/tsigkey_unittest.cc:104

+ 3 - 4
src/lib/dns/tests/name_unittest.cc

@@ -288,10 +288,9 @@ TEST_F(NameTest, assignment) {
     delete copy2;
     EXPECT_EQ(copy3, example_name);
 
-    // Self assignment (via a reference to silence cppcheck)
-    Name& copyref(copy);
-    copyref = copy;
-    EXPECT_EQ(example_name, copyref);
+    // Self assignment
+    copy = copy;
+    EXPECT_EQ(example_name, copy);
 }
 
 TEST_F(NameTest, toText) {

+ 3 - 4
src/lib/dns/tests/rdata_unittest.cc

@@ -223,10 +223,9 @@ TEST_F(Rdata_Unknown_Test, assignment) {
     delete copy2;
     EXPECT_EQ(0, copy3.compare(rdata_unknown));
 
-    // Self assignment (via a reference to silence cppcheck)
-    generic::Generic& copyref(copy);
-    copyref = copy;
-    EXPECT_EQ(0, copyref.compare(rdata_unknown));
+    // Self assignment
+    copy = copy;
+    EXPECT_EQ(0, copy.compare(rdata_unknown));
 }
 
 TEST_F(Rdata_Unknown_Test, toText) {

+ 3 - 4
src/lib/dns/tests/tsigkey_unittest.cc

@@ -100,10 +100,9 @@ TEST_F(TSIGKeyTest, assignment) {
     delete copy2;
     compareTSIGKeys(original, copy3);
 
-    // self assignment (via a reference to silence cppcheck)
-    TSIGKey& copyref(copy);
-    copyref = copy;
-    compareTSIGKeys(original, copyref);
+    // self assignment
+    copy = copy;
+    compareTSIGKeys(original, copy);
 }
 
 class TSIGKeyRingTest : public ::testing::Test {