]> 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 08:30:16 +0000 (09:30 +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.

(cherry picked from commit fe7ce629f47e7a0449b7527aad3c0b4e596b1f4e)

42 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
bin/tests/optional/db_test.c
contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c
doc/dev/style.md
lib/bind9/getaddresses.c
lib/dns/dnssec.c
lib/dns/dnstap.c
lib/dns/masterdump.c
lib/dns/name.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/unix/socket.c
lib/isc/url.c
lib/isc/win32/socket.c
lib/isccfg/aclconf.c
lib/ns/query.c

index 6ce7857798d99f82ac21392d1c3aeeebc025069f..a46c066c1f06aeccfb2926c7ad49f48dc6de7267 100644 (file)
@@ -685,7 +685,7 @@ main(int argc, char **argv) {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        program, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        usage();
 
index deb62cfc0193d96cf52413cda8995331d85f9676..53257a424ec317f17151dd7569b685fc5f57e1cc 100644 (file)
@@ -425,7 +425,7 @@ main(int argc, char **argv) {
                                fprintf(stderr, "%s: invalid argument -%c\n",
                                        prog_name, isc_commandline_option);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        usage();
 
index 3e368820484b7f5c4c19ae112106b172fa8b4034..646c89783e64fa97393b93247be5d0efb22dcdfb 100644 (file)
@@ -773,7 +773,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 1b334e3a95e5f9356ef322c3407698525e87bd84..404239e916757b4680c655990a1dc6be4ecd4236 100644 (file)
@@ -441,14 +441,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 397f989a61db15d01d87753a4632539f0cdae3f8..8a776c16bd926742e8ec01eb8299328777ef27e4 100644 (file)
@@ -393,7 +393,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 5032bf37bee29b9257f0f0377f56b436da9c1fb6..dbafd2e421d5b0af4fe3492d364b9ff2f0e0cee8 100644 (file)
@@ -332,14 +332,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 af1b2975aa45a34a8c813ad97428ee4ba31400ab..f1ccd020ad38b264a541882b629cc3e94b269801 100644 (file)
@@ -1131,14 +1131,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 b8b6637847b8f18f9c2daeebb2e2051f4fa25114..1127c2c89bdc95b209cceebc5127f5cc378186d2 100644 (file)
@@ -134,7 +134,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 671a41c859b0dd54d7d20aad873c90e4d219e2f2..d196de04212ea55236f620614642b96b2873d569 100644 (file)
@@ -360,7 +360,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 1cca07fc0ff66c4002f5adc9f8f9d5ecc86103fe..6b210e365e7b9e5c1f8a7b96b3a217165700a546 100644 (file)
@@ -3662,14 +3662,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 93b804ef9fc7d8dfa711434649ec359974464390..85cc54b1b25ec4b150191eac73ee6af4a798b68a 100644 (file)
@@ -135,7 +135,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));
@@ -279,7 +279,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 9ad2d0e27748ca19c43a4b9c991e0e267718c4db..534ba41f95a3001e3e50c1b9d6200c3a09025e2c 100644 (file)
@@ -861,8 +861,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 == '?') {
@@ -877,7 +877,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 c55a28f6769bd2ad2c42415b91dcfc81dd4bca4d..e0599d80e9430451ed4c51355204dc6407c163b8 100644 (file)
@@ -1911,7 +1911,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 49120a7767ff561216bd285bd9c58c67d6380705..7fe789d5c8175c1a94164f3f53603a452d0d5a4e 100644 (file)
@@ -974,7 +974,7 @@ main(int argc, char **argv) {
                                        program, isc_commandline_option);
                                usage(1);
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                case 'h':
                        usage(0);
                        break;
index 55d82d559e571f9819c7e38e34fc0f2b0480ff9c..70a863dd06cceb41cfc39d027ef5850bdbfd56cd 100644 (file)
@@ -845,7 +845,7 @@ main(int argc, char *argv[]) {
                        if (dns_rdataset_isassociated(&rdataset)) {
                                break;
                        }
-               /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                        if (dbi == NULL) {
                                dns_db_detach(&db);
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 d0e57a2c144ef173d41dc05798e80e5228bb157a..a2d69b41f2d359df4e92f2edcc66e524bd8e3ef8 100644 (file)
@@ -146,7 +146,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 876d0cb5aa11bd6835b59644dfbe59b472023d74..2d9c40d18716da1608c5807601d61746cd3b65cf 100644 (file)
@@ -445,7 +445,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 fae3aef87b28805cbced43a078f28e9f97cef932..077a3c71aa03581f06bb3fdfcc48c1eff94cd01e 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 bc405c732566e2dba6932084145d4011c596a774..84180554338869bab3ff164ce576fedc58329837 100644 (file)
@@ -706,7 +706,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 ae116ffa2f1e754f19fb5a15ed1f4ef129ab5841..63310ae4df32a6a46ec3fbc1febda531838941d3 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 9321695be946352cf3d0a2d355aaccfd041e0334..d6b384b3e7319cc865de52b174274168f1067200 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 677384b1081d060ccc0acc92e476eb7664577806..58a6e2e4e003348b9b35e48c9123a09fa6846a41 100644 (file)
@@ -8004,7 +8004,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
                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 c9f3d513aeb61cb69cd5d18460e781eecd5166f3..5a9ac23f5c6c62acea19e72f07f32ca7504431d4 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 5fd034c339e68eb1415c9aca4fde7ddc728b2410..180a009e77a2425849debc7becb7cc5c9c3871cc 100644 (file)
@@ -2729,7 +2729,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 62640bbd153e47c6674cd4385049ede1ffbdbe97..9e53dbbc6e0190d13c710942693fe058ef542e16 100644 (file)
@@ -1712,7 +1712,7 @@ next_state:
 
                update_log(log, zone, ISC_LOG_DEBUG(3),
                           "updated data signatures");
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case remove_orphaned:
                state->state = remove_orphaned;
 
@@ -1744,7 +1744,7 @@ next_state:
                update_log(log, zone, ISC_LOG_DEBUG(3),
                           "rebuilding NSEC chain");
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case build_chain:
                state->state = build_chain;
                /*
@@ -1834,7 +1834,7 @@ next_state:
 
                CHECK(uniqify_name_list(&state->affected));
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case process_nsec:
                state->state = process_nsec;
 
@@ -1950,7 +1950,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. */
@@ -1982,7 +1982,7 @@ next_state:
                }
                ISC_LIST_APPENDLIST(state->nsec_mindiff.tuples,
                                    state->work.tuples, link);
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case update_nsec3:
                state->state = update_nsec3;
 
@@ -2074,7 +2074,7 @@ next_state:
                        }
                }
 
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case process_nsec3:
                state->state = process_nsec3;
                while ((t = ISC_LIST_HEAD(state->affected.tuples)) != NULL) {
@@ -2125,7 +2125,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 9d3393f61ae6eaf517fce508d35022321ba185ab..0ab877ecb16b87118378f9455df6a5ece8392f0c 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 08df7d8b03e23b3d55a3325aaca6f772f5b317c8..a55913597e83f061c84502f4c8b4abf4a04bc973 100644 (file)
@@ -682,8 +682,7 @@ redo:
        case XFRST_AXFR_END:
        case XFRST_IXFR_END:
                FAIL(DNS_R_EXTRADATA);
-       /* NOTREACHED */
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        default:
                INSIST(0);
                ISC_UNREACHABLE();
@@ -1469,7 +1468,7 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) {
                break;
        case XFRST_AXFR_END:
                CHECK(axfr_finalize(xfr));
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case XFRST_IXFR_END:
                /*
                 * Close the journal.
index 74ecace4a536c4a1ddcf8851e10a7a5cbe89fdcc..1afea64383d34b17b4ae426dc9f9f86210a47706 100644 (file)
@@ -11254,7 +11254,7 @@ zone_maintenance(dns_zone_t *zone) {
                if (zone->masters == NULL) {
                        break;
                }
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case dns_zone_secondary:
        case dns_zone_mirror:
        case dns_zone_stub:
@@ -11279,7 +11279,7 @@ zone_maintenance(dns_zone_t *zone) {
                if (zone->masters == NULL) {
                        break;
                }
-       /* FALLTHROUGH */
+               FALLTHROUGH;
        case dns_zone_secondary:
        case dns_zone_mirror:
        case dns_zone_stub:
@@ -11644,7 +11644,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;
@@ -14998,8 +14998,7 @@ zone_settimer(dns_zone_t *zone, isc_time_t *now) {
                if (zone->masters != NULL) {
                        goto treat_as_slave;
                }
-               /* FALLTHROUGH */
-
+               FALLTHROUGH;
        case dns_zone_primary:
                if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDNOTIFY) ||
                    DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDSTARTUPNOTIFY))
@@ -15062,8 +15061,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_NOMASTERS) &&
@@ -17435,7 +17433,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);
                /*
@@ -17593,7 +17591,6 @@ again:
                        zone->curmaster++;
                } while (zone->curmaster < zone->masterscnt &&
                         zone->mastersok[zone->curmaster]);
-               /* FALLTHROUGH */
        same_master:
                if (zone->curmaster >= zone->masterscnt) {
                        zone->curmaster = 0;
index 381b44a0e5d1f46f8a0004dfb4f371be146cd121..a1622530b62daadb80046407b659f3e17480d90b 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 aa9b549f799294f2e4f0b0dda41bb23f74b38b95..2d685e6e37871d74a82a7ea8582031c5685dce1e 100644 (file)
@@ -684,7 +684,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 == '"' &&
@@ -695,7 +695,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 cdbdca8187868f5e727ba9481fa2b45bd055a9c5..4bef055f105a11f45251d7e4309659666ef5e8e3 100644 (file)
@@ -1811,7 +1811,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 24947a562a8cf227a2ce04fa5803f8d966f4674c..3f07d456ab9c3f8505d0bee5f34fb1efb8c62e67 100644 (file)
@@ -1600,7 +1600,7 @@ isc___nmhandle_get(isc_nmsocket_t *sock, isc_sockaddr_t *peer,
                if (!atomic_load(&sock->client)) {
                        break;
                }
-               /* fallthrough */
+               FALLTHROUGH;
        case isc_nm_tcpsocket:
                INSIST(sock->statichandle == NULL);
 
@@ -2768,7 +2768,7 @@ shutdown_walk_cb(uv_handle_t *handle, void *arg) {
                                isc__nmsocket_reset(sock);
                                return;
                        }
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
                default:
                        isc__nmsocket_shutdown(sock);
                }
index dabbb08ff4d7ed4bd54678c5e913b80cd6c3f280..601c133a9e88cfde2b7e3d9545ec4dcef37b89dd 100644 (file)
@@ -325,7 +325,7 @@ isc_ratelimiter_stall(isc_ratelimiter_t *rl) {
                result = isc_timer_reset(rl->timer, isc_timertype_inactive,
                                         NULL, 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 dda86768be91721d2a569e96e8eb37f02b7052b4..29158414224ab104bdf7aa00c9d1aa17b357063a 100644 (file)
@@ -2245,7 +2245,7 @@ again:
                        isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
                                      ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
                                      "%s: %s", err, strbuf);
-               /* fallthrough */
+                       FALLTHROUGH;
                case ENOBUFS:
                        inc_stats(manager->stats,
                                  sock->statsindex[STATID_OPENFAIL]);
@@ -3945,7 +3945,7 @@ socket_recv(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
 
        case DOIO_EOF:
                dev->result = ISC_R_EOF;
-               /* fallthrough */
+               FALLTHROUGH;
 
        case DOIO_HARD:
        case DOIO_SUCCESS:
@@ -4093,7 +4093,7 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
                        break;
                }
 
-               /* FALLTHROUGH */
+               FALLTHROUGH;
 
        case DOIO_HARD:
        case DOIO_SUCCESS:
@@ -4218,7 +4218,7 @@ isc_socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) {
                        if (active) { /* We exited cleanly last time */
                                break;
                        }
-                       /* intentional fallthrough */
+                       FALLTHROUGH;
                default:
                        strerror_r(errno, strbuf, sizeof(strbuf));
                        isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
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 15018d3e76a3be3170162eb59510fd5cd0452f35..fec216b8ab24e453977c17817beb43e6b26ae92f 100644 (file)
@@ -791,7 +791,7 @@ retry:
                                need_retry = true;
                                break;
                        }
-                       /* FALLTHROUGH */
+                       FALLTHROUGH;
 
                default:
                        isc_result = isc__errno2result(Error);
index 47c8bb54fe8e3c60936b0685b3b9212e40ba1bd4..076ef2f2df5095b248ba4c78779a21643134b2a0 100644 (file)
@@ -428,8 +428,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 54c850cb0f8a64c63b9c214877828e12afd7ee1f..72305aa8e651a864de4513d3d0f2724ca3675eed 100644 (file)
@@ -2522,7 +2522,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;
                }
@@ -2740,7 +2740,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;
                }
@@ -6927,7 +6927,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;
@@ -9830,7 +9830,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))