From: Ondřej Surý Date: Wed, 7 Nov 2018 08:00:07 +0000 (+0700) Subject: Hint the compiler with ISC_UNREACHABLE(); that code after INSIST(0); cannot be reached X-Git-Tag: v9.13.4~46^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23fff6c569e656274cf1543ac36b014e25c906ed;p=thirdparty%2Fbind9.git Hint the compiler with ISC_UNREACHABLE(); that code after INSIST(0); cannot be reached --- diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 1f1acb0de09..753f5ba69c3 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -282,8 +282,10 @@ configure_zone(const char *vclass, const char *view, } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { zone_options &= ~DNS_ZONEOPT_CHECKDUPRR; zone_options &= ~DNS_ZONEOPT_CHECKDUPRRFAIL; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } else { zone_options |= DNS_ZONEOPT_CHECKDUPRR; zone_options &= ~DNS_ZONEOPT_CHECKDUPRRFAIL; @@ -300,8 +302,10 @@ configure_zone(const char *vclass, const char *view, } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { zone_options &= ~DNS_ZONEOPT_CHECKMX; zone_options &= ~DNS_ZONEOPT_CHECKMXFAIL; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } else { zone_options |= DNS_ZONEOPT_CHECKMX; zone_options &= ~DNS_ZONEOPT_CHECKMXFAIL; @@ -327,8 +331,10 @@ configure_zone(const char *vclass, const char *view, } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { zone_options |= DNS_ZONEOPT_WARNMXCNAME; zone_options |= DNS_ZONEOPT_IGNOREMXCNAME; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } else { zone_options |= DNS_ZONEOPT_WARNMXCNAME; zone_options &= ~DNS_ZONEOPT_IGNOREMXCNAME; @@ -345,8 +351,10 @@ configure_zone(const char *vclass, const char *view, } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { zone_options |= DNS_ZONEOPT_WARNSRVCNAME; zone_options |= DNS_ZONEOPT_IGNORESRVCNAME; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } else { zone_options |= DNS_ZONEOPT_WARNSRVCNAME; zone_options &= ~DNS_ZONEOPT_IGNORESRVCNAME; @@ -366,8 +374,10 @@ configure_zone(const char *vclass, const char *view, zone_options |= DNS_ZONEOPT_CHECKSPF; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { zone_options &= ~DNS_ZONEOPT_CHECKSPF; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } else { zone_options |= DNS_ZONEOPT_CHECKSPF; } @@ -383,8 +393,10 @@ configure_zone(const char *vclass, const char *view, } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { zone_options &= ~DNS_ZONEOPT_CHECKNAMES; zone_options &= ~DNS_ZONEOPT_CHECKNAMESFAIL; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } else { zone_options |= DNS_ZONEOPT_CHECKNAMES; zone_options |= DNS_ZONEOPT_CHECKNAMESFAIL; @@ -394,14 +406,16 @@ configure_zone(const char *vclass, const char *view, fmtobj = NULL; if (get_maps(maps, "masterfile-format", &fmtobj)) { const char *masterformatstr = cfg_obj_asstring(fmtobj); - if (strcasecmp(masterformatstr, "text") == 0) + if (strcasecmp(masterformatstr, "text") == 0) { masterformat = dns_masterformat_text; - else if (strcasecmp(masterformatstr, "raw") == 0) + } else if (strcasecmp(masterformatstr, "raw") == 0) { masterformat = dns_masterformat_raw; - else if (strcasecmp(masterformatstr, "map") == 0) + } else if (strcasecmp(masterformatstr, "map") == 0) { masterformat = dns_masterformat_map; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } obj = NULL; diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c index a51e57dd5fe..061e39c5cc8 100644 --- a/bin/check/named-checkzone.c +++ b/bin/check/named-checkzone.c @@ -139,12 +139,14 @@ main(int argc, char **argv) { #define PROGCMP(X) \ (strcasecmp(prog_name, X) == 0 || strcasecmp(prog_name, X ".exe") == 0) - if (PROGCMP("named-checkzone")) + if (PROGCMP("named-checkzone")) { progmode = progmode_check; - else if (PROGCMP("named-compilezone")) + } else if (PROGCMP("named-compilezone")) { progmode = progmode_compile; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } /* Compilation specific defaults */ if (progmode == progmode_compile) { diff --git a/bin/confgen/ddns-confgen.c b/bin/confgen/ddns-confgen.c index 18322465b09..56e56da34aa 100644 --- a/bin/confgen/ddns-confgen.c +++ b/bin/confgen/ddns-confgen.c @@ -125,10 +125,12 @@ main(int argc, char **argv) { if (PROGCMP("tsig-keygen")) { progmode = progmode_keygen; quiet = true; - } else if (PROGCMP("ddns-confgen")) + } else if (PROGCMP("ddns-confgen")) { progmode = progmode_confgen; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } isc_commandline_errprint = false; diff --git a/bin/delv/delv.c b/bin/delv/delv.c index 53cd971e300..e83a35de57b 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -1224,6 +1224,7 @@ dash_option(char *option, char *next, bool *open_type_class) { /* NOTREACHED */ default: INSIST(0); + ISC_UNREACHABLE(); } if (strlen(option) > 1U) option = &option[1]; diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index daf7a923dd4..f4e5e55ae6e 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -2348,6 +2348,7 @@ setup_lookup(dig_lookup_t *lookup) { break; default: INSIST(0); + ISC_UNREACHABLE(); } isc_buffer_init(&b, ecsbuf, sizeof(ecsbuf)); diff --git a/bin/named/config.c b/bin/named/config.c index 9ce79bfd574..3b15ad2974a 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -457,6 +457,7 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) { ztype = dns_zone_redirect; } else { INSIST(0); + ISC_UNREACHABLE(); } return (ztype); } @@ -1029,6 +1030,7 @@ named_config_getkeyalgorithm2(const char *str, const dns_name_t **name, case hmacsha512: *name = dns_tsig_hmacsha512_name; break; default: INSIST(0); + ISC_UNREACHABLE(); } } if (typep != NULL) diff --git a/bin/named/logconf.c b/bin/named/logconf.c index d60e7fc8f06..f3dea3a6fcf 100644 --- a/bin/named/logconf.c +++ b/bin/named/logconf.c @@ -157,6 +157,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) { break; default: INSIST(0); + ISC_UNREACHABLE(); } type = ISC_LOG_TOFILE; diff --git a/bin/named/server.c b/bin/named/server.c index 2aecc630923..ee75c1b3b7e 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -1145,6 +1145,7 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af, break; default: INSIST(0); + ISC_UNREACHABLE(); } sa = *(cfg_obj_assockaddr(obj)); @@ -1166,6 +1167,7 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af, break; default: INSIST(0); + ISC_UNREACHABLE(); } if (result != ISC_R_SUCCESS) return (ISC_R_SUCCESS); @@ -1273,20 +1275,22 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) { obj = cfg_tuple_get(ent, "ordering"); INSIST(cfg_obj_isstring(obj)); str = cfg_obj_asstring(obj); - if (!strcasecmp(str, "fixed")) + if (!strcasecmp(str, "fixed")) { #if DNS_RDATASET_FIXED mode = DNS_RDATASETATTR_FIXEDORDER; #else mode = DNS_RDATASETATTR_CYCLIC; #endif /* DNS_RDATASET_FIXED */ - else if (!strcasecmp(str, "random")) + } else if (!strcasecmp(str, "random")) { mode = DNS_RDATASETATTR_RANDOMIZE; - else if (!strcasecmp(str, "cyclic")) + } else if (!strcasecmp(str, "cyclic")) { mode = DNS_RDATASETATTR_CYCLIC; - else if (!strcasecmp(str, "none")) + } else if (!strcasecmp(str, "none")) { mode = DNS_RDATASETATTR_NONE; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } /* * "*" should match everything including the root (BIND 8 compat). @@ -1418,14 +1422,16 @@ configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) { (void)cfg_map_get(cpeer, "transfer-format", &obj); if (obj != NULL) { str = cfg_obj_asstring(obj); - if (strcasecmp(str, "many-answers") == 0) + if (strcasecmp(str, "many-answers") == 0) { CHECK(dns_peer_settransferformat(peer, dns_many_answers)); - else if (strcasecmp(str, "one-answer") == 0) + } else if (strcasecmp(str, "one-answer") == 0) { CHECK(dns_peer_settransferformat(peer, dns_one_answer)); - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } obj = NULL; @@ -3943,8 +3949,10 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, view->checknames = false; } else if (strcasecmp(str, "ignore") == 0) { view->checknames = false; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } obj = NULL; result = named_config_get(maps, "zero-no-soa-ttl-cache", &obj); @@ -4358,12 +4366,14 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, const char *resp = cfg_obj_asstring(obj2); isc_result_t r = DNS_R_SERVFAIL; - if (strcasecmp(resp, "drop") == 0) + if (strcasecmp(resp, "drop") == 0) { r = DNS_R_DROP; - else if (strcasecmp(resp, "fail") == 0) + } else if (strcasecmp(resp, "fail") == 0) { r = DNS_R_SERVFAIL; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } dns_resolver_setquotaresponse(view->resolver, dns_quotatype_server, r); @@ -4709,20 +4719,24 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, view->minimalresponses = dns_minimal_noauth; } else if (strcasecmp(str, "no-auth-recursive") == 0) { view->minimalresponses = dns_minimal_noauthrec; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } obj = NULL; result = named_config_get(maps, "transfer-format", &obj); INSIST(result == ISC_R_SUCCESS); str = cfg_obj_asstring(obj); - if (strcasecmp(str, "many-answers") == 0) + if (strcasecmp(str, "many-answers") == 0) { view->transfer_format = dns_many_answers; - else if (strcasecmp(str, "one-answer") == 0) + } else if (strcasecmp(str, "one-answer") == 0) { view->transfer_format = dns_one_answer; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } obj = NULL; result = named_config_get(maps, "trust-anchor-telemetry", &obj); @@ -5038,12 +5052,14 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, const char *resp = cfg_obj_asstring(obj2); isc_result_t r = DNS_R_SERVFAIL; - if (strcasecmp(resp, "drop") == 0) + if (strcasecmp(resp, "drop") == 0) { r = DNS_R_DROP; - else if (strcasecmp(resp, "fail") == 0) + } else if (strcasecmp(resp, "fail") == 0) { r = DNS_R_SERVFAIL; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } dns_resolver_setquotaresponse(view->resolver, dns_quotatype_zone, r); @@ -5059,10 +5075,12 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, view->v4_aaaa = dns_aaaa_ok; } else { const char *v4_aaaastr = cfg_obj_asstring(obj); - if (strcasecmp(v4_aaaastr, "break-dnssec") == 0) + if (strcasecmp(v4_aaaastr, "break-dnssec") == 0) { view->v4_aaaa = dns_aaaa_break_dnssec; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } obj = NULL; @@ -5075,10 +5093,12 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, view->v6_aaaa = dns_aaaa_ok; } else { const char *v6_aaaastr = cfg_obj_asstring(obj); - if (strcasecmp(v6_aaaastr, "break-dnssec") == 0) + if (strcasecmp(v6_aaaastr, "break-dnssec") == 0) { view->v6_aaaa = dns_aaaa_break_dnssec; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } CHECK(configure_view_acl(vconfig, config, named_g_config, @@ -5319,14 +5339,16 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, statlevel = dns_zonestat_none; } else { const char *levelstr = cfg_obj_asstring(obj); - if (strcasecmp(levelstr, "full") == 0) + if (strcasecmp(levelstr, "full") == 0) { statlevel = dns_zonestat_full; - else if (strcasecmp(levelstr, "terse") == 0) + } else if (strcasecmp(levelstr, "terse") == 0) { statlevel = dns_zonestat_terse; - else if (strcasecmp(levelstr, "none") == 0) + } else if (strcasecmp(levelstr, "none") == 0) { statlevel = dns_zonestat_none; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } for (empty = empty_zones[empty_zone]; @@ -5686,16 +5708,18 @@ configure_forward(const cfg_obj_t *config, dns_view_t *view, "forwarding"); fwdpolicy = dns_fwdpolicy_none; } else { - if (forwardtype == NULL) + if (forwardtype == NULL) { fwdpolicy = dns_fwdpolicy_first; - else { + } else { const char *forwardstr = cfg_obj_asstring(forwardtype); - if (strcasecmp(forwardstr, "first") == 0) + if (strcasecmp(forwardstr, "first") == 0) { fwdpolicy = dns_fwdpolicy_first; - else if (strcasecmp(forwardstr, "only") == 0) + } else if (strcasecmp(forwardstr, "only") == 0) { fwdpolicy = dns_fwdpolicy_only; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } } @@ -9001,6 +9025,7 @@ load_configuration(const char *filename, named_server_t *server, server->sctx->cookiealg = ns_cookiealg_sha256; } else { INSIST(0); + ISC_UNREACHABLE(); } obj = NULL; @@ -12597,12 +12622,14 @@ newzone_parse(named_server_t *server, char *command, dns_view_t **viewp, isc_buffer_init(&argbuf, command, (unsigned int) strlen(command)); isc_buffer_add(&argbuf, strlen(command)); - if (strncasecmp(command, "add", 3) == 0) + if (strncasecmp(command, "add", 3) == 0) { bn = "addzone"; - else if (strncasecmp(command, "mod", 3) == 0) + } else if (strncasecmp(command, "mod", 3) == 0) { bn = "modzone"; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } /* * Convert the "addzone" or "modzone" to just "zone", for @@ -14988,6 +15015,7 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex, break; default: INSIST(0); + ISC_UNREACHABLE(); } if (viewtxt != NULL) { diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index f01004a8ba0..e365089abcc 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -125,7 +125,7 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig, break; default: INSIST(0); - return (ISC_R_FAILURE); + ISC_UNREACHABLE(); } /* First check to see if ACL is defined within the zone */ @@ -231,12 +231,14 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone, unsigned int i, n; str = cfg_obj_asstring(mode); - if (strcasecmp(str, "grant") == 0) + if (strcasecmp(str, "grant") == 0) { grant = true; - else if (strcasecmp(str, "deny") == 0) + } else if (strcasecmp(str, "deny") == 0) { grant = false; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } str = cfg_obj_asstring(matchtype); CHECK(dns_ssu_mtypefromstring(str, &mtype)); @@ -764,6 +766,7 @@ checknames(dns_zonetype_t ztype, const cfg_obj_t **maps, break; default: INSIST(0); + ISC_UNREACHABLE(); } result = named_checknames_get(maps, zone, objp); INSIST(result == ISC_R_SUCCESS && objp != NULL && *objp != NULL); @@ -1027,14 +1030,16 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, if (result == ISC_R_SUCCESS) { const char *masterformatstr = cfg_obj_asstring(obj); - if (strcasecmp(masterformatstr, "text") == 0) + if (strcasecmp(masterformatstr, "text") == 0) { masterformat = dns_masterformat_text; - else if (strcasecmp(masterformatstr, "raw") == 0) + } else if (strcasecmp(masterformatstr, "raw") == 0) { masterformat = dns_masterformat_raw; - else if (strcasecmp(masterformatstr, "map") == 0) + } else if (strcasecmp(masterformatstr, "map") == 0) { masterformat = dns_masterformat_map; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } obj = NULL; @@ -1050,12 +1055,14 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, return (ISC_R_FAILURE); } - if (strcasecmp(masterstylestr, "full") == 0) + if (strcasecmp(masterstylestr, "full") == 0) { masterstyle = &dns_master_style_full; - else if (strcasecmp(masterstylestr, "relative") == 0) + } else if (strcasecmp(masterstylestr, "relative") == 0) { masterstyle = &dns_master_style_default; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } obj = NULL; @@ -1141,16 +1148,18 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, dialup = dns_dialuptype_no; } else { const char *dialupstr = cfg_obj_asstring(obj); - if (strcasecmp(dialupstr, "notify") == 0) + if (strcasecmp(dialupstr, "notify") == 0) { dialup = dns_dialuptype_notify; - else if (strcasecmp(dialupstr, "notify-passive") == 0) + } else if (strcasecmp(dialupstr, "notify-passive") == 0) { dialup = dns_dialuptype_notifypassive; - else if (strcasecmp(dialupstr, "refresh") == 0) + } else if (strcasecmp(dialupstr, "refresh") == 0) { dialup = dns_dialuptype_refresh; - else if (strcasecmp(dialupstr, "passive") == 0) + } else if (strcasecmp(dialupstr, "passive") == 0) { dialup = dns_dialuptype_passive; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } if (raw != NULL) dns_zone_setdialup(raw, dialup); @@ -1166,14 +1175,16 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, statlevel = dns_zonestat_none; } else { const char *levelstr = cfg_obj_asstring(obj); - if (strcasecmp(levelstr, "full") == 0) + if (strcasecmp(levelstr, "full") == 0) { statlevel = dns_zonestat_full; - else if (strcasecmp(levelstr, "terse") == 0) + } else if (strcasecmp(levelstr, "terse") == 0) { statlevel = dns_zonestat_terse; - else if (strcasecmp(levelstr, "none") == 0) + } else if (strcasecmp(levelstr, "none") == 0) { statlevel = dns_zonestat_none; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } dns_zone_setstatlevel(zone, statlevel); @@ -1211,12 +1222,14 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, notifytype = dns_notifytype_no; } else { const char *notifystr = cfg_obj_asstring(obj); - if (strcasecmp(notifystr, "explicit") == 0) + if (strcasecmp(notifystr, "explicit") == 0) { notifytype = dns_notifytype_explicit; - else if (strcasecmp(notifystr, "master-only") == 0) + } else if (strcasecmp(notifystr, "master-only") == 0) { notifytype = dns_notifytype_masteronly; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } notifytype = process_notifytype(notifytype, ztype, zname, nodefault); @@ -1374,8 +1387,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, fail = check = true; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { fail = check = false; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } if (raw != NULL) { dns_zone_setoption(raw, DNS_ZONEOPT_CHECKNAMES, check); @@ -1410,8 +1425,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, check = true; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { check = false; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } dns_zone_setoption(zone, DNS_ZONEOPT_CHECKSPF, check); obj = NULL; @@ -1562,14 +1579,16 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, result = cfg_map_get(zoptions, "auto-dnssec", &obj); if (result == ISC_R_SUCCESS) { const char *arg = cfg_obj_asstring(obj); - if (strcasecmp(arg, "allow") == 0) + if (strcasecmp(arg, "allow") == 0) { allow = true; - else if (strcasecmp(arg, "maintain") == 0) + } else if (strcasecmp(arg, "maintain") == 0) { allow = maint = true; - else if (strcasecmp(arg, "off") == 0) + } else if (strcasecmp(arg, "off") == 0) { ; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } dns_zone_setkeyopt(zone, DNS_ZONEKEY_ALLOW, allow); dns_zone_setkeyopt(zone, DNS_ZONEKEY_MAINTAIN, maint); } @@ -1622,8 +1641,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, fail = check = true; } else if (strcasecmp(dupcheck, "ignore") == 0) { fail = check = false; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKDUPRR, check); dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKDUPRRFAIL, fail); @@ -1637,8 +1658,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, fail = check = true; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { fail = check = false; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKMX, check); dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKMXFAIL, fail); @@ -1674,8 +1697,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, warn = ignore = false; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { warn = ignore = true; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNMXCNAME, warn); dns_zone_setoption(mayberaw, DNS_ZONEOPT_IGNOREMXCNAME, ignore); @@ -1689,8 +1714,10 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, warn = ignore = false; } else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) { warn = ignore = true; - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNSRVCNAME, warn); dns_zone_setoption(mayberaw, DNS_ZONEOPT_IGNORESRVCNAME, ignore); @@ -1706,13 +1733,15 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, result = cfg_map_get(zoptions, "dnssec-update-mode", &obj); if (result == ISC_R_SUCCESS) { const char *arg = cfg_obj_asstring(obj); - if (strcasecmp(arg, "no-resign") == 0) + if (strcasecmp(arg, "no-resign") == 0) { dns_zone_setkeyopt(zone, DNS_ZONEKEY_NORESIGN, true); - else if (strcasecmp(arg, "maintain") == 0) + } else if (strcasecmp(arg, "maintain") == 0) { ; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } obj = NULL; diff --git a/lib/bind9/check.c b/lib/bind9/check.c index 8928e10a5eb..cdbc7270e4e 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -1863,6 +1863,7 @@ check_update_policy(const cfg_obj_t *policy, isc_log_t *logctx) { break; default: INSIST(0); + ISC_UNREACHABLE(); } for (element2 = cfg_list_first(typelist); @@ -2233,6 +2234,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, default: INSIST(0); + ISC_UNREACHABLE(); } } @@ -2658,14 +2660,16 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, (void)cfg_map_get(zoptions, "masterfile-format", &obj); if (obj != NULL) { const char *masterformatstr = cfg_obj_asstring(obj); - if (strcasecmp(masterformatstr, "text") == 0) + if (strcasecmp(masterformatstr, "text") == 0) { masterformat = dns_masterformat_text; - else if (strcasecmp(masterformatstr, "raw") == 0) + } else if (strcasecmp(masterformatstr, "raw") == 0) { masterformat = dns_masterformat_raw; - else if (strcasecmp(masterformatstr, "map") == 0) + } else if (strcasecmp(masterformatstr, "map") == 0) { masterformat = dns_masterformat_map; - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } } if (masterformat == dns_masterformat_map) { diff --git a/lib/dns/acl.c b/lib/dns/acl.c index 69d3b524bdc..f941512a463 100644 --- a/lib/dns/acl.c +++ b/lib/dns/acl.c @@ -416,8 +416,8 @@ dns_aclelement_match(const isc_netaddr_t *reqaddr, return (dns_geoip_match(reqaddr, env->geoip, &e->geoip_elem)); #endif default: - /* Should be impossible. */ INSIST(0); + ISC_UNREACHABLE(); } result = dns_acl_match(reqaddr, reqsigner, inner, env, @@ -593,7 +593,7 @@ dns_acl_isinsecure(const dns_acl_t *a) { default: INSIST(0); - return (true); + ISC_UNREACHABLE(); } } diff --git a/lib/dns/client.c b/lib/dns/client.c index 4a196156a36..6c96a40b300 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -273,6 +273,7 @@ getudpdispatch(int family, dns_dispatchmgr_t *dispatchmgr, break; default: INSIST(0); + ISC_UNREACHABLE(); } attrmask = 0; attrmask |= DNS_DISPATCHATTR_UDP; @@ -3177,6 +3178,7 @@ dns_client_updaterec(dns_client_updateop_t op, const dns_name_t *owner, break; default: INSIST(0); + ISC_UNREACHABLE(); } rdatalist->type = rdata->type; diff --git a/lib/dns/diff.c b/lib/dns/diff.c index 910326f38bc..3fac1e74789 100644 --- a/lib/dns/diff.c +++ b/lib/dns/diff.c @@ -378,6 +378,7 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, break; default: INSIST(0); + ISC_UNREACHABLE(); } if (result == ISC_R_SUCCESS) { diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index 007b35e0c17..e46cd055cdf 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -908,7 +908,7 @@ free_buffer(dns_dispatch_t *disp, void *buf, unsigned int len) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } } @@ -1577,7 +1577,7 @@ startrecv(dns_dispatch_t *disp, dispsocket_t *dispsock) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } return (ISC_R_SUCCESS); diff --git a/lib/dns/dnsrps.c b/lib/dns/dnsrps.c index a85e48ca693..b217b795d8e 100644 --- a/lib/dns/dnsrps.c +++ b/lib/dns/dnsrps.c @@ -311,6 +311,7 @@ dns_dnsrps_2policy(librpz_policy_t rps_policy) { case LIBRPZ_POLICY_DISABLED: default: INSIST(0); + ISC_UNREACHABLE(); } } diff --git a/lib/dns/dnstap.c b/lib/dns/dnstap.c index 3368d901052..d93e22d103d 100644 --- a/lib/dns/dnstap.c +++ b/lib/dns/dnstap.c @@ -1043,6 +1043,7 @@ dns_dt_open(const char *filename, dns_dtmode_t mode, isc_mem_t *mctx, return (ISC_R_NOTIMPLEMENTED); default: INSIST(0); + ISC_UNREACHABLE(); } isc_mem_attach(mctx, &handle->mctx); diff --git a/lib/dns/geoip.c b/lib/dns/geoip.c index 4ebc1a143e8..49bdd7faac5 100644 --- a/lib/dns/geoip.c +++ b/lib/dns/geoip.c @@ -285,6 +285,7 @@ country_lookup(GeoIP *db, dns_geoip_subtype_t subtype, break; default: INSIST(0); + ISC_UNREACHABLE(); } if (text == NULL) @@ -349,6 +350,7 @@ city_string(GeoIPRecord *record, dns_geoip_subtype_t subtype, int *maxlen) { return (deconst); default: INSIST(0); + ISC_UNREACHABLE(); } } @@ -437,6 +439,7 @@ static char * region_string(GeoIPRegion *region, dns_geoip_subtype_t subtype, in return (deconst); default: INSIST(0); + ISC_UNREACHABLE(); } } @@ -807,6 +810,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, default: INSIST(0); + ISC_UNREACHABLE() } return (false); diff --git a/lib/dns/hmac_link.c b/lib/dns/hmac_link.c index 71d1b6a2b5a..39e39179316 100644 --- a/lib/dns/hmac_link.c +++ b/lib/dns/hmac_link.c @@ -392,6 +392,7 @@ hmac__get_tag_key(isc_md_type_t type) { return (TAG_HMACSHA512_KEY); } else { INSIST(0); + ISC_UNREACHABLE(); } } @@ -411,6 +412,7 @@ hmac__get_tag_bits(isc_md_type_t type) { return (TAG_HMACSHA512_BITS); } else { INSIST(0); + ISC_UNREACHABLE(); } } @@ -462,6 +464,7 @@ hmac__to_dst_alg(isc_md_type_t type) { return (DST_ALG_HMACSHA512); } else { INSIST(0); + ISC_UNREACHABLE(); } } diff --git a/lib/dns/journal.c b/lib/dns/journal.c index b8bbe78c812..4a820382860 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -745,6 +745,7 @@ ixfr_order(const void *av, const void *bv) { break; default: INSIST(0); + ISC_UNREACHABLE(); } switch (b->op) { @@ -758,6 +759,7 @@ ixfr_order(const void *av, const void *bv) { break; default: INSIST(0); + ISC_UNREACHABLE(); } r = bop - aop; diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index 796a5955a8e..df779c6a432 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -1494,7 +1494,7 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } result = totext_ctx_init(style, &dctx->tctx); @@ -1634,6 +1634,7 @@ writeheader(dns_dumpctx_t *dctx) { break; default: INSIST(0); + ISC_UNREACHABLE(); } isc_mem_put(dctx->mctx, buffer.base, buffer.length); diff --git a/lib/dns/message.c b/lib/dns/message.c index ec6dde5155f..4a811d28dbc 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -920,8 +920,8 @@ getname(dns_name_t *name, isc_buffer_t *source, dns_message_t *msg, } } - INSIST(0); /* Cannot get here... */ - return (ISC_R_UNEXPECTED); + INSIST(0); + ISC_UNREACHABLE(); } static isc_result_t diff --git a/lib/dns/openssleddsa_link.c b/lib/dns/openssleddsa_link.c index 86b771f2f35..ffe5c239d82 100644 --- a/lib/dns/openssleddsa_link.c +++ b/lib/dns/openssleddsa_link.c @@ -569,8 +569,8 @@ openssleddsa_todns(const dst_key_t *key, isc_buffer_t *data) { return (result); default: INSIST(0); + ISC_UNREACHABLE(); } - return (DST_R_OPENSSLFAILURE); } static isc_result_t diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c index fabdd2f59e9..4ae80c37d40 100644 --- a/lib/dns/opensslrsa_link.c +++ b/lib/dns/opensslrsa_link.c @@ -222,6 +222,7 @@ opensslrsa_createctx(dst_key_t *key, dst_context_t *dctx) { break; default: INSIST(0); + ISC_UNREACHABLE(); } evp_md_ctx = EVP_MD_CTX_create(); @@ -244,6 +245,7 @@ opensslrsa_createctx(dst_key_t *key, dst_context_t *dctx) { break; default: INSIST(0); + ISC_UNREACHABLE(); } if (!EVP_DigestInit_ex(evp_md_ctx, type, NULL)) { @@ -481,6 +483,7 @@ opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) { break; default: INSIST(0); + ISC_UNREACHABLE(); } if (rsa == NULL || e == NULL || cb == NULL) diff --git a/lib/dns/peer.c b/lib/dns/peer.c index 89447cc545e..85f895a2cba 100644 --- a/lib/dns/peer.c +++ b/lib/dns/peer.c @@ -206,10 +206,11 @@ dns_peer_new(isc_mem_t *mem, const isc_netaddr_t *addr, dns_peer_t **peerptr) { prefixlen = 32; break; case AF_INET6: - prefixlen = 128; + prefixlen = 128; break; default: INSIST(0); + ISC_UNREACHABLE(); } return (dns_peer_newprefix(mem, addr, prefixlen, peerptr)); diff --git a/lib/dns/pkcs11rsa_link.c b/lib/dns/pkcs11rsa_link.c index ef452d58fd6..133c4a05945 100644 --- a/lib/dns/pkcs11rsa_link.c +++ b/lib/dns/pkcs11rsa_link.c @@ -112,6 +112,7 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) { break; default: INSIST(0); + ISC_UNREACHABLE(); } rsa = key->keydata.pkey; @@ -247,6 +248,7 @@ pkcs11rsa_createctx_sign(dst_key_t *key, dst_context_t *dctx) { break; default: INSIST(0); + ISC_UNREACHABLE(); } PK11_RET(pkcs_C_SignInit, @@ -339,6 +341,7 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits, break; default: INSIST(0); + ISC_UNREACHABLE(); } rsa = key->keydata.pkey; @@ -406,6 +409,7 @@ pkcs11rsa_createctx_verify(dst_key_t *key, unsigned int maxbits, break; default: INSIST(0); + ISC_UNREACHABLE(); } PK11_RET(pkcs_C_VerifyInit, @@ -605,6 +609,7 @@ pkcs11rsa_createctx(dst_key_t *key, dst_context_t *dctx) { break; default: INSIST(0); + ISC_UNREACHABLE(); } switch (key->key_alg) { @@ -623,6 +628,7 @@ pkcs11rsa_createctx(dst_key_t *key, dst_context_t *dctx) { break; default: INSIST(0); + ISC_UNREACHABLE(); } pk11_ctx = (pk11_context_t *) isc_mem_get(dctx->mctx, @@ -752,6 +758,7 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) { break; default: INSIST(0); + ISC_UNREACHABLE(); } switch (key->key_alg) { @@ -778,6 +785,7 @@ pkcs11rsa_sign(dst_context_t *dctx, isc_buffer_t *sig) { break; default: INSIST(0); + ISC_UNREACHABLE(); } dgstlen = derlen + hashlen; INSIST(dgstlen <= sizeof(digest)); @@ -993,6 +1001,7 @@ pkcs11rsa_verify(dst_context_t *dctx, const isc_region_t *sig) { break; default: INSIST(0); + ISC_UNREACHABLE(); } dgstlen = derlen + hashlen; INSIST(dgstlen <= sizeof(digest)); @@ -1184,6 +1193,7 @@ pkcs11rsa_generate(dst_key_t *key, int exp, void (*callback)(int)) { break; default: INSIST(0); + ISC_UNREACHABLE(); } pk11_ctx = (pk11_context_t *) isc_mem_get(key->mctx, diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 9fdbe583e3a..7ecd6ffbe90 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -6808,6 +6808,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname, break; default: INSIST(0); + ISC_UNREACHABLE(); } if (chainingp != NULL) diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index 798ce84c99f..c8d55208b7b 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -268,9 +268,8 @@ dns_rpz_policy2str(dns_rpz_policy_t policy) { str = "MISS"; break; default: - str = ""; - POST(str); INSIST(0); + ISC_UNREACHABLE(); } return (str); } diff --git a/lib/dns/rrl.c b/lib/dns/rrl.c index 70e308cd577..4b3ad7d67a5 100644 --- a/lib/dns/rrl.c +++ b/lib/dns/rrl.c @@ -465,8 +465,8 @@ get_rate(dns_rrl_t *rrl, dns_rrl_rtype_t rtype) { return (&rrl->all_per_second); default: INSIST(0); + ISC_UNREACHABLE(); } - return (NULL); } static int @@ -823,7 +823,7 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e, break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } switch (e->key.s.rtype) { @@ -852,6 +852,7 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e, break; default: INSIST(0); + ISC_UNREACHABLE(); } if (plural) diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c index f00fdb00bdb..e8331bf2eb3 100644 --- a/lib/dns/sdb.c +++ b/lib/dns/sdb.c @@ -1052,7 +1052,7 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) { UNUSED(node); UNUSED(now); INSIST(0); - return (ISC_R_UNEXPECTED); + ISC_UNREACHABLE(); } static void diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c index c7538c686cc..015a358c37a 100644 --- a/lib/dns/sdlz.c +++ b/lib/dns/sdlz.c @@ -781,7 +781,7 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) { UNUSED(node); UNUSED(now); INSIST(0); - return (ISC_R_UNEXPECTED); + ISC_UNREACHABLE(); } static void diff --git a/lib/dns/ssu.c b/lib/dns/ssu.c index 8767e0ab1a4..908569dba9a 100644 --- a/lib/dns/ssu.c +++ b/lib/dns/ssu.c @@ -291,6 +291,7 @@ reverse_from_address(dns_name_t *tcpself, const isc_netaddr_t *tcpaddr) { break; default: INSIST(0); + ISC_UNREACHABLE(); } isc_buffer_init(&b, buf, strlen(buf)); isc_buffer_add(&b, strlen(buf)); @@ -333,6 +334,7 @@ stf_from_address(dns_name_t *stfself, const isc_netaddr_t *tcpaddr) { break; default: INSIST(0); + ISC_UNREACHABLE(); } isc_buffer_init(&b, buf, strlen(buf)); isc_buffer_add(&b, strlen(buf)); diff --git a/lib/dns/tsec.c b/lib/dns/tsec.c index 084e354f239..4fb2bcc75f1 100644 --- a/lib/dns/tsec.c +++ b/lib/dns/tsec.c @@ -98,6 +98,7 @@ dns_tsec_create(isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key, break; default: INSIST(0); + ISC_UNREACHABLE(); } tsec->magic = DNS_TSEC_MAGIC; @@ -123,6 +124,7 @@ dns_tsec_destroy(dns_tsec_t **tsecp) { break; default: INSIST(0); + ISC_UNREACHABLE(); } tsec->magic = 0; @@ -152,5 +154,6 @@ dns_tsec_getkey(dns_tsec_t *tsec, void *keyp) { break; default: INSIST(0); + ISC_UNREACHABLE(); } } diff --git a/lib/dns/update.c b/lib/dns/update.c index 2cd439ee12f..120ab5939cc 100644 --- a/lib/dns/update.c +++ b/lib/dns/update.c @@ -1827,6 +1827,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, sigs++; } else { INSIST(0); + ISC_UNREACHABLE(); } ISC_LIST_UNLINK(state->nsec_mindiff.tuples, t, link); ISC_LIST_APPEND(state->work.tuples, t, link); @@ -2000,6 +2001,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, sigs++; } else { INSIST(0); + ISC_UNREACHABLE(); } ISC_LIST_UNLINK(state->nsec_mindiff.tuples, t, link); ISC_LIST_APPEND(state->work.tuples, t, link); @@ -2026,6 +2028,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, break; default: INSIST(0); + ISC_UNREACHABLE(); } failure: diff --git a/lib/dns/validator.c b/lib/dns/validator.c index d8983947048..60bc81bbc09 100644 --- a/lib/dns/validator.c +++ b/lib/dns/validator.c @@ -3704,10 +3704,8 @@ validator_start(isc_task_t *task, isc_event_t *event) { val->attributes |= VALATTR_NEEDNODATA; result = nsecvalidate(val, false); } else { - /* - * This shouldn't happen. - */ INSIST(0); + ISC_UNREACHABLE(); } if (result != DNS_R_WAIT) { diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index 024d6d9d056..f7e5cb3ab51 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -625,7 +625,7 @@ xfr_rr(dns_xfrin_ctx_t *xfr, dns_name_t *name, uint32_t ttl, /* FALLTHROUGH */ default: INSIST(0); - break; + ISC_UNREACHABLE(); } result = ISC_R_SUCCESS; failure: diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 6b52d102bc9..3f27bfd97a4 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -8982,6 +8982,7 @@ normalize_key(dns_rdata_t *rr, dns_rdata_t *target, break; default: INSIST(0); + ISC_UNREACHABLE(); } return (ISC_R_SUCCESS); } @@ -15806,7 +15807,8 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) { break; default: INSIST(0); - }; + ISC_UNREACHABLE(); + } UNLOCK_ZONE(zone); INSIST(isc_sockaddr_pf(&masteraddr) == isc_sockaddr_pf(&sourceaddr)); result = dns_xfrin_create(zone, xfrtype, &masteraddr, &sourceaddr, @@ -17259,6 +17261,7 @@ dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup) { break; default: INSIST(0); + ISC_UNREACHABLE(); } UNLOCK_ZONE(zone); } @@ -17334,6 +17337,7 @@ dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state) { break; default: INSIST(0); + ISC_UNREACHABLE(); } RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_read); diff --git a/lib/irs/getnameinfo.c b/lib/irs/getnameinfo.c index 0da6ba1eb9d..676575894a8 100644 --- a/lib/irs/getnameinfo.c +++ b/lib/irs/getnameinfo.c @@ -196,6 +196,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, default: INSIST(0); + ISC_UNREACHABLE(); } proto = ((flags & NI_DGRAM) != 0) ? "udp" : "tcp"; diff --git a/lib/isc/mem.c b/lib/isc/mem.c index f08dfc800f3..0b72e41e8d6 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -322,6 +322,7 @@ delete_trace_entry(isc__mem_t *mctx, const void *ptr, size_t size, * screwed. */ INSIST(0); + ISC_UNREACHABLE(); } #endif /* ISC_MEM_TRACKLINES */ @@ -2101,6 +2102,7 @@ isc_mem_checkdestroyed(FILE *file) { } #endif INSIST(0); + ISC_UNREACHABLE(); } UNLOCK(&contextslock); } diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index 56f6f4e08bb..be4e708e6af 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -346,6 +346,7 @@ isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) { #endif default: INSIST(0); + ISC_UNREACHABLE(); } } diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index 2fe1a5ba64f..aa64071213f 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -282,6 +282,7 @@ isc_sockaddr_anyofpf(isc_sockaddr_t *sockaddr, int pf) { break; default: INSIST(0); + ISC_UNREACHABLE(); } } @@ -359,6 +360,7 @@ isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na, break; default: INSIST(0); + ISC_UNREACHABLE(); } ISC_LINK_INIT(sockaddr, link); } diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index 3f0f1053c20..acfd65f0a09 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -128,7 +128,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src, break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } } diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index 7d663c2df43..907579413de 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -513,6 +513,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) { #endif default: INSIST(0); + ISC_UNREACHABLE(); } if (sendmsg(s, &msg, 0) < 0) { diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 0a79e2eeb11..364531e125b 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -1587,6 +1587,7 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) { case isc_sockettype_fdwatch: default: INSIST(0); + ISC_UNREACHABLE(); } if (sock->type == isc_sockettype_udp) { @@ -2250,7 +2251,7 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock, * sockets. */ INSIST(0); - break; + ISC_UNREACHABLE(); } } else { sock->fd = dup(dup_socket->fd); @@ -2609,6 +2610,7 @@ socket_create(isc_socketmgr_t *manager0, int pf, isc_sockettype_t type, break; default: INSIST(0); + ISC_UNREACHABLE(); } sock->pf = pf; diff --git a/lib/isc/win32/include/isc/stdatomic.h b/lib/isc/win32/include/isc/stdatomic.h index e429d0454c1..7a6aec9b5d0 100644 --- a/lib/isc/win32/include/isc/stdatomic.h +++ b/lib/isc/win32/include/isc/stdatomic.h @@ -80,7 +80,7 @@ static inline void atomic_store_abort() { INSIST(0); - return; + ISC_UNREACHABLE(); } #define atomic_store_explicit(obj, desired, order) \ @@ -120,7 +120,7 @@ static inline int8_t atomic_load_abort() { INSIST(0); - return (0); + ISC_UNREACHABLE(); } #define atomic_load_explicit(obj, order) \ @@ -160,7 +160,7 @@ static inline int8_t atomic_add_abort() { INSIST(0); - return (0); + ISC_UNREACHABLE(); } #define atomic_fetch_add_explicit(obj, arg, order) \ @@ -247,7 +247,7 @@ static inline bool atomic_compare_exchange_abort() { INSIST(0); - return (false); + ISC_UNREACHABLE(); } #define atomic_compare_exchange_strong_explicit(obj, expected, desired, \ diff --git a/lib/isc/win32/interfaceiter.c b/lib/isc/win32/interfaceiter.c index da6d282b049..6884221b30a 100644 --- a/lib/isc/win32/interfaceiter.c +++ b/lib/isc/win32/interfaceiter.c @@ -97,7 +97,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } } diff --git a/lib/isccc/sexpr.c b/lib/isccc/sexpr.c index 68dbe446c7b..bb9565b2fd6 100644 --- a/lib/isccc/sexpr.c +++ b/lib/isccc/sexpr.c @@ -202,6 +202,7 @@ isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream) { break; default: INSIST(0); + ISC_UNREACHABLE(); } } diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c index 02c18209849..47b15060bc0 100644 --- a/lib/isccfg/aclconf.c +++ b/lib/isccfg/aclconf.c @@ -389,6 +389,7 @@ get_subtype(const cfg_obj_t *obj, isc_log_t *lctx, return (subtype); default: INSIST(0); + ISC_UNREACHABLE(); } } @@ -583,8 +584,10 @@ parse_geoip_element(const cfg_obj_t *obj, isc_log_t *lctx, } else if (strcasecmp(stype, "netspeed") == 0) { subtype = dns_geoip_netspeed_id; de.geoip_elem.as_int = atoi(search); - } else + } else { INSIST(0); + ISC_UNREACHABLE(); + } de.geoip_elem.subtype = get_subtype(obj, lctx, subtype, dbname); diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 8abd76c6afd..7467b6af391 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -3262,12 +3262,14 @@ parse_querysource(cfg_parser_t *pctx, const cfg_type_t *type, unsigned int have_dscp = 0; const unsigned int *flagp = type->of; - if ((*flagp & CFG_ADDR_V4OK) != 0) + if ((*flagp & CFG_ADDR_V4OK) != 0) { isc_netaddr_any(&netaddr); - else if ((*flagp & CFG_ADDR_V6OK) != 0) + } else if ((*flagp & CFG_ADDR_V6OK) != 0) { isc_netaddr_any6(&netaddr); - else + } else { INSIST(0); + ISC_UNREACHABLE(); + } for (;;) { CHECK(cfg_peektoken(pctx, 0)); @@ -3355,6 +3357,7 @@ doc_querysource(cfg_printer_t *pctx, const cfg_type_t *type) { cfg_print_cstr(pctx, ""); } else { INSIST(0); + ISC_UNREACHABLE(); } cfg_print_cstr(pctx, " | * ) [ port ( | * ) ] ) | " "( [ [ address ] ( "); @@ -3364,6 +3367,7 @@ doc_querysource(cfg_printer_t *pctx, const cfg_type_t *type) { cfg_print_cstr(pctx, ""); } else { INSIST(0); + ISC_UNREACHABLE(); } cfg_print_cstr(pctx, " | * ) ] port ( | * ) ) )" " [ dscp ]"); @@ -4155,6 +4159,7 @@ cfg_print_zonegrammar(const unsigned int zonetype, break; default: INSIST(0); + ISC_UNREACHABLE(); } for (clause = clauses; clause->name != NULL; clause++) { diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 39c15ab3638..7211d9ef766 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -368,7 +368,7 @@ cfg_tuple_get(const cfg_obj_t *tupleobj, const char* name) { return (tupleobj->value.tuple[i]); } INSIST(0); - return (NULL); + ISC_UNREACHABLE(); } isc_result_t @@ -1982,6 +1982,7 @@ cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) { ; /* do nothing */ } else { INSIST(0); + ISC_UNREACHABLE(); } } } @@ -2297,6 +2298,7 @@ token_addr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na) { return (ISC_R_SUCCESS); } else { INSIST(0); + ISC_UNREACHABLE(); } } else { if ((flags & (CFG_ADDR_V4OK | CFG_ADDR_V4PREFIXOK)) != 0) { @@ -2571,7 +2573,7 @@ cfg_parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type, break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } CHECK(cfg_peektoken(pctx, 0)); if (pctx->token.type == isc_tokentype_special && diff --git a/lib/ns/client.c b/lib/ns/client.c index 6a8d2084989..60929a8dba4 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -645,6 +645,7 @@ exit_check(ns_client_t *client) { { isc_mem_stats(client->mctx, stderr); INSIST(0); + ISC_UNREACHABLE(); } /* @@ -1269,7 +1270,7 @@ client_send(ns_client_t *client) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } } else { #ifdef HAVE_DNSTAP @@ -1300,7 +1301,7 @@ client_send(ns_client_t *client) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } } @@ -1712,6 +1713,7 @@ ns_client_addopt(ns_client_t *client, dns_message_t *message, break; default: INSIST(0); + ISC_UNREACHABLE(); } isc_buffer_init(&buf, ecs, sizeof(ecs)); @@ -1857,6 +1859,7 @@ compute_cookie(ns_client_t *client, uint32_t when, uint32_t nonce, break; default: INSIST(0); + ISC_UNREACHABLE(); } /* @@ -1872,6 +1875,7 @@ compute_cookie(ns_client_t *client, uint32_t when, uint32_t nonce, default: INSIST(0); + ISC_UNREACHABLE(); } } @@ -2431,7 +2435,7 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } } else { switch (isc_sockaddr_pf(&client->peeraddr)) { @@ -2445,7 +2449,7 @@ ns__client_request(isc_task_t *task, isc_event_t *event) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } } diff --git a/lib/ns/query.c b/lib/ns/query.c index 39e87bca7d7..b1c6255d112 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -2637,7 +2637,7 @@ rpz_get_zbits(ns_client_t *client, break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } /* @@ -2861,6 +2861,7 @@ rpz_get_p_name(ns_client_t *client, dns_name_t *p_name, break; default: INSIST(0); + ISC_UNREACHABLE(); } /* @@ -3278,6 +3279,7 @@ dnsrps_rewrite_ip(ns_client_t *client, const isc_netaddr_t *netaddr, break; default: INSIST(0); + ISC_UNREACHABLE(); } do { @@ -3330,6 +3332,7 @@ dnsrps_rewrite_name(ns_client_t *client, dns_name_t *trig_name, break; default: INSIST(0); + ISC_UNREACHABLE(); } dns_name_toregion(trig_name, &r); @@ -6459,6 +6462,7 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) { return (ISC_R_COMPLETE); default: INSIST(0); + ISC_UNREACHABLE(); } /* @@ -8281,6 +8285,7 @@ query_nodata(query_ctx_t *qctx, isc_result_t result) { break; default: INSIST(0); + ISC_UNREACHABLE(); } SAVE(qctx->client->query.dns64_aaaa, qctx->rdataset); @@ -10606,7 +10611,7 @@ query_setup_sortlist(query_ctx_t *qctx) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } } diff --git a/lib/ns/tests/query_test.c b/lib/ns/tests/query_test.c index 81818c2d9ba..554893f6427 100644 --- a/lib/ns/tests/query_test.c +++ b/lib/ns/tests/query_test.c @@ -379,7 +379,7 @@ ns__query_start_test(const ns__query_start_test_params_t *test) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } /* diff --git a/lib/ns/xfrout.c b/lib/ns/xfrout.c index 04102762094..e6810048076 100644 --- a/lib/ns/xfrout.c +++ b/lib/ns/xfrout.c @@ -764,7 +764,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { break; default: INSIST(0); - break; + ISC_UNREACHABLE(); } ns_client_log(client,