mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
Drop cppcheck workarounds
As cppcheck was removed from the CI, associated workarounds and suppressions are not required anymore.
This commit is contained in:
parent
654cc61bb9
commit
9c013f37d0
@ -106,8 +106,9 @@
|
||||
"--enable=all"
|
||||
"--suppress=missingIncludeSystem"
|
||||
"--suppress=nullPointerRedundantCheck"
|
||||
(concat "--suppressions-list=" (expand-file-name
|
||||
(concat directory-of-current-dir-locals-file "util/suppressions.txt")))
|
||||
"--suppress=preprocessorErrorDirective"
|
||||
"--suppress=unknownMacro"
|
||||
"--suppress=unmatchedSuppression"
|
||||
(concat "-include=" (expand-file-name
|
||||
(concat directory-of-current-dir-locals-file "config.h")))
|
||||
)
|
||||
|
@ -41,12 +41,8 @@ extern uint8_t dtype[8];
|
||||
|
||||
typedef void(fatalcallback_t)(void);
|
||||
|
||||
#ifndef CPPCHECK
|
||||
ISC_NORETURN void
|
||||
fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
|
||||
#else /* CPPCHECK */
|
||||
#define fatal(...) exit(1)
|
||||
#endif
|
||||
|
||||
void
|
||||
setfatalcallback(fatalcallback_t *callback);
|
||||
|
@ -2135,8 +2135,6 @@ deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp) {
|
||||
* Fix color violations.
|
||||
*/
|
||||
if (IS_BLACK(item)) {
|
||||
/* cppcheck-suppress nullPointerRedundantCheck symbolName=item
|
||||
*/
|
||||
parent = PARENT(item);
|
||||
|
||||
while (child != *rootp && IS_BLACK(child)) {
|
||||
@ -2154,8 +2152,6 @@ deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp) {
|
||||
|
||||
INSIST(sibling != NULL);
|
||||
|
||||
/* cppcheck-suppress nullPointerRedundantCheck
|
||||
* symbolName=sibling */
|
||||
if (IS_BLACK(LEFT(sibling)) &&
|
||||
IS_BLACK(RIGHT(sibling))) {
|
||||
MAKE_RED(sibling);
|
||||
@ -2192,8 +2188,6 @@ deletefromlevel(dns_rbtnode_t *item, dns_rbtnode_t **rootp) {
|
||||
|
||||
INSIST(sibling != NULL);
|
||||
|
||||
/* cppcheck-suppress nullPointerRedundantCheck
|
||||
* symbolName=sibling */
|
||||
if (IS_BLACK(LEFT(sibling)) &&
|
||||
IS_BLACK(RIGHT(sibling))) {
|
||||
MAKE_RED(sibling);
|
||||
@ -2328,7 +2322,6 @@ check_properties_helper(dns_rbtnode_t *node) {
|
||||
}
|
||||
}
|
||||
|
||||
/* cppcheck-suppress nullPointerRedundantCheck symbolName=node */
|
||||
if ((DOWN(node) != NULL) && (!IS_ROOT(DOWN(node)))) {
|
||||
return (false);
|
||||
}
|
||||
@ -2366,17 +2359,14 @@ check_black_distance_helper(dns_rbtnode_t *node, size_t *distance) {
|
||||
return (true);
|
||||
}
|
||||
|
||||
/* cppcheck-suppress nullPointerRedundantCheck symbolName=node */
|
||||
if (!check_black_distance_helper(LEFT(node), &dl)) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
/* cppcheck-suppress nullPointerRedundantCheck symbolName=node */
|
||||
if (!check_black_distance_helper(RIGHT(node), &dr)) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
/* cppcheck-suppress nullPointerRedundantCheck symbolName=node */
|
||||
if (!check_black_distance_helper(DOWN(node), &dd)) {
|
||||
return (false);
|
||||
}
|
||||
@ -2474,10 +2464,6 @@ print_text_helper(dns_rbtnode_t *root, dns_rbtnode_t *parent, int depth,
|
||||
|
||||
if (root != NULL) {
|
||||
printnodename(root, true, f);
|
||||
/*
|
||||
* Don't use IS_RED(root) as it tests for 'root != NULL'
|
||||
* and cppcheck produces false positives.
|
||||
*/
|
||||
fprintf(f, " (%s, %s", direction,
|
||||
COLOR(root) == RED ? "RED" : "BLACK");
|
||||
|
||||
@ -2503,19 +2489,12 @@ print_text_helper(dns_rbtnode_t *root, dns_rbtnode_t *parent, int depth,
|
||||
|
||||
depth++;
|
||||
|
||||
/*
|
||||
* Don't use IS_RED(root) as it tests for 'root != NULL'
|
||||
* and cppcheck produces false positives.
|
||||
*/
|
||||
if (COLOR(root) == RED && IS_RED(LEFT(root))) {
|
||||
fprintf(f, "** Red/Red color violation on left\n");
|
||||
}
|
||||
print_text_helper(LEFT(root), root, depth, "left", data_printer,
|
||||
f);
|
||||
|
||||
/*
|
||||
* Don't use IS_RED(root) as cppcheck produces false positives.
|
||||
*/
|
||||
if (COLOR(root) == RED && IS_RED(RIGHT(root))) {
|
||||
fprintf(f, "** Red/Red color violation on right\n");
|
||||
}
|
||||
|
@ -19,18 +19,6 @@
|
||||
#include <isc/netdb.h>
|
||||
#include <isc/once.h>
|
||||
|
||||
/*
|
||||
* Redefine CHECK here so cppcheck "sees" the define.
|
||||
*/
|
||||
#ifndef CHECK
|
||||
#define CHECK(op) \
|
||||
do { \
|
||||
result = (op); \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
#endif /* ifndef CHECK */
|
||||
|
||||
#define RRTYPE_WKS_ATTRIBUTES (0)
|
||||
|
||||
static isc_mutex_t wks_lock;
|
||||
|
@ -1585,8 +1585,6 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) {
|
||||
* XXX Can TCP transfers be forwarded? How would that
|
||||
* work?
|
||||
*/
|
||||
/* cppcheck-suppress uninitStructMember
|
||||
* symbolName=tsig.originalid */
|
||||
id = htons(tsig.originalid);
|
||||
memmove(&header[0], &id, 2);
|
||||
}
|
||||
|
@ -76,7 +76,6 @@ isc_refcount_increment0(isc_refcount_t *target) {
|
||||
#else /* _MSC_VER */
|
||||
#define isc_refcount_increment0(target) \
|
||||
({ \
|
||||
/* cppcheck-suppress shadowVariable */ \
|
||||
uint_fast32_t __v; \
|
||||
__v = atomic_fetch_add_relaxed(target, 1); \
|
||||
INSIST(__v < UINT32_MAX); \
|
||||
@ -100,7 +99,6 @@ isc_refcount_increment(isc_refcount_t *target) {
|
||||
#else /* _MSC_VER */
|
||||
#define isc_refcount_increment(target) \
|
||||
({ \
|
||||
/* cppcheck-suppress shadowVariable */ \
|
||||
uint_fast32_t __v; \
|
||||
__v = atomic_fetch_add_relaxed(target, 1); \
|
||||
INSIST(__v > 0 && __v < UINT32_MAX); \
|
||||
@ -124,7 +122,6 @@ isc_refcount_decrement(isc_refcount_t *target) {
|
||||
#else /* _MSC_VER */
|
||||
#define isc_refcount_decrement(target) \
|
||||
({ \
|
||||
/* cppcheck-suppress shadowVariable */ \
|
||||
uint_fast32_t __v; \
|
||||
__v = atomic_fetch_sub_acq_rel(target, 1); \
|
||||
INSIST(__v > 0); \
|
||||
|
@ -266,9 +266,7 @@ mock_assert(const int result, const char *const expression,
|
||||
(((a) == (b)) ? (void)0 : (_assert_int_equal(a, b, f, l), abort()))
|
||||
#define _assert_int_not_equal(a, b, f, l) \
|
||||
(((a) != (b)) ? (void)0 : (_assert_int_not_equal(a, b, f, l), abort()))
|
||||
#else /* UNIT_TESTING */
|
||||
|
||||
#ifndef CPPCHECK
|
||||
#else /* UNIT_TESTING */
|
||||
|
||||
/*
|
||||
* Assertions
|
||||
@ -284,27 +282,6 @@ mock_assert(const int result, const char *const expression,
|
||||
/*% Invariant Assertion */
|
||||
#define INVARIANT(e) ISC_INVARIANT(e)
|
||||
|
||||
#else /* CPPCHECK */
|
||||
|
||||
/*% Require Assertion */
|
||||
#define REQUIRE(e) \
|
||||
if (!(e)) \
|
||||
abort()
|
||||
/*% Ensure Assertion */
|
||||
#define ENSURE(e) \
|
||||
if (!(e)) \
|
||||
abort()
|
||||
/*% Insist Assertion */
|
||||
#define INSIST(e) \
|
||||
if (!(e)) \
|
||||
abort()
|
||||
/*% Invariant Assertion */
|
||||
#define INVARIANT(e) \
|
||||
if (!(e)) \
|
||||
abort()
|
||||
|
||||
#endif /* CPPCHECK */
|
||||
|
||||
#endif /* UNIT_TESTING */
|
||||
|
||||
/*
|
||||
@ -326,14 +303,8 @@ mock_assert(const int result, const char *const expression,
|
||||
|
||||
#else /* UNIT_TESTING */
|
||||
|
||||
#ifndef CPPCHECK
|
||||
/*% Runtime Check */
|
||||
#define RUNTIME_CHECK(cond) ISC_ERROR_RUNTIMECHECK(cond)
|
||||
#else /* ifndef CPPCHECK */
|
||||
#define RUNTIME_CHECK(e) \
|
||||
if (!(e)) \
|
||||
abort()
|
||||
#endif /* ifndef CPPCHECK */
|
||||
|
||||
#endif /* UNIT_TESTING */
|
||||
|
||||
|
@ -128,8 +128,6 @@ convert_named_acl(const cfg_obj_t *nameobj, const cfg_obj_t *cctx,
|
||||
for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache); dacl != NULL;
|
||||
dacl = ISC_LIST_NEXT(dacl, nextincache))
|
||||
{
|
||||
/* cppcheck-suppress nullPointerRedundantCheck symbolName=dacl
|
||||
*/
|
||||
if (strcasecmp(aclname, dacl->name) == 0) {
|
||||
if (ISC_MAGIC_VALID(dacl, LOOP_MAGIC)) {
|
||||
cfg_obj_log(nameobj, lctx, ISC_LOG_ERROR,
|
||||
|
@ -1444,9 +1444,7 @@ process_ecs(ns_client_t *client, isc_buffer_t *buf, size_t optlen) {
|
||||
|
||||
if ((addrlen % 8) != 0) {
|
||||
uint8_t bits = ~0U << (8 - (addrlen % 8));
|
||||
/* cppcheck-suppress objectIndex */
|
||||
bits &= paddr[addrbytes - 1];
|
||||
/* cppcheck-suppress objectIndex */
|
||||
if (bits != paddr[addrbytes - 1]) {
|
||||
return (DNS_R_OPTERR);
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
unmatchedSuppression:*
|
||||
preprocessorErrorDirective:*
|
||||
unknownMacro:*
|
||||
nullPointerRedundantCheck:*
|
Loading…
x
Reference in New Issue
Block a user