BIND 10 #613: Address CppCheck issues

BIND 10 Development do-not-reply at isc.org
Mon Feb 28 09:17:46 UTC 2011


#613: Address CppCheck issues
-------------------------------------+-------------------------------------
                 Reporter:  stephen  |                Owner:  jinmei
                     Type:  defect   |               Status:  reviewing
                 Priority:  major    |            Milestone:  A-Team-
                Component:           |  Sprint-20110309
  Unclassified                       |           Resolution:
                 Keywords:           |            Sensitive:  0
Estimated Number of Hours:  3.0      |  Add Hours to Ticket:  0
                Billable?:  1        |          Total Hours:  0
                Internal?:  0        |
-------------------------------------+-------------------------------------
Changes (by vorner):

 * owner:  vorner => jinmei


Comment:

 Hello

 May I ask for missingInclude to be included in the suppress list? For some
 reason, my cppcheck is unable to find all kinds of system libraries (even
 when the compiler finds them) and spams the output with uninteresting
 complains.

 Also, I got this output:
 {{{
 src/bin/auth/main.cc:185: check_fail: Variable 'dns_service' is allocated
 memory that is never used (style,unusedVariable)
 src/lib/asiolink/tests/io_service_unittest.cc:62: check_fail: Variable
 'dns_service' is allocated memory that is never used
 (style,unusedVariable)
 src/lib/asiolink/tests/io_service_unittest.cc:73: check_fail: Variable
 'dns_service' is allocated memory that is never used
 (style,unusedVariable)
 src/lib/asiolink/tests/io_service_unittest.cc:84: check_fail: Variable
 'dns_service' is allocated memory that is never used
 (style,unusedVariable)
 src/lib/asiolink/tests/io_service_unittest.cc:95: check_fail: Variable
 'dns_service' is allocated memory that is never used
 (style,unusedVariable)
 src/lib/asiolink/tests/io_service_unittest.cc:105: check_fail: Variable
 'dns_service' is allocated memory that is never used
 (style,unusedVariable)
 src/lib/dns/tests/name_unittest.cc:293: check_fail: Redundant assignment
 of "copy" to itself (warning,selfAssignment)
 src/lib/dns/tests/tsigkey_unittest.cc:105: check_fail: Redundant
 assignment of "copy" to itself (warning,selfAssignment)
 }}}

 The dns_service ones are most probably false alarms.

 From the point of changes, I don't like this much:
 {{{
 -    copy = copy;
 -    EXPECT_EQ(0, copy.compare(rdata_unknown));
 +    // Self assignment (via a reference to silence cppcheck)
 +    generic::Generic& copyref(copy);
 +    copyref = copy;
 +    EXPECT_EQ(0, copyref.compare(rdata_unknown));
 }}}

 We shouldn't make our code harder to read just to make some tool whose
 purpose is to help writing better code silent.

 Also, why are some local includes (from local directory) changed to
 search-list ones, even when the header resides in the same directory? That
 might turn out to be ambiguous and some local includes are left anyway, so
 it's not because of consistency either.

 Also, what is the benefit of using a vector instead of constant-size array
 as a buffer which size doesn't change?

 Thanks.

-- 
Ticket URL: <https://bind10.isc.org/ticket/613#comment:7>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list