Commit c1a0b11d authored by Mukund Sivaraman's avatar Mukund Sivaraman

[master] Move cppcheck suppressions to the source files (inline)

This fixes a cppcheck regression introduced in commit
48cfa00b (I think), which caused line
numbers to change.
parent 1a4d0ae6
......@@ -79,7 +79,7 @@ report-coverage: report-cpp-coverage report-python-coverage
# for static C++ check using cppcheck (when available)
cppcheck:
cppcheck --enable=all --suppressions src/cppcheck-suppress.lst \
cppcheck --enable=all --suppressions src/cppcheck-suppress.lst --inline-suppr \
--quiet --error-exitcode=1 \
--template '{file}:{line}: check_fail: {message} ({severity},{id})' \
src
......
......@@ -2,21 +2,12 @@
// 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:61
// Intentional self-comparisons
duplicateExpression:src/lib/dns/tests/name_unittest.cc:569
duplicateExpression:src/lib/dns/tests/name_unittest.cc:580
duplicateExpression:src/lib/dns/tests/rrttl_unittest.cc:164
duplicateExpression:src/lib/dns/tests/rrttl_unittest.cc:175
duplicateExpression:src/lib/dns/tests/name_unittest.cc:568
duplicateExpression:src/lib/dns/tests/name_unittest.cc:579
// Intentional self-comparisons
uselessCallsCompare:src/lib/dns/tests/rdata_dhcid_unittest.cc:96
uselessCallsCompare:src/lib/dns/tests/rdata_in_a_unittest.cc:98
uselessCallsCompare:src/lib/dns/tests/rdata_in_aaaa_unittest.cc:94
uselessCallsCompare:src/lib/dns/tests/rdata_mx_unittest.cc:104
uselessCallsCompare:src/lib/dns/tests/rdata_unittest.cc:254
uselessCallsCompare:src/lib/dns/tests/rdata_unittest.cc:253
// Please don't add any suppressions here. We now use inline
// suppressions (in the .cc files) so that we don't have to
// maintain line numbers in this file.
//
// See the cppcheck manual for syntax. It is something like:
//
// // cppcheck-suppress duplicateExpression
// EXPECT_FALSE(small_name < small_name);
......@@ -58,6 +58,7 @@ MyType::toWire(AbstractMessageRenderer& renderer) const {
int
MyType::compare(const Rdata& other) const {
// The compare method normally begins with this dynamic cast.
// cppcheck-suppress unreadVariable
const MyType& other_mytype = dynamic_cast<const MyType&>(other);
// ...
}
......
......@@ -575,6 +575,7 @@ TEST_F(NameTest, lthan) {
EXPECT_TRUE(small_name < large_name);
EXPECT_FALSE(small_name.lthan(small_name));
// cppcheck-suppress duplicateExpression
EXPECT_FALSE(small_name < small_name);
EXPECT_FALSE(large_name.lthan(small_name));
......@@ -586,6 +587,7 @@ TEST_F(NameTest, gthan) {
EXPECT_TRUE(large_name > small_name);
EXPECT_FALSE(large_name.gthan(large_name));
// cppcheck-suppress duplicateExpression
EXPECT_FALSE(large_name > large_name);
EXPECT_FALSE(small_name.gthan(large_name));
......
......@@ -93,6 +93,7 @@ TEST_F(Rdata_DHCID_Test, getDHCIDDigest) {
TEST_F(Rdata_DHCID_Test, compare) {
// trivial case: self equivalence
// cppcheck-suppress uselessCallsCompare
EXPECT_EQ(0, rdata_dhcid.compare(rdata_dhcid));
in::DHCID rdata_dhcid1("0YLQvtC/0L7Qu9GPINC00LLQsCDRgNGD0LHQu9GP");
......
......@@ -95,6 +95,7 @@ TEST_F(Rdata_IN_A_Test, compare) {
in::A large2("4.3.2.1");
// trivial case: self equivalence
// cppcheck-suppress uselessCallsCompare
EXPECT_EQ(0, small1.compare(small1));
// confirm these are compared as unsigned values
......
......@@ -91,6 +91,7 @@ TEST_F(Rdata_IN_AAAA_Test, compare) {
in::AAAA large2("8:7:6:5:4:3:2:1");
// trivial case: self equivalence
// cppcheck-suppress uselessCallsCompare
EXPECT_EQ(0, small1.compare(small1));
// confirm these are compared as unsigned values
......
......@@ -101,6 +101,7 @@ TEST_F(Rdata_MX_Test, compare) {
generic::MX large2(256, Name("mx.example.com"));
// trivial case: self equivalence
// cppcheck-suppress uselessCallsCompare
EXPECT_EQ(0, small1.compare(small1));
// confirm these are compared as unsigned values
......
......@@ -250,6 +250,7 @@ TEST_F(Rdata_Unknown_Test, toWireRenderer) {
TEST_F(Rdata_Unknown_Test, compare) {
// comparison as left-justified unsigned octet sequences:
// cppcheck-suppress uselessCallsCompare
EXPECT_EQ(0, rdata_unknown.compare(rdata_unknown));
generic::Generic rdata_unknown_small("\\# 4 00b2c3ff");
......
......@@ -161,6 +161,7 @@ TEST_F(RRTTLTest, lthan) {
EXPECT_TRUE(ttl_small < ttl_large);
EXPECT_FALSE(ttl_small.lthan(ttl_small));
// cppcheck-suppress duplicateExpression
EXPECT_FALSE(ttl_small < ttl_small);
EXPECT_FALSE(ttl_large.lthan(ttl_small));
......@@ -172,6 +173,7 @@ TEST_F(RRTTLTest, gthan) {
EXPECT_TRUE(ttl_large > ttl_small);
EXPECT_FALSE(ttl_large.gthan(ttl_large));
// cppcheck-suppress duplicateExpression
EXPECT_FALSE(ttl_large > ttl_large);
EXPECT_FALSE(ttl_small.gthan(ttl_large));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment