]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add FALLTHROUGH macro for __attribute__((fallthrough))
authorOndřej Surý <ondrej@sury.org>
Mon, 11 Oct 2021 10:09:16 +0000 (12:09 +0200)
committerOndřej Surý <ondrej@isc.org>
Fri, 25 Mar 2022 07:33:43 +0000 (08:33 +0100)
Gcc 7+ and Clang 10+ have implemented __attribute__((fallthrough)) which
is explicit version of the /* FALLTHROUGH */ comment we are currently
using.

Add and apply FALLTHROUGH macro that uses the attribute if available,
but does nothing on older compilers.

In one case (lib/dns/zone.c), using the macro revealed that we were
using the /* FALLTHROUGH */ comment in wrong place, remove that comment.

41 files changed:
bin/check/named-checkconf.c
bin/check/named-checkzone.c
bin/dig/host.c
bin/dnssec/dnssec-dsfromkey.c
bin/dnssec/dnssec-importkey.c
bin/dnssec/dnssec-keyfromlabel.c
bin/dnssec/dnssec-keygen.c
bin/dnssec/dnssec-revoke.c
bin/dnssec/dnssec-settime.c
bin/dnssec/dnssec-signzone.c
bin/dnssec/dnssec-verify.c
bin/named/main.c
bin/named/zoneconf.c
bin/rndc/rndc.c
contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c
doc/dev/style.md
lib/bind9/getaddresses.c
lib/dns/dispatch.c
lib/dns/dnssec.c
lib/dns/dnstap.c
lib/dns/masterdump.c
lib/dns/name.c
lib/dns/rbtdb.c
lib/dns/rdata/generic/opt_41.c
lib/dns/resolver.c
lib/dns/rootns.c
lib/dns/rpz.c
lib/dns/update.c
lib/dns/validator.c
lib/dns/xfrin.c
lib/dns/zone.c
lib/isc/include/isc/util.h
lib/isc/lex.c
lib/isc/log.c
lib/isc/netmgr/netmgr.c
lib/isc/ratelimiter.c
lib/isc/siphash.c
lib/isc/tm.c
lib/isc/url.c
lib/isccfg/aclconf.c
lib/ns/query.c

index bb3fefd2edf8aa1141b511f59f9e4104efe334fa..0594ed157e34b5dfe360cf73ed24209f6d3d32e6 100644 (file)
@@ -677,7 +677,7 @@ main(int argc, char **argv) {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        usage();
 
index 793169fd42e9c63e4857b22498afb2e0a4125862..80cdfb55d38130546b5fdb2214a85bf089a6b64f 100644 (file)
@@ -426,7 +426,7 @@ main(int argc, char **argv) {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        prog_name, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        usage();
 
index 775cddf37ebb84c40258c4553ea4efbeecb07d56..f0617833d8e35c02f772007a3ca7bc97480b9a94 100644 (file)
@@ -770,7 +770,7 @@ parse_args(bool is_batchfile, int argc, char **argv) {
                        break;
                case 'A':
                        list_almost_all = true;
-               /* FALL THROUGH */
+                       FALLTHROUGH;
                case 'a':
                        if (!lookup->rdtypeset ||
                            lookup->rdtype != dns_rdatatype_axfr) {
index 05a8cd409594df2acf2d5587f26323d2614a1bde..fa3ef72d724e9147b2798a0dd9f90414ba22cb29 100644 (file)
@@ -434,14 +434,14 @@ main(int argc, char **argv) {
                        }
                        break;
                case 'F':
-               /* Reserved for FIPS mode */
-               /* FALLTHROUGH */
+                       /* Reserved for FIPS mode */
+                       FALLTHROUGH;
                case '?':
                        if (isc_commandline_option != '?') {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        /* Does not return. */
                        usage();
index 65cee0f56b0e90566ef428fb31ca3e12c022692c..6c1d2f22cdaa185f0638bf66c40d92ed99804530 100644 (file)
@@ -385,7 +385,7 @@ main(int argc, char **argv) {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        /* Does not return. */
                        usage();
index adecfa63e88c25623839f6ecaa49a6237c09ebac..233e12bc1138ae096022586fd7f9a5014ba95d3c 100644 (file)
@@ -315,14 +315,14 @@ main(int argc, char **argv) {
                        prepub = strtottl(isc_commandline_argument);
                        break;
                case 'F':
-               /* Reserved for FIPS mode */
-               /* FALLTHROUGH */
+                       /* Reserved for FIPS mode */
+                       FALLTHROUGH;
                case '?':
                        if (isc_commandline_option != '?') {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        /* Does not return. */
                        usage();
index c43c0d7dcffa8ab4a9e36631bc1a6ff393bfd583..64ad35792348d810c4edb1fce99209be4daa4a72 100644 (file)
@@ -1108,14 +1108,14 @@ main(int argc, char **argv) {
                        ctx.prepub = strtottl(isc_commandline_argument);
                        break;
                case 'F':
-               /* Reserved for FIPS mode */
-               /* FALLTHROUGH */
+                       /* Reserved for FIPS mode */
+                       FALLTHROUGH;
                case '?':
                        if (isc_commandline_option != '?') {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        /* Does not return. */
                        usage();
index b464868c3f06cfce6b9a751043648edd292f4e8b..36ee75c718a05d850a95f730e5062ce306dfc9bf 100644 (file)
@@ -119,7 +119,7 @@ main(int argc, char **argv) {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        /* Does not return. */
                        usage();
index f7f45ee6469b5b5ce63e8b6c9ed2626dd3e72118..6c78c38966556e05a9581b82578c55cd4c21ea1a 100644 (file)
@@ -342,7 +342,7 @@ main(int argc, char **argv) {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        /* Does not return. */
                        usage();
index 8fc6eee5b6c45ef778f50c19c99d4153c0f513f5..207c861a5d5e1e522557e12259f3281f9534852f 100644 (file)
@@ -3642,14 +3642,14 @@ main(int argc, char *argv[]) {
                        break;
 
                case 'F':
-               /* Reserved for FIPS mode */
-               /* FALLTHROUGH */
+                       /* Reserved for FIPS mode */
+                       FALLTHROUGH;
                case '?':
                        if (isc_commandline_option != '?') {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        /* Does not return. */
                        usage();
index 4d704e7d3860a48f70d3122e7d809098bf4bab05..ac2485775b19406c38c3a767814d0768954fa47e 100644 (file)
@@ -132,7 +132,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
                              "use -o to specify a different zone origin",
                              origin, file);
                }
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        default:
                fatal("failed loading zone from '%s': %s", file,
                      isc_result_totext(result));
@@ -262,7 +262,7 @@ main(int argc, char *argv[]) {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
 
                case 'h':
                        /* Does not return. */
index 3a2fe05732d6bc9ba352a94ad8f8c32181ba3c43..e7ed49361274b27e24b824ff5fe87b9e0b17f041 100644 (file)
@@ -860,8 +860,8 @@ parse_command_line(int argc, char *argv[]) {
                        }
                        break;
                case 'F':
-               /* Reserved for FIPS mode */
-               /* FALLTHROUGH */
+                       /* Reserved for FIPS mode */
+                       FALLTHROUGH;
                case '?':
                        usage();
                        if (isc_commandline_option == '?') {
@@ -876,7 +876,7 @@ parse_command_line(int argc, char *argv[]) {
                                                      "an argument",
                                                      isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                        named_main_earlyfatal("parsing options returned %d",
                                              ch);
index 027b7734c88ca196be51199e1ee35ef7ed55ceae..55f2f358543e44ca8baad468ebe76726b29c5477 100644 (file)
@@ -1874,7 +1874,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
                        dns_zone_setxfracl(zone, none);
                        dns_acl_detach(&none);
                }
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        case dns_zone_secondary:
        case dns_zone_stub:
        case dns_zone_redirect:
index 949ab609a30c6df9f0c3b31fbed8acb5b2504254..178120d90d887211cc51b37d32d3347362c6e761 100644 (file)
@@ -1001,7 +1001,7 @@ main(int argc, char **argv) {
                                        program, isc_commandline_option);
                                usage(1);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        usage(0);
                        break;
index 1090d780f097c13763806086fba5fd10e618b819..9edcffe9ce1f0b691c0a124f886b16fba1694659 100644 (file)
@@ -684,7 +684,7 @@ fnmatch(const char *pattern, const char *string, int flags) {
                                        --pattern;
                                }
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                norm:
                        if (c == *string) {
index f3165f2a36855d7ba9431fbd1e4782e43083a394..3a71b859958625e55b3176190f05c52301e71424 100644 (file)
@@ -145,7 +145,7 @@ Good:
 The following lint and lint-like comments should be used where appropriate:
 
        /* ARGSUSED */
-       /* FALLTHROUGH */
+       FALLTHROUGH;
        /* NOTREACHED */
        /* VARARGS */
 
index 539554063148db55e4689d3529d6c9c5640ffea3..6ce32d7a9be767d92323667e140cc0326e8398bc 100644 (file)
@@ -132,7 +132,7 @@ again:
                        goto again;
                }
 #endif /* ifdef AI_ADDRCONFIG */
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        default:
                return (ISC_R_FAILURE);
        }
index 81e2f0658d72626c9196520a0bff3b2508e0348c..0fcac79d3c997d198708d5acb133723853a3b52a 100644 (file)
@@ -801,7 +801,7 @@ tcp_recv(isc_nmhandle_t *handle, isc_result_t result, isc_region_t *region,
                }
 
                /* Got an invalid DNS response, terminate the connection */
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        default:
                isc_sockaddr_format(&peer, buf, sizeof(buf));
                dispatch_log(disp, ISC_LOG_ERROR,
index 3ed6f6c0e4009b920f2de2197af060900d5c4cbc..171b6b3ed4085f7899f033424bf7e9ce5d448329 100644 (file)
@@ -441,7 +441,7 @@ dns_dnssec_verify(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
                        inc_stat(dns_dnssecstats_fail);
                        return (DNS_R_SIGINVALID);
                }
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        default:
                if (!dns_name_issubdomain(name, &sig.signer)) {
                        inc_stat(dns_dnssecstats_fail);
index ccd787d12937ded226189513e499e33dd2a86c13..44e5f6e160e2280394822ee6fad6a7d1b7d2e20c 100644 (file)
@@ -816,7 +816,7 @@ dns_dt_send(dns_view_t *view, dns_dtmsgtype_t msgtype, isc_sockaddr_t *qaddr,
                        break;
                }
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case DNS_DTTYPE_AQ:
        case DNS_DTTYPE_CQ:
        case DNS_DTTYPE_FQ:
index 060cc86ec2ef9ab93846b37f5e60b97804601e41..ae2e815c866c2edda6c9ca416648647be5dad109 100644 (file)
@@ -703,7 +703,7 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
                                isc_buffer_putstr(target, KEYDATA);
                                break;
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                        if ((ctx->style.flags & DNS_STYLEFLAG_UNKNOWNFORMAT) !=
                            0) {
index e357228d3556fccb86fc084cd4eae6a88e881682..2a8f9a5d771c5638fd6b3d196a96ccd2a38006da 100644 (file)
@@ -1145,7 +1145,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
                                break;
                        }
 
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case ft_start:
                        label = ndata;
                        ndata++;
@@ -1160,7 +1160,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
                        if (nrem == 0) {
                                return (ISC_R_NOSPACE);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case ft_ordinary:
                        if (c == '.') {
                                if (count == 0) {
@@ -1204,7 +1204,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
                        }
                        state = ft_escape;
                        POST(state);
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case ft_escape:
                        if (!isdigit((unsigned char)c)) {
                                if (count >= 63) {
@@ -1224,7 +1224,7 @@ dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
                        digits = 0;
                        value = 0;
                        state = ft_escdecimal;
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case ft_escdecimal:
                        if (!isdigit((unsigned char)c)) {
                                return (DNS_R_BADESCAPE);
@@ -1427,7 +1427,7 @@ dns_name_totext2(const dns_name_t *name, unsigned int options,
                                            0) {
                                                goto no_escape;
                                        }
-                               /* FALLTHROUGH */
+                                       FALLTHROUGH;
                                case 0x22: /* '"' */
                                case 0x28: /* '(' */
                                case 0x29: /* ')' */
index e2af9a4ea2e6200e4969cab62d50d1d2501ecba3..8757fbd5ab0fb71323fb37f0ad7f8d942092c455 100644 (file)
@@ -791,7 +791,7 @@ update_cachestats(dns_rbtdb_t *rbtdb, isc_result_t result) {
        case DNS_R_COVERINGNSEC:
                isc_stats_increment(rbtdb->cachestats,
                                    dns_cachestatscounter_coveringnsec);
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        case ISC_R_SUCCESS:
        case DNS_R_CNAME:
        case DNS_R_DNAME:
index 6e82d3abdd2f85f7d133ba47a7aff0237d8d1119..d90cc842a058b7747e335ad72c16b2e86b4ab659 100644 (file)
@@ -233,7 +233,7 @@ fromwire_opt(ARGS_FROMWIRE) {
                        isc_region_consume(&sregion, length);
                        break;
                case DNS_OPT_CLIENT_TAG:
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case DNS_OPT_SERVER_TAG:
                        if (length != 2) {
                                return (DNS_R_OPTERR);
index 1816723749a972b0d8fc85bc423dd6bbf4342106..5865b8a4d647b75b4fca02d4514f11330cbb7b43 100644 (file)
@@ -7697,7 +7697,7 @@ resquery_response(isc_result_t eresult, isc_region_t *region, void *arg) {
                if (query->rmessage->counts[DNS_SECTION_QUESTION] == 0) {
                        break;
                }
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case dns_rcode_nxrrset: /* Not expected. */
        case dns_rcode_badcookie:
        case dns_rcode_noerror:
index 15aa14326bda6e08f8a87e75524823a1714d4228..856b718c7cbceb8248ff3ed3d0af4fc01b6d673b 100644 (file)
@@ -130,7 +130,7 @@ check_node(dns_rdataset_t *rootns, dns_name_t *name,
                        if (dns_name_compare(name, dns_rootname) == 0) {
                                break;
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                        result = ISC_R_FAILURE;
                        goto cleanup;
index 5905c8c1c10f32ed54201a6217303b635bf6f8b3..0f316308ddaa46f634d8b398cf8b8535db5a8de5 100644 (file)
@@ -2715,7 +2715,7 @@ dns_rpz_find_name(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
                                found_zbits = nm_data->set.ns;
                        }
                }
-               /* FALLTHROUGH */
+               FALLTHROUGH;
 
        case DNS_R_PARTIALMATCH:
                i = chain.level_matches;
index f9b80a7da1e8ae56ba33ca2a7b13799e5aa2b34f..610643b80716b13055e062603ba227fe8f877fc4 100644 (file)
@@ -1711,7 +1711,7 @@ next_state:
 
                update_log(log, zone, ISC_LOG_DEBUG(3),
                           "updated data signatures");
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case remove_orphaned:
                state->state = remove_orphaned;
 
@@ -1743,7 +1743,7 @@ next_state:
                update_log(log, zone, ISC_LOG_DEBUG(3),
                           "rebuilding NSEC chain");
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case build_chain:
                state->state = build_chain;
                /*
@@ -1833,7 +1833,7 @@ next_state:
 
                CHECK(uniqify_name_list(&state->affected));
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case process_nsec:
                state->state = process_nsec;
 
@@ -1949,7 +1949,7 @@ next_state:
                update_log(log, zone, ISC_LOG_DEBUG(3),
                           "signing rebuilt NSEC chain");
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case sign_nsec:
                state->state = sign_nsec;
                /* Update RRSIG NSECs. */
@@ -1981,7 +1981,7 @@ next_state:
                }
                ISC_LIST_APPENDLIST(state->nsec_mindiff.tuples,
                                    state->work.tuples, link);
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case update_nsec3:
                state->state = update_nsec3;
 
@@ -2073,7 +2073,7 @@ next_state:
                        }
                }
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case process_nsec3:
                state->state = process_nsec3;
                while ((t = ISC_LIST_HEAD(state->affected.tuples)) != NULL) {
@@ -2124,7 +2124,7 @@ next_state:
                update_log(log, zone, ISC_LOG_DEBUG(3),
                           "signing rebuilt NSEC3 chain");
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case sign_nsec3:
                state->state = sign_nsec3;
                /* Update RRSIG NSEC3s. */
index 8ee86a1669dfda0797767ee00185e09efa0a5911..5014e500fb1fc38b5b7734f6b0d6178976be0741 100644 (file)
@@ -529,7 +529,7 @@ fetch_callback_ds(isc_task_t *task, isc_event_t *event) {
                        goto unexpected;
                }
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case ISC_R_SUCCESS:
                if (trustchain) {
                        /*
index ccfa1e8b782fc5009b608188cf23d47dfb048ad1..2136cb7fc5e4558a4791285475140083e9c1c780 100644 (file)
@@ -680,8 +680,7 @@ redo:
        case XFRST_AXFR_END:
        case XFRST_IXFR_END:
                FAIL(DNS_R_EXTRADATA);
-       /* NOTREACHED */
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        default:
                INSIST(0);
                ISC_UNREACHABLE();
@@ -1574,7 +1573,7 @@ xfrin_recv_done(isc_nmhandle_t *handle, isc_result_t result,
                break;
        case XFRST_AXFR_END:
                CHECK(axfr_finalize(xfr));
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        case XFRST_IXFR_END:
                /*
                 * Close the journal.
index 3cf032097031c86349341db58694abd5e74281b3..58f173347007af8def27772ed8cd4a665100968d 100644 (file)
@@ -11307,7 +11307,7 @@ zone_maintenance(dns_zone_t *zone) {
                if (zone->primaries == NULL) {
                        break;
                }
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case dns_zone_secondary:
        case dns_zone_mirror:
        case dns_zone_stub:
@@ -11332,7 +11332,7 @@ zone_maintenance(dns_zone_t *zone) {
                if (zone->primaries == NULL) {
                        break;
                }
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case dns_zone_secondary:
        case dns_zone_mirror:
        case dns_zone_stub:
@@ -11704,7 +11704,7 @@ zone_journal_rollforward(dns_zone_t *zone, dns_db_t *db, bool *needdump,
        switch (result) {
        case ISC_R_SUCCESS:
                *needdump = true;
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        case DNS_R_UPTODATE:
                if (dns_journal_recovered(journal)) {
                        *fixjournal = true;
@@ -13639,7 +13639,7 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
                                     primary, source);
                        goto same_primary;
                }
-               /* fallthrough */
+               FALLTHROUGH;
        default:
                dns_zonemgr_unreachableadd(zone->zmgr, &zone->primaryaddr,
                                           &zone->sourceaddr, &now);
@@ -14049,7 +14049,7 @@ refresh_callback(isc_task_t *task, isc_event_t *event) {
                        }
                        goto next_primary;
                }
-               /* fallthrough */
+               FALLTHROUGH;
        default:
                dns_zone_log(zone, ISC_LOG_INFO,
                             "refresh: failure trying primary "
@@ -15147,8 +15147,7 @@ zone_settimer(dns_zone_t *zone, isc_time_t *now) {
                if (zone->primaries != NULL) {
                        goto treat_as_secondary;
                }
-               /* FALLTHROUGH */
-
+               FALLTHROUGH;
        case dns_zone_primary:
                if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) ||
                    DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDSTARTUPNOTIFY))
@@ -15211,8 +15210,7 @@ zone_settimer(dns_zone_t *zone, isc_time_t *now) {
                {
                        next = zone->notifytime;
                }
-               /* FALLTHROUGH */
-
+               FALLTHROUGH;
        case dns_zone_stub:
                if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_REFRESH) &&
                    !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOPRIMARIES) &&
@@ -17577,7 +17575,7 @@ again:
        switch (xfrresult) {
        case ISC_R_SUCCESS:
                DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY);
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case DNS_R_UPTODATE:
                DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_FORCEXFER);
                /*
@@ -17735,7 +17733,6 @@ again:
                        zone->curprimary++;
                } while (zone->curprimary < zone->primariescnt &&
                         zone->primariesok[zone->curprimary]);
-               /* FALLTHROUGH */
        same_primary:
                if (zone->curprimary >= zone->primariescnt) {
                        zone->curprimary = 0;
index 71bc3b2214498723c80d084a8b48b373e9519f0e..d0cd0197d38f8943e109faf7f73e1f369f5b3c5c 100644 (file)
  * ISC_ or isc_ to the name.
  */
 
+/***
+ *** Clang Compatibility Macros
+ ***/
+
+#if !defined(__has_attribute)
+#define __has_attribute(x) 0
+#endif /* if !defined(__has_attribute) */
+
+#if !defined(__has_feature)
+#define __has_feature(x) 0
+#endif /* if !defined(__has_feature) */
+
 /***
  *** General Macros.
  ***/
 #define ISC_NONSTRING
 #endif /* __GNUC__ */
 
+#if __GNUC__ >= 7 || __has_attribute(fallthrough)
+#define FALLTHROUGH __attribute__((fallthrough))
+#else
+/* clang-format off */
+#define FALLTHROUGH do {} while (0) /* FALLTHROUGH */
+/* clang-format on */
+#endif
+
 #if HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR && HAVE_FUNC_ATTRIBUTE_DESTRUCTOR
 #define ISC_CONSTRUCTOR __attribute__((constructor))
 #define ISC_DESTRUCTOR __attribute__((destructor))
 #define ISC_UNREACHABLE()
 #endif /* ifdef HAVE_BUILTIN_UNREACHABLE */
 
-#if !defined(__has_feature)
-#define __has_feature(x) 0
-#endif /* if !defined(__has_feature) */
-
 /* GCC defines __SANITIZE_ADDRESS__, so reuse the macro for clang */
 #if __has_feature(address_sanitizer)
 #define __SANITIZE_ADDRESS__ 1
index 6373a98393a8409851d26c62e4b6483b842ade8a..9f2a9254c5cd3b93a8436b8105a3629bc638649b 100644 (file)
@@ -688,7 +688,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
                                state = lexstate_vpairstart;
                                break;
                        }
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
                case lexstate_vpairstart:
                        if (state == lexstate_vpairstart) {
                                if (c == '"' &&
@@ -699,7 +699,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
                                }
                                state = lexstate_vpair;
                        }
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
                case lexstate_vpair:
                        /*
                         * EOF needs to be checked before lex->specials[c]
index 6fd80c207aafbad66d82b994a8c255722e5e1e08..f41c39237dd9dc016beb59815185479686e339fb 100644 (file)
@@ -1798,7 +1798,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
                                }
                                channel->flags &= ~ISC_LOG_OPENERR;
                        }
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
 
                case ISC_LOG_TOFILEDESC:
                        fprintf(FILE_STREAM(channel), "%s%s%s%s%s%s%s%s%s%s\n",
index fdc1e6fe4c250a1d3380dc7f3816d535f9e72e15..4216b5c24b1206ea0630069b8d7f97a02e86cf5f 100644 (file)
@@ -1620,7 +1620,7 @@ isc___nmhandle_get(isc_nmsocket_t *sock, isc_sockaddr_t *peer,
                if (!atomic_load(&sock->client)) {
                        break;
                }
-               /* fallthrough */
+               FALLTHROUGH;
        case isc_nm_tcpsocket:
        case isc_nm_tlssocket:
                INSIST(sock->statichandle == NULL);
@@ -2898,7 +2898,7 @@ shutdown_walk_cb(uv_handle_t *handle, void *arg) {
                                isc__nmsocket_reset(sock);
                                return;
                        }
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                        isc__nmsocket_shutdown(sock);
                }
index 327144eb8282d79fd4a22eb24e8a569db777ea83..ceab020503db50086cf353105351bcae380afd8e 100644 (file)
@@ -311,7 +311,7 @@ isc_ratelimiter_stall(isc_ratelimiter_t *rl) {
                result = isc_timer_reset(rl->timer, isc_timertype_inactive,
                                         NULL, false);
                RUNTIME_CHECK(result == ISC_R_SUCCESS);
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case isc_ratelimiter_idle:
        case isc_ratelimiter_stalled:
                rl->state = isc_ratelimiter_stalled;
index 8cd4691289d78de62f84bb59e46c5fc226570067..0f83ef5f2e61c7aab32638b67f147fad3927cac8 100644 (file)
@@ -120,25 +120,25 @@ isc_siphash24(const uint8_t *k, const uint8_t *in, const size_t inlen,
        switch (left) {
        case 7:
                b |= ((uint64_t)in[6]) << 48;
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 6:
                b |= ((uint64_t)in[5]) << 40;
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 5:
                b |= ((uint64_t)in[4]) << 32;
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 4:
                b |= ((uint64_t)in[3]) << 24;
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 3:
                b |= ((uint64_t)in[2]) << 16;
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 2:
                b |= ((uint64_t)in[1]) << 8;
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 1:
                b |= ((uint64_t)in[0]);
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 0:
                break;
        default:
@@ -198,13 +198,13 @@ isc_halfsiphash24(const uint8_t *k, const uint8_t *in, const size_t inlen,
        switch (left) {
        case 3:
                b |= ((uint32_t)in[2]) << 16;
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 2:
                b |= ((uint32_t)in[1]) << 8;
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 1:
                b |= ((uint32_t)in[0]);
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case 0:
                break;
        default:
index dbdfc31ee7af0836892a2d8f61abf1c133891f08..19a7bee453e81bd5132960abc6f1ba1d6cc6357d 100644 (file)
@@ -322,7 +322,7 @@ isc_tm_strptime(const char *buf, const char *fmt, struct tm *tm) {
 
                case 'k': /* The hour (24-hour clock representation). */
                        LEGAL_ALT(0);
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'H':
                        LEGAL_ALT(ALT_O);
                        if (!(conv_num(&bp, &tm->tm_hour, 0, 23))) {
@@ -332,7 +332,7 @@ isc_tm_strptime(const char *buf, const char *fmt, struct tm *tm) {
 
                case 'l': /* The hour (12-hour clock representation). */
                        LEGAL_ALT(0);
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'I':
                        LEGAL_ALT(ALT_O);
                        if (!(conv_num(&bp, &tm->tm_hour, 1, 12))) {
index 100b91c17799a134b3a29adb2e1c8a91e72242fb..8758496e5b0a2db381d6e98e47ced4af049de641 100644 (file)
@@ -277,7 +277,7 @@ parse_url_char(state_t s, const char ch) {
                        return (s_dead);
                }
 
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        case s_req_server_start:
        case s_req_server:
                if (ch == '/') {
@@ -399,7 +399,7 @@ http_parse_host_char(host_state_t s, const char ch) {
                        return (s_http_host);
                }
 
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        case s_http_host_v6_end:
                if (ch == ':') {
                        return (s_http_host_port_start);
@@ -412,7 +412,7 @@ http_parse_host_char(host_state_t s, const char ch) {
                        return (s_http_host_v6_end);
                }
 
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        case s_http_host_v6_start:
                if (isxdigit((unsigned char)ch) || ch == ':' || ch == '.') {
                        return (s_http_host_v6);
@@ -428,7 +428,7 @@ http_parse_host_char(host_state_t s, const char ch) {
                        return (s_http_host_v6_end);
                }
 
-               /* FALLTHROUGH */
+               FALLTHROUGH;
        case s_http_host_v6_zone_start:
                /* RFC 6874 Zone ID consists of 1*( unreserved / pct-encoded) */
                if (isalnum((unsigned char)ch) || ch == '%' || ch == '.' ||
@@ -578,7 +578,7 @@ isc_url_parse(const char *buf, size_t buflen, bool is_connect,
 
                case s_req_server_with_at:
                        found_at = 1;
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
                case s_req_server:
                        uf = ISC_UF_HOST;
                        break;
index ea030fbd9de1d75cb4cb6a923f90726fe3225a9e..d03dc40fe323508c92a9c108c618191a9dfd7f77 100644 (file)
@@ -426,8 +426,8 @@ geoip_can_answer(dns_aclelement_t *elt, cfg_aclconfctx_t *ctx) {
                if (ctx->geoip->country != NULL) {
                        return (true);
                }
-       /* city db can answer these too, so: */
-       /* FALLTHROUGH */
+               /* city db can answer these too, so: */
+               FALLTHROUGH;
        case dns_geoip_region:
        case dns_geoip_regionname:
        case dns_geoip_city_countrycode:
index 4ef38965edaeafb18b942e8c4e47de2c7ca8f829..9a661c6d0a22286cc6f33592ede9575231acb52e 100644 (file)
@@ -2566,7 +2566,7 @@ query_prefetch(ns_client_t *client, dns_name_t *qname,
                        break;
                case ISC_R_SOFTQUOTA:
                        isc_quota_detach(&client->recursionquota);
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                        return;
                }
@@ -2784,7 +2784,7 @@ query_rpzfetch(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t type) {
                        break;
                case ISC_R_SOFTQUOTA:
                        isc_quota_detach(&client->recursionquota);
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                        return;
                }
@@ -7247,7 +7247,7 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) {
                        break;
                case DNS_RPZ_POLICY_NODATA:
                        qctx->nxrewrite = true;
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case DNS_RPZ_POLICY_DNS64:
                        result = DNS_R_NXRRSET;
                        qctx->rpz = true;
@@ -10159,7 +10159,7 @@ query_coveringnsec(query_ctx_t *qctx) {
                {
                        goto cleanup;
                }
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case DNS_R_CNAME:
                if (!qctx->resuming && !STALE(&rdataset) && rdataset.ttl == 0 &&
                    RECURSIONOK(qctx->client))