]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Drop cppcheck workarounds
authorMichal Nowak <mnowak@isc.org>
Tue, 30 Nov 2021 15:31:48 +0000 (16:31 +0100)
committerMichal Nowak <mnowak@isc.org>
Tue, 14 Dec 2021 14:03:56 +0000 (15:03 +0100)
As cppcheck was removed from the CI, associated workarounds and
suppressions are not required anymore.

.dir-locals.el
bin/dnssec/dnssectool.h
lib/dns/rbt.c
lib/dns/rdata/in_1/wks_11.c
lib/dns/tsig.c
lib/isc/include/isc/refcount.h
lib/isc/include/isc/util.h
lib/isccfg/aclconf.c
lib/ns/client.c
util/suppressions.txt [deleted file]

index 9c8d101f7f788c8a63adf1e33afdbdaf10a47109..1871abc8cbc77a49eb62b53435cc57f187c7c9a7 100644 (file)
          "--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")))
          )
index 7694f362c0e4835b7c283677aa3defce76259527..8830eb760324e6b1dc8b87f39969b630362279f9 100644 (file)
@@ -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);
index fa311094310af3710cee37d51a118f1e8e0973e4..4f28423527823f1bd2d5ab0db09ee0136691cf4d 100644 (file)
@@ -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");
                }
index b837c55920145b0c5cbfc4a2e1b1b1ee3420eda9..cba10249af5edfbe124ba53c827499cfa198877f 100644 (file)
 #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;
index 7f7d4b7d7c0c966f046c7d803687a4d44eb42e88..0e840c693cc01663d1656546ec245d887ee0b47e 100644 (file)
@@ -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);
        }
index 043ee4d0a45794c804d1fa2a88353d8f8a1e86f2..66df3c9f180cb0bd57b2515ace1fb76a3e157655 100644 (file)
@@ -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);                           \
index 65ac46c4f13cdb01186e437eaf87dba847e775de..ab8115658cf488cd19aa8fcb4d5a951b634f042b 100644 (file)
@@ -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 */
 
index e74fa3b9183fafafff856308bd53285729db00c2..3c1cead3a8d439a75342cf8f6fd1cb146203dcee 100644 (file)
@@ -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,
index f598387729dc236914abf6788287ea59b42bf255..5eab55c0e37db7def2f9642b4fda4855daf892af 100644 (file)
@@ -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);
                        }
diff --git a/util/suppressions.txt b/util/suppressions.txt
deleted file mode 100644 (file)
index 27aa9b6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-unmatchedSuppression:*
-preprocessorErrorDirective:*
-unknownMacro:*
-nullPointerRedundantCheck:*