]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Hint the compiler with ISC_UNREACHABLE(); that code after INSIST(0); cannot be reached
authorOndřej Surý <ondrej@sury.org>
Wed, 7 Nov 2018 08:00:07 +0000 (15:00 +0700)
committerOndřej Surý <ondrej@sury.org>
Thu, 8 Nov 2018 05:22:17 +0000 (12:22 +0700)
53 files changed:
bin/check/named-checkconf.c
bin/check/named-checkzone.c
bin/confgen/ddns-confgen.c
bin/delv/delv.c
bin/dig/dighost.c
bin/named/config.c
bin/named/logconf.c
bin/named/server.c
bin/named/zoneconf.c
lib/bind9/check.c
lib/dns/acl.c
lib/dns/client.c
lib/dns/diff.c
lib/dns/dispatch.c
lib/dns/dnsrps.c
lib/dns/dnstap.c
lib/dns/geoip.c
lib/dns/hmac_link.c
lib/dns/journal.c
lib/dns/masterdump.c
lib/dns/message.c
lib/dns/openssleddsa_link.c
lib/dns/opensslrsa_link.c
lib/dns/peer.c
lib/dns/pkcs11rsa_link.c
lib/dns/resolver.c
lib/dns/rpz.c
lib/dns/rrl.c
lib/dns/sdb.c
lib/dns/sdlz.c
lib/dns/ssu.c
lib/dns/tsec.c
lib/dns/update.c
lib/dns/validator.c
lib/dns/xfrin.c
lib/dns/zone.c
lib/irs/getnameinfo.c
lib/isc/mem.c
lib/isc/netaddr.c
lib/isc/sockaddr.c
lib/isc/unix/interfaceiter.c
lib/isc/unix/net.c
lib/isc/unix/socket.c
lib/isc/win32/include/isc/stdatomic.h
lib/isc/win32/interfaceiter.c
lib/isccc/sexpr.c
lib/isccfg/aclconf.c
lib/isccfg/namedconf.c
lib/isccfg/parser.c
lib/ns/client.c
lib/ns/query.c
lib/ns/tests/query_test.c
lib/ns/xfrout.c

index 1f1acb0de0975405d7e1076226e95e35f5ebd3d0..753f5ba69c37a1bac0404335d606fe3cdec8b1e5 100644 (file)
@@ -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;
index a51e57dd5fe855d4894bdfe9d64daca35c9c791d..061e39c5cc8ed63aadd13e60df661e7f3ef7e825 100644 (file)
@@ -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) {
index 18322465b09ae3f71f9168e7f166fd602b65bfab..56e56da34aa0c6ab4b2070de1e8913ee0ca100bf 100644 (file)
@@ -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;
 
index 53cd971e30079ffc2e90eeaeca80e03d88053e8a..e83a35de57bc7ae59a706f84d663ee793e555048 100644 (file)
@@ -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];
index daf7a923dd453640aaae07d9cfcfb102621d24d8..f4e5e55ae6e95a4107a227ac37ddf78c4dbff0f0 100644 (file)
@@ -2348,6 +2348,7 @@ setup_lookup(dig_lookup_t *lookup) {
                                break;
                        default:
                                INSIST(0);
+                               ISC_UNREACHABLE();
                        }
 
                        isc_buffer_init(&b, ecsbuf, sizeof(ecsbuf));
index 9ce79bfd57484fba852b3302e1fd81d2864d1a75..3b15ad2974ac529ce0a619593e8f1cb36c67d926 100644 (file)
@@ -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)
index d60e7fc8f064a73edf2609e0405da9888f2b58c9..f3dea3a6fcff1abe0e5f49188996ee05dec0e5dd 100644 (file)
@@ -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;
index 2aecc630923aa20ab27c0fd8cb820d24bb80bbf9..ee75c1b3b7eba194ced8a73a80d30af4837c0030 100644 (file)
@@ -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) {
index f01004a8ba0b17fff98390555d63eef3dccd69c5..e365089abccb3869f70dd042a613a6edb623f54a 100644 (file)
@@ -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;
index 8928e10a5eb213e0bd66d763c8d2686ee6cf0ae4..cdbc7270e4e01fbd96596beb2e42d33cf4a1c33f 100644 (file)
@@ -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) {
index 69d3b524bdc8e3848e2f80fb4f47cb04a828ae67..f941512a463baa183f1ca0ca77fc45ea6ae77124 100644 (file)
@@ -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();
                }
        }
 
index 4a196156a3656c01b37a5079e9a0f742ec5b0c8d..6c96a40b30040b667b7d7a072b71f872a0e374de 100644 (file)
@@ -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;
index 910326f38bcc624f00d17e4d18f516cd55ab69d5..3fac1e7478971515686cb1c5a9e6d8ef49a9b624 100644 (file)
@@ -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) {
index 007b35e0c17ca608c7a8a27f3f59dfe9fa9ad0d2..e46cd055cdf6ec6ec0cc3fbf9ebe421f988418fb 100644 (file)
@@ -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);
index a85e48ca69319b91b2cb3ebdf8abe48cebed5d77..b217b795d8e48c43e755adac0d49fbc721a6197d 100644 (file)
@@ -311,6 +311,7 @@ dns_dnsrps_2policy(librpz_policy_t rps_policy) {
        case LIBRPZ_POLICY_DISABLED:
        default:
                INSIST(0);
+               ISC_UNREACHABLE();
        }
 }
 
index 3368d9010523d2e1cbdd1fb12cf111863c70b0b7..d93e22d103db57c15aa15579f9914c42bc9a22f6 100644 (file)
@@ -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);
index 4ebc1a143e8396c6adf501e5da8df0f0d0831b8f..49bdd7faac527b1f5a87f6d13851aca61f095316 100644 (file)
@@ -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);
index 71d1b6a2b5a45073240c61936d3052df6214a5c6..39e39179316f1ab2121c05c3899ce860cd1e63eb 100644 (file)
@@ -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();
        }
 }
 
index b8bbe78c812a4bffcbbeb20e39e969108e647316..4a820382860b9debdc46b1a9fa256de2ca0915a2 100644 (file)
@@ -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;
index 796a5955a8ef2042cb19dafaa2f6ebc3a64edc0c..df779c6a432d7837ac1ce8c5313bca269acd8777 100644 (file)
@@ -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);
index ec6dde5155fc5eb7442b103d99107ffb6e9bb873..4a811d28dbc9b62933984c420a3f216be64a0bab 100644 (file)
@@ -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
index 86b771f2f350fb6badf4e089c735a8c2f3685840..ffe5c239d82d6b715ed4a21274b639618c7033ab 100644 (file)
@@ -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
index fabdd2f59e971cd16d9e7e98cb9f327c9faa87e1..4ae80c37d40540efc26651855a86af6c64f5d32c 100644 (file)
@@ -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)
index 89447cc545ecc7918b6af08d4bd2367afc835245..85f895a2cba3ba34e90a325b11963842a3f69ae7 100644 (file)
@@ -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));
index ef452d58fd61ccfad82d06010b4ba8e4b0f819b4..133c4a05945ffb007c5a6c3211d3174c20ff7d8d 100644 (file)
@@ -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,
index 9fdbe583e3a9fbade81d1bd8d746a666bc835b83..7ecd6ffbe9014b7006da81cf90ee00e97fd86012 100644 (file)
@@ -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)
index 798ce84c99f44616f84f8f13310d5a74e28999df..c8d55208b7b6fb2ba88d0b90a8dbdacc90b16e2d 100644 (file)
@@ -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);
 }
index 70e308cd5777487dd83e53e2c4909160c5bb49c9..4b3ad7d67a59f58f7dd89c41fe9e485290656dfa 100644 (file)
@@ -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)
index f00fdb00bdbaa83b2a7d29c4c6289ac7b040a0c4..e8331bf2eb3bea4a32bc468673305565aa43476c 100644 (file)
@@ -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
index c7538c686cc9aeace1422dad1f17484d91c9aa74..015a358c37a916e2199b9a665090ac75bca46a2b 100644 (file)
@@ -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
index 8767e0ab1a4ccaacf7e251cf088d2f0c0835ffe0..908569dba9a757b67f069ab0b4f2d249c025717d 100644 (file)
@@ -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));
index 084e354f239e2e4a0aec45ec1e931c1bd724efc3..4fb2bcc75f188c7085436334413927e1ff4a1d66 100644 (file)
@@ -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();
        }
 }
index 2cd439ee12f7bf8ed03696e604c36cad2235c038..120ab5939cc39a3962a7b30bd08540eeac2204aa 100644 (file)
@@ -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:
index d8983947048d3dd148735294c7037c8300318e29..60bc81bbc09bc8a63f5ba166480e14cc4aaa35dd 100644 (file)
@@ -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) {
index 024d6d9d0569b2c6f15d81f3c2287fcb6f0d1133..f7e5cb3ab51d3c41587e932d28e5ab6ad3d5565a 100644 (file)
@@ -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:
index 6b52d102bc90fc21a6f5c66cd0c498931e41f3bc..3f27bfd97a4775bfad903f29263d4ee20e0e5373 100644 (file)
@@ -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);
index 0da6ba1eb9d3ba01e486152ac0908d148ca795c6..676575894a8de4b06d8e57b7331fa182e52b5ac1 100644 (file)
@@ -196,6 +196,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen,
 
        default:
                INSIST(0);
+               ISC_UNREACHABLE();
        }
        proto = ((flags & NI_DGRAM) != 0) ? "udp" : "tcp";
 
index f08dfc800f340c719db87348ff9c881e75744af6..0b72e41e8d69859c63c40376e8eed15e1a30b136 100644 (file)
@@ -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);
 }
index 56f6f4e08bb835af33d4c7669d184beb2537be86..be4e708e6af4ae499d673ae29d325f341765333a 100644 (file)
@@ -346,6 +346,7 @@ isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) {
 #endif
        default:
                INSIST(0);
+               ISC_UNREACHABLE();
        }
 }
 
index 2fe1a5ba64fd7b7443b4e5091e7df60bc3d882d0..aa64071213f59d9c7d3d2808a1b214b45d3a9bc8 100644 (file)
@@ -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);
 }
index 3f0f1053c20237f736614633b977ffb913b24ab6..acfd65f0a09bb311afbc934ca63940790171f5e4 100644 (file)
@@ -128,7 +128,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
                break;
        default:
                INSIST(0);
-               break;
+               ISC_UNREACHABLE();
        }
 }
 
index 7d663c2df43fa3646e86f6e08b8c0403aa286bec..907579413dec37e29996d511b5f1f2fe5aeec573 100644 (file)
@@ -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) {
index 0a79e2eeb1101d27a17acc4055ec4df314c0c596..364531e125b1d29ef709c0faa82f93de866208e4 100644 (file)
@@ -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;
index e429d0454c151f71bc781117d72b2cd0dcb40c7c..7a6aec9b5d05d9ee9cb98a9eb5fbfeebc645c74e 100644 (file)
@@ -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, \
index da6d282b0494425c39813724d9bd6d7e889f1ac9..6884221b30adf98e13fd7ce67700269b65a3f488 100644 (file)
@@ -97,7 +97,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src) {
                break;
        default:
                INSIST(0);
-               break;
+               ISC_UNREACHABLE();
        }
 }
 
index 68dbe446c7b3a839d46fb09a6e5dba2f29c3b262..bb9565b2fd6ce17e2fa03c7431517319a5e0cd1d 100644 (file)
@@ -202,6 +202,7 @@ isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream) {
                break;
        default:
                INSIST(0);
+               ISC_UNREACHABLE();
        }
 }
 
index 02c18209849aee0ba6d8821de80e3fe00c514443..47b15060bc078432cb2afb21e0abf2605f27777d 100644 (file)
@@ -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);
 
index 8abd76c6afdcabfe2e1b4904aff9d0f3ce77d878..7467b6af3911f439f9c45548046bf9ab34ea6ea4 100644 (file)
@@ -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, "<ipv6_address>");
        } else {
                INSIST(0);
+               ISC_UNREACHABLE();
        }
        cfg_print_cstr(pctx, " | * ) [ port ( <integer> | * ) ] ) | "
                       "( [ [ address ] ( ");
@@ -3364,6 +3367,7 @@ doc_querysource(cfg_printer_t *pctx, const cfg_type_t *type) {
                cfg_print_cstr(pctx, "<ipv6_address>");
        } else {
                INSIST(0);
+               ISC_UNREACHABLE();
        }
        cfg_print_cstr(pctx, " | * ) ] port ( <integer> | * ) ) )"
                       " [ dscp <integer> ]");
@@ -4155,6 +4159,7 @@ cfg_print_zonegrammar(const unsigned int zonetype,
                break;
        default:
                INSIST(0);
+               ISC_UNREACHABLE();
        }
 
        for (clause = clauses; clause->name != NULL; clause++) {
index 39c15ab363872a32d7c22f3f7472b1de010852d8..7211d9ef7661541d3e201fefe31ba2dcc409cc6a 100644 (file)
@@ -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 &&
index 6a8d2084989a6568e45c4946bb6d096cbbcf48b5..60929a8dba4c1e205833b2e90a0a4b58b14c07b5 100644 (file)
@@ -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();
                }
        }
 
index 39e87bca7d7c4ef5681e9084aac058e94e49f132..b1c6255d1126bdd057df89e921918609cb90433c 100644 (file)
@@ -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();
        }
 }
 
index 81818c2d9bae21782c7b852e4947e78e039fb185..554893f6427dd01c343667dd5512429ea3916e1d 100644 (file)
@@ -379,7 +379,7 @@ ns__query_start_test(const ns__query_start_test_params_t *test) {
                break;
        default:
                INSIST(0);
-               break;
+               ISC_UNREACHABLE();
        }
 
        /*
index 041027620946132b5828f0727c77ebe8978e4053..e681004807668b1245d783c4d6cb1b6348473c32 100644 (file)
@@ -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,