Simplify way we tag unreachable code with only ISC_UNREACHABLE()

Previously, the unreachable code paths would have to be tagged with:

    INSIST(0);
    ISC_UNREACHABLE();

There was also older parts of the code that used comment annotation:

    /* NOTREACHED */

Unify the handling of unreachable code paths to just use:

    UNREACHABLE();

The UNREACHABLE() macro now asserts when reached and also uses
__builtin_unreachable(); when such builtin is available in the compiler.
This commit is contained in:
Ondřej Surý 2021-10-11 12:50:17 +02:00 committed by Ondřej Surý
parent fe7ce629f4
commit 584f0d7a7e
91 changed files with 246 additions and 439 deletions

View file

@ -306,8 +306,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
zone_options &= ~DNS_ZONEOPT_CHECKDUPRR;
zone_options &= ~DNS_ZONEOPT_CHECKDUPRRFAIL;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
zone_options |= DNS_ZONEOPT_CHECKDUPRR;
@ -326,8 +325,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
zone_options &= ~DNS_ZONEOPT_CHECKMX;
zone_options &= ~DNS_ZONEOPT_CHECKMXFAIL;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
zone_options |= DNS_ZONEOPT_CHECKMX;
@ -357,8 +355,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
zone_options |= DNS_ZONEOPT_WARNMXCNAME;
zone_options |= DNS_ZONEOPT_IGNOREMXCNAME;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
zone_options |= DNS_ZONEOPT_WARNMXCNAME;
@ -377,8 +374,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
zone_options |= DNS_ZONEOPT_WARNSRVCNAME;
zone_options |= DNS_ZONEOPT_IGNORESRVCNAME;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
zone_options |= DNS_ZONEOPT_WARNSRVCNAME;
@ -401,8 +397,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
zone_options &= ~DNS_ZONEOPT_CHECKSPF;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
zone_options |= DNS_ZONEOPT_CHECKSPF;
@ -420,8 +415,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
zone_options &= ~DNS_ZONEOPT_CHECKNAMES;
zone_options &= ~DNS_ZONEOPT_CHECKNAMESFAIL;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
zone_options |= DNS_ZONEOPT_CHECKNAMES;
@ -437,8 +431,7 @@ configure_zone(const char *vclass, const char *view, const cfg_obj_t *zconfig,
} else if (strcasecmp(masterformatstr, "raw") == 0) {
masterformat = dns_masterformat_raw;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -147,8 +147,7 @@ main(int argc, char **argv) {
} else if (PROGCMP("named-compilezone")) {
progmode = progmode_compile;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/* Compilation specific defaults */

View file

@ -121,8 +121,7 @@ main(int argc, char **argv) {
} else if (PROGCMP("ddns-confgen")) {
progmode = progmode_confgen;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_commandline_errprint = false;

View file

@ -1325,7 +1325,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
case 'h':
usage();
exit(0);
/* NOTREACHED */
UNREACHABLE();
case 'i':
no_sigs = true;
root_validation = false;
@ -1336,10 +1336,9 @@ dash_option(char *option, char *next, bool *open_type_class) {
case 'v':
printf("delv %s\n", PACKAGE_VERSION);
exit(0);
/* NOTREACHED */
UNREACHABLE();
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (strlen(option) > 1U) {
option = &option[1];
@ -1477,7 +1476,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
fprintf(stderr, "Invalid option: -%s\n", option);
usage();
}
/* NOTREACHED */
UNREACHABLE();
return (false);
}

View file

@ -2115,7 +2115,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
have_ipv6 = false;
} else {
fatal("can't find IPv4 networking");
/* NOTREACHED */
UNREACHABLE();
return (false);
}
break;
@ -2125,7 +2125,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
have_ipv4 = false;
} else {
fatal("can't find IPv6 networking");
/* NOTREACHED */
UNREACHABLE();
return (false);
}
break;
@ -2377,7 +2377,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
fprintf(stderr, "Invalid option: -%s\n", option);
usage();
}
/* NOTREACHED */
UNREACHABLE();
return (false);
}

View file

@ -2468,8 +2468,7 @@ setup_lookup(dig_lookup_t *lookup) {
memmove(addr, &sin6->sin6_addr, addrl);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_buffer_init(&b, ecsbuf, sizeof(ecsbuf));

View file

@ -616,7 +616,7 @@ main(int argc, char **argv) {
dns_secalg_format(alg, algstr, sizeof(algstr));
fatal("failed to get key %s/%s: %s", namestr, algstr,
isc_result_totext(ret));
/* NOTREACHED */
UNREACHABLE();
exit(-1);
}

View file

@ -461,7 +461,7 @@ expecttofindkey(dns_name_t *name) {
dns_name_format(name, namestr, sizeof(namestr));
fatal("failure looking for '%s DNSKEY' in database: %s", namestr,
isc_result_totext(result));
/* NOTREACHED */
UNREACHABLE();
return (false); /* removes a warning */
}

View file

@ -217,7 +217,7 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
default:
fatal("time value %s is invalid", str);
}
/* NOTREACHED */
UNREACHABLE();
break;
case 'W':
case 'w':
@ -235,7 +235,7 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
default:
fatal("time value %s is invalid", str);
}
/* NOTREACHED */
UNREACHABLE();
return (0); /* silence compiler warning */
}

View file

@ -453,8 +453,7 @@ named_config_getzonetype(const cfg_obj_t *zonetypeobj) {
} else if (strcasecmp(str, "redirect") == 0) {
ztype = dns_zone_redirect;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (ztype);
}
@ -1066,8 +1065,7 @@ named_config_getkeyalgorithm2(const char *str, const dns_name_t **name,
*name = dns_tsig_hmacsha512_name;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
if (typep != NULL) {

View file

@ -161,8 +161,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
maxoffset = 0x7fffffffffffffffULL;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
type = ISC_LOG_TOFILE;

View file

@ -728,8 +728,7 @@ parse_port(char *arg) {
named_g_httpport = port;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -866,8 +866,7 @@ ta_fromconfig(const cfg_obj_t *key, bool *initialp, const char **namestrp,
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (ISC_R_SUCCESS);
@ -1273,8 +1272,7 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af,
INSIST(result == ISC_R_SUCCESS);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
sa = *(cfg_obj_assockaddr(obj));
@ -1296,8 +1294,7 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af,
result = isc_net_probeipv6();
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (result != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
@ -1401,8 +1398,7 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) {
} else if (!strcasecmp(str, "none")) {
mode = DNS_RDATASETATTR_NONE;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/*
@ -1558,8 +1554,7 @@ configure_peer(const cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
} else if (strcasecmp(str, "one-answer") == 0) {
CHECK(dns_peer_settransferformat(peer, dns_one_answer));
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2933,7 +2928,7 @@ catz_create_chg_task(dns_catz_entry_t *entry, dns_catz_zone_t *origin,
break;
default:
REQUIRE(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
event = (catz_chgzone_event_t *)isc_event_allocate(
@ -4329,8 +4324,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
} else if (strcasecmp(str, "ignore") == 0) {
view->checknames = false;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
obj = NULL;
@ -4784,8 +4778,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
} else if (strcasecmp(resp, "fail") == 0) {
r = DNS_R_SERVFAIL;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_resolver_setquotaresponse(view->resolver,
@ -5184,8 +5177,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
} else if (strcasecmp(str, "no-auth-recursive") == 0) {
view->minimalresponses = dns_minimal_noauthrec;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -5198,8 +5190,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
} else if (strcasecmp(str, "one-answer") == 0) {
view->transfer_format = dns_one_answer;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
obj = NULL;
@ -5511,8 +5502,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
} else if (strcasecmp(resp, "fail") == 0) {
r = DNS_R_SERVFAIL;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_resolver_setquotaresponse(view->resolver,
@ -5739,8 +5729,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
} else if (strcasecmp(levelstr, "none") == 0) {
statlevel = dns_zonestat_none;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -6281,8 +6270,7 @@ configure_forward(const cfg_obj_t *config, dns_view_t *view,
} else if (strcasecmp(forwardstr, "only") == 0) {
fwdpolicy = dns_fwdpolicy_only;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
}
@ -9575,8 +9563,7 @@ load_configuration(const char *filename, named_server_t *server,
} else if (strcasecmp(cfg_obj_asstring(obj), "aes") == 0) {
server->sctx->cookiealg = ns_cookiealg_aes;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
obj = NULL;
@ -13654,8 +13641,7 @@ newzone_parse(named_server_t *server, char *command, dns_view_t **viewp,
} else if (strncasecmp(command, "mod", 3) == 0) {
bn = "modzone";
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/*
@ -16350,8 +16336,7 @@ named_server_mkeys(named_server_t *server, isc_lex_t *lex,
CHECK(mkey_destroy(server, view, text));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (viewtxt != NULL) {

View file

@ -133,8 +133,7 @@ configure_zone_acl(const cfg_obj_t *zconfig, const cfg_obj_t *vconfig,
aclname = "allow-update-forwarding";
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/* First check to see if ACL is defined within the zone */
@ -246,8 +245,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
} else if (strcasecmp(str, "deny") == 0) {
grant = false;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
str = cfg_obj_asstring(matchtype);
@ -759,8 +757,7 @@ checknames(dns_zonetype_t ztype, const cfg_obj_t **maps,
result = named_checknames_get(maps, primary_synonyms, objp);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
INSIST(result == ISC_R_SUCCESS && objp != NULL && *objp != NULL);
@ -1041,8 +1038,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(masterformatstr, "raw") == 0) {
masterformat = dns_masterformat_raw;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -1065,8 +1061,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(masterstylestr, "relative") == 0) {
masterstyle = &dns_master_style_default;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -1159,8 +1154,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(dialupstr, "passive") == 0) {
dialup = dns_dialuptype_passive;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
if (raw != NULL) {
@ -1186,8 +1180,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(levelstr, "none") == 0) {
statlevel = dns_zonestat_none;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
dns_zone_setstatlevel(zone, statlevel);
@ -1266,8 +1259,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
{
notifytype = dns_notifytype_masteronly;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
notifytype = process_notifytype(notifytype, ztype, zname,
@ -1460,8 +1452,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
fail = check = false;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (raw != NULL) {
dns_zone_setoption(raw, DNS_ZONEOPT_CHECKNAMES, check);
@ -1495,8 +1486,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
check = false;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_zone_setoption(zone, DNS_ZONEOPT_CHECKSPF, check);
@ -1696,8 +1686,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(arg, "off") == 0) {
/* Default */
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_zone_setkeyopt(zone, DNS_ZONEKEY_ALLOW, allow);
dns_zone_setkeyopt(zone, DNS_ZONEKEY_CREATE, false);
@ -1756,8 +1745,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(dupcheck, "ignore") == 0) {
fail = check = false;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKDUPRR, check);
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKDUPRRFAIL, fail);
@ -1773,8 +1761,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
fail = check = false;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKMX, check);
dns_zone_setoption(mayberaw, DNS_ZONEOPT_CHECKMXFAIL, fail);
@ -1796,8 +1783,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
warn = ignore = true;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNMXCNAME, warn);
dns_zone_setoption(mayberaw, DNS_ZONEOPT_IGNOREMXCNAME, ignore);
@ -1813,8 +1799,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(cfg_obj_asstring(obj), "ignore") == 0) {
warn = ignore = true;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_zone_setoption(mayberaw, DNS_ZONEOPT_WARNSRVCNAME, warn);
dns_zone_setoption(mayberaw, DNS_ZONEOPT_IGNORESRVCNAME,
@ -1837,8 +1822,7 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
} else if (strcasecmp(arg, "maintain") == 0) {
/* Default */
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -592,8 +592,7 @@ rndc_startconnect(isc_sockaddr_t *addr) {
*/
fatal("UNIX domain sockets not currently supported");
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
atomic_fetch_add_relaxed(&connects, 1);

View file

@ -83,8 +83,7 @@ main(int argc, char **argv) {
#ifdef USE_DNSRPS
printf("%s\n", librpz->dnsrpzd_path);
#else /* ifdef USE_DNSRPS */
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
#endif /* ifdef USE_DNSRPS */
return (0);
@ -134,8 +133,7 @@ main(int argc, char **argv) {
librpz->client_detach(&client);
printf("%u\n", serial);
#else /* ifdef USE_DNSRPS */
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
#endif /* ifdef USE_DNSRPS */
return (0);

View file

@ -432,8 +432,7 @@ run(void) {
} break;
#endif
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
waitforsignal();

View file

@ -302,8 +302,7 @@ run(void) {
} break;
#endif
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
REQUIRE(result == ISC_R_SUCCESS);

View file

@ -58,7 +58,7 @@ fromhex(char c) {
fprintf(stderr, "bad input format: %02x\n", c);
exit(3);
/* NOTREACHED */
UNREACHABLE();
}
static void

View file

@ -1698,7 +1698,7 @@ dash_option(const char *option, char *next, struct query *query, bool global,
have_ipv6 = false;
} else {
fatal("can't find IPv4 networking");
/* NOTREACHED */
UNREACHABLE();
return (false);
}
break;
@ -1709,7 +1709,7 @@ dash_option(const char *option, char *next, struct query *query, bool global,
have_ipv4 = false;
} else {
fatal("can't find IPv6 networking");
/* NOTREACHED */
UNREACHABLE();
return (false);
}
break;
@ -1817,7 +1817,7 @@ dash_option(const char *option, char *next, struct query *query, bool global,
fprintf(stderr, "Invalid option: -%s\n", option);
usage();
}
/* NOTREACHED */
UNREACHABLE();
return (false);
}

View file

@ -1,6 +1,13 @@
@@
@@
INSIST(0);
+ ISC_UNREACHABLE();
... when != ISC_UNREACHABLE();
- INSIST(0);
+ UNREACHABLE();
... when != UNREACHABLE();
@@
@@
- INSIST(0);
- ISC_UNREACHABLE();
+ UNREACHABLE();

View file

@ -699,7 +699,7 @@ fnmatch(const char *pattern, const char *string, int flags) {
break;
}
}
/* NOTREACHED */
UNREACHABLE();
}
static int

View file

@ -142,12 +142,10 @@ Good:
static char * c /* Description of 'c'. */
The following lint and lint-like comments should be used where appropriate:
The following macros should be used where appropriate:
/* ARGSUSED */
FALLTHROUGH;
/* NOTREACHED */
/* VARARGS */
UNREACHABLE();
#### Header files

View file

@ -2654,8 +2654,7 @@ check_update_policy(const cfg_obj_t *policy, isc_log_t *logctx) {
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
for (element2 = cfg_list_first(typelist); element2 != NULL;
@ -3054,8 +3053,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -464,8 +464,7 @@ dns_aclelement_match(const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner,
return (dns_geoip_match(reqaddr, env->geoip, &e->geoip_elem));
#endif /* if defined(HAVE_GEOIP2) */
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
result = dns_acl_match(reqaddr, reqsigner, inner, env, &indirectmatch,
@ -658,8 +657,7 @@ dns_acl_isinsecure(const dns_acl_t *a) {
return (true);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -372,8 +372,7 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, bool warn) {
&ardataset);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (result == ISC_R_SUCCESS) {

View file

@ -1543,8 +1543,7 @@ dispatch_getnext(dns_dispatch_t *disp, dns_dispentry_t *resp, int32_t timeout) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -1710,8 +1709,7 @@ startrecv(isc_nmhandle_t *handle, dns_dispatch_t *disp, dns_dispentry_t *resp) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -1838,8 +1836,7 @@ dns_dispatch_connect(dns_dispentry_t *resp) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
break;

View file

@ -311,8 +311,7 @@ dns_dnsrps_2policy(librpz_policy_t rps_policy) {
case LIBRPZ_POLICY_GIVEN:
case LIBRPZ_POLICY_DISABLED:
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -635,8 +635,7 @@ dnstap_type(dns_dtmsgtype_t msgtype) {
case DNS_DTTYPE_UR:
return (DNSTAP__MESSAGE__TYPE__UPDATE_RESPONSE);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -985,8 +984,7 @@ dns_dt_open(const char *filename, dns_dtmode_t mode, isc_mem_t *mctx,
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_mem_attach(mctx, &handle->mctx);

View file

@ -63,8 +63,7 @@ dns_ds_fromkeyrdata(const dns_name_t *owner, dns_rdata_t *key,
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
name = dns_fixedname_initname(&fname);

View file

@ -66,8 +66,7 @@ dns_ecs_equals(const dns_ecs_t *ecs1, const dns_ecs_t *ecs2) {
addr2 = (const unsigned char *)&ecs2->addr.type.in6;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/*

View file

@ -370,8 +370,7 @@ hmac__get_tag_key(const isc_md_type_t *type) {
} else if (type == ISC_MD_SHA512) {
return (TAG_HMACSHA512_KEY);
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -390,8 +389,7 @@ hmac__get_tag_bits(const isc_md_type_t *type) {
} else if (type == ISC_MD_SHA512) {
return (TAG_HMACSHA512_BITS);
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -443,8 +441,7 @@ hmac__to_dst_alg(const isc_md_type_t *type) {
} else if (type == ISC_MD_SHA512) {
return (DST_ALG_HMACSHA512);
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -825,8 +825,7 @@ ixfr_order(const void *av, const void *bv) {
aop = 0;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
switch (b->op) {
@ -839,8 +838,7 @@ ixfr_order(const void *av, const void *bv) {
bop = 0;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
r = bop - aop;

View file

@ -1366,8 +1366,7 @@ keymgr_transition_time(dns_dnsseckey_t *key, int type,
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
break;
}

View file

@ -540,8 +540,7 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, unsigned int options,
lctx->load = load_raw;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (lex != NULL) {

View file

@ -1580,8 +1580,7 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
dctx->dumpsets = dump_rdatasets_raw;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
result = totext_ctx_init(style, NULL, &dctx->tctx);
@ -1701,8 +1700,7 @@ writeheader(dns_dumpctx_t *dctx) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_mem_put(dctx->mctx, buffer.base, buffer.length);

View file

@ -883,8 +883,7 @@ getname(dns_name_t *name, isc_buffer_t *source, dns_message_t *msg,
}
}
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
static isc_result_t

View file

@ -1475,7 +1475,7 @@ dns_name_totext2(const dns_name_t *name, unsigned int options,
} else {
FATAL_ERROR(__FILE__, __LINE__,
"Unexpected label type %02x", count);
/* NOTREACHED */
UNREACHABLE();
}
/*
@ -1599,7 +1599,7 @@ dns_name_tofilenametext(const dns_name_t *name, bool omit_final_dot,
} else {
FATAL_ERROR(__FILE__, __LINE__,
"Unexpected label type %02x", count);
/* NOTREACHED */
UNREACHABLE();
}
/*

View file

@ -1153,8 +1153,7 @@ dst__key_to_eckey(dst_key_t *key, EC_KEY **eckey) {
group_nid = NID_secp384r1;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
*eckey = EC_KEY_new_by_curve_name(group_nid);

View file

@ -83,8 +83,7 @@ opensslrsa_createctx(dst_key_t *key, dst_context_t *dctx) {
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
evp_md_ctx = EVP_MD_CTX_create();
@ -104,8 +103,7 @@ opensslrsa_createctx(dst_key_t *key, dst_context_t *dctx) {
type = EVP_sha512();
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (!EVP_DigestInit_ex(evp_md_ctx, type, NULL)) {
@ -426,8 +424,7 @@ opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) {
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (exp == 0) {

View file

@ -251,8 +251,7 @@ dns_peer_new(isc_mem_t *mem, const isc_netaddr_t *addr, dns_peer_t **peerptr) {
prefixlen = 128;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (dns_peer_newprefix(mem, addr, prefixlen, peerptr));

View file

@ -1805,8 +1805,7 @@ nexttable:
}
/* We haven't found any matching node, this should not be possible. */
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
static inline void

View file

@ -4440,7 +4440,7 @@ zone_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
FATAL_ERROR(__FILE__, __LINE__, "zone_findzonecut() called!");
/* NOTREACHED */
UNREACHABLE();
return (ISC_R_NOTIMPLEMENTED);
}
@ -7606,8 +7606,7 @@ nodecount(dns_db_t *db, dns_dbtree_t tree) {
count = dns_rbt_nodecount(rbtdb->nsec3);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);

View file

@ -116,8 +116,7 @@ fromtext_amtrelay(ARGS_FROMTEXT) {
return (dns_name_fromtext(&name, &buffer, origin, options,
target));
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -178,8 +177,7 @@ totext_amtrelay(ARGS_TOTEXT) {
return (dns_name_totext(&name, false, target));
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (ISC_R_SUCCESS);
}

View file

@ -272,8 +272,7 @@ loc_getlatitude(isc_lex_t *lexer, unsigned long *latitude) {
*latitude = 0x80000000 - (d1 * 3600 + m1 * 60) * 1000 - s1;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (ISC_R_SUCCESS);
@ -294,8 +293,7 @@ loc_getlongitude(isc_lex_t *lexer, unsigned long *longitude) {
*longitude = 0x80000000 - (d2 * 3600 + m2 * 60) * 1000 - s2;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (ISC_R_SUCCESS);

View file

@ -322,8 +322,7 @@ svc_fromtext(isc_textregion_t *region, isc_buffer_t *target) {
RETERR(svcsortkeylist(target, used));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
len = isc_buffer_usedlength(target) -
@ -732,8 +731,7 @@ generic_totext_in_svcb(ARGS_TOTEXT) {
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
return (ISC_R_SUCCESS);

View file

@ -2323,8 +2323,7 @@ addr2buf(void *buf, const size_t bufsize, const isc_sockaddr_t *sockaddr) {
memmove(buf, &netaddr.type.in6, 16);
return (16);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (0);
}
@ -7088,8 +7087,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname,
RUNTIME_CHECK(result == ISC_R_SUCCESS);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (chainingp != NULL) {

View file

@ -280,8 +280,7 @@ dns_rpz_policy2str(dns_rpz_policy_t policy) {
str = "DNS64";
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (str);
}
@ -345,8 +344,7 @@ make_addr_set(dns_rpz_addr_zbits_t *tgt_set, dns_rpz_zbits_t zbits,
tgt_set->nsip = zbits;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -363,8 +361,7 @@ make_nm_set(dns_rpz_nm_zbits_t *tgt_set, dns_rpz_num_t rpz_num,
tgt_set->ns = DNS_RPZ_ZBIT(rpz_num);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -619,8 +616,7 @@ adj_trigger_cnt(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num,
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (inc) {
@ -2658,8 +2654,7 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
rpz_num = zbit_to_num(found->set.nsip & tgt_set.nsip);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
result = ip2name(&found->ip, found->prefix, dns_rootname, ip_name);
RWUNLOCK(&rpzs->search_lock, isc_rwlocktype_read);

View file

@ -482,8 +482,7 @@ get_rate(dns_rrl_t *rrl, dns_rrl_rtype_t rtype) {
case DNS_RRL_RTYPE_ALL:
return (&rrl->all_per_second);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -852,8 +851,7 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e, const char *str1,
ADD_LOG_CSTR(&lb, "slip ");
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
switch (e->key.s.rtype) {
@ -881,8 +879,7 @@ make_log_buf(dns_rrl_t *rrl, dns_rrl_entry_t *e, const char *str1,
ADD_LOG_CSTR(&lb, "all ");
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (plural) {

View file

@ -1069,8 +1069,7 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) {
UNUSED(db);
UNUSED(node);
UNUSED(now);
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
static void

View file

@ -736,8 +736,7 @@ expirenode(dns_db_t *db, dns_dbnode_t *node, isc_stdtime_t now) {
UNUSED(db);
UNUSED(node);
UNUSED(now);
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
static void

View file

@ -227,8 +227,7 @@ reverse_from_address(dns_name_t *tcpself, const isc_netaddr_t *tcpaddr) {
RUNTIME_CHECK(result < sizeof(buf));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_buffer_init(&b, buf, strlen(buf));
isc_buffer_add(&b, strlen(buf));
@ -269,8 +268,7 @@ stf_from_address(dns_name_t *stfself, const isc_netaddr_t *tcpaddr) {
RUNTIME_CHECK(result < sizeof(buf));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_buffer_init(&b, buf, strlen(buf));
isc_buffer_add(&b, strlen(buf));

View file

@ -372,7 +372,7 @@ fromhex(char c) {
printf("bad input format: %02x\n", c);
exit(3);
/* NOTREACHED */
UNREACHABLE();
}
/*

View file

@ -120,8 +120,7 @@ entry_exists(dns_geoip_subtype_t subtype, const char *addr) {
} else if (inet_pton(AF_INET, addr, &in4) == 1) {
isc_netaddr_fromin(&na, &in4);
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
db = geoip2_database(&geoip, fix_subtype(&geoip, subtype));

View file

@ -327,8 +327,7 @@ dns_transport_get_prefer_server_ciphers(const dns_transport_t *transport,
return (true);
}
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
return false;
}

View file

@ -91,8 +91,7 @@ dns_tsec_create(isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key,
tsec->ukey.key = key;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
tsec->magic = DNS_TSEC_MAGIC;
@ -118,8 +117,7 @@ dns_tsec_destroy(dns_tsec_t **tsecp) {
dst_key_free(&tsec->ukey.key);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
tsec->magic = 0;
@ -146,7 +144,6 @@ dns_tsec_getkey(dns_tsec_t *tsec, void *keyp) {
*(dst_key_t **)keyp = tsec->ukey.key;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -1970,8 +1970,7 @@ next_state:
state->keyset_kskonly));
sigs++;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
ISC_LIST_UNLINK(state->nsec_mindiff.tuples, t, link);
ISC_LIST_APPEND(state->work.tuples, t, link);
@ -2145,8 +2144,7 @@ next_state:
state->keyset_kskonly));
sigs++;
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
ISC_LIST_UNLINK(state->nsec_mindiff.tuples, t, link);
ISC_LIST_APPEND(state->work.tuples, t, link);
@ -2173,8 +2171,7 @@ next_state:
INSIST(ISC_LIST_EMPTY(state->nsec_mindiff.tuples));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
failure:
@ -2234,8 +2231,7 @@ dns__update_soaserial(uint32_t serial, dns_updatemethod_t method) {
}
return (serial);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2266,8 +2262,7 @@ dns_update_soaserial(uint32_t serial, dns_updatemethod_t method,
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (used != NULL) {

View file

@ -3085,8 +3085,7 @@ validator_start(isc_task_t *task, isc_event_t *event) {
result = validate_nx(val, false);
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (result != DNS_R_WAIT) {

View file

@ -682,8 +682,7 @@ redo:
FAIL(DNS_R_EXTRADATA);
FALLTHROUGH;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
result = ISC_R_SUCCESS;
failure:
@ -1029,8 +1028,7 @@ xfrin_start(dns_xfrin_ctx_t *xfr) {
connect_xfr, 30000, 0, tlsctx);
} break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (ISC_R_SUCCESS);

View file

@ -10135,8 +10135,7 @@ normalize_key(dns_rdata_t *rr, dns_rdata_t *target, unsigned char *data,
&dnskey, &buf);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (ISC_R_SUCCESS);
}
@ -18176,8 +18175,7 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) {
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
UNLOCK_ZONE(zone);
INSIST(isc_sockaddr_pf(&primaryaddr) == isc_sockaddr_pf(&sourceaddr));
@ -19952,8 +19950,7 @@ dns_zone_setdialup(dns_zone_t *zone, dns_dialuptype_t dialup) {
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NOREFRESH);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
UNLOCK_ZONE(zone);
}
@ -20035,8 +20032,7 @@ dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state) {
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_read);

View file

@ -245,8 +245,7 @@ isc_app_ctxrun(isc_appctx_t *ctx) {
true);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
} else {

View file

@ -48,7 +48,6 @@ isc_assertion_failed(const char *file, int line, isc_assertiontype_t type,
const char *cond) {
isc_assertion_failed_cb(file, line, type, cond);
abort();
/* NOTREACHED */
}
/*% Set callback. */

View file

@ -66,4 +66,9 @@ isc_assertion_typetotext(isc_assertiontype_t type);
isc_assertiontype_invariant, #cond), \
0)))
#define ISC_UNREACHABLE() \
(isc_assertion_failed(__FILE__, __LINE__, isc_assertiontype_insist, \
"unreachable"), \
__builtin_unreachable())
ISC_LANG_ENDDECLS

View file

@ -218,12 +218,6 @@
* Performance
*/
#ifdef HAVE_BUILTIN_UNREACHABLE
#define ISC_UNREACHABLE() __builtin_unreachable();
#else /* ifdef HAVE_BUILTIN_UNREACHABLE */
#define ISC_UNREACHABLE()
#endif /* ifdef HAVE_BUILTIN_UNREACHABLE */
/* GCC defines __SANITIZE_ADDRESS__, so reuse the macro for clang */
#if __has_feature(address_sanitizer)
#define __SANITIZE_ADDRESS__ 1
@ -278,6 +272,8 @@ mock_assert(const int result, const char *const expression,
((!(expression)) \
? (mock_assert(0, #expression, __FILE__, __LINE__), abort()) \
: (void)0)
#define UNREACHABLE() \
(mock_assert(0, "unreachable", __FILE__, __LINE__), abort())
#define _assert_true(c, e, f, l) \
((c) ? (void)0 : (_assert_true(0, e, f, l), abort()))
#define _assert_int_equal(a, b, f, l) \
@ -300,6 +296,8 @@ mock_assert(const int result, const char *const expression,
/*% Invariant Assertion */
#define INVARIANT(e) ISC_INVARIANT(e)
#define UNREACHABLE() ISC_UNREACHABLE()
#endif /* UNIT_TESTING */
/*

View file

@ -125,8 +125,7 @@ get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -707,8 +707,7 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
ISC_LIST_PREPEND(lcfg->channels, channel, link);

View file

@ -319,8 +319,7 @@ delete_trace_entry(isc_mem_t *mctx, const void *ptr, size_t size,
* If we get here, we didn't find the item on the list. We're
* screwed.
*/
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
unlock:
MCTXUNLOCK(mctx);
}
@ -1436,8 +1435,7 @@ isc__mem_checkdestroyed(void) {
print_contexts(file);
}
#endif /* if ISC_MEM_TRACKLINES */
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
UNLOCK(&contextslock);
}

View file

@ -506,8 +506,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) {
break;
#endif /* ifdef IPV6_TCLASS */
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (sendmsg(s, &msg, 0) < 0) {

View file

@ -352,8 +352,7 @@ isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) {
t->zone = 0;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -2107,8 +2107,7 @@ server_on_request_recv(nghttp2_session *ngsession,
INSIST(socket->h2.content_length > 0);
isc_buffer_usedregion(&socket->h2.rbuf, &data);
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
server_call_cb(socket, session, ISC_R_SUCCESS, &data);
@ -2671,8 +2670,7 @@ isc__nm_http_stoplistening(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (!isc__nm_in_netthread()) {

View file

@ -521,8 +521,7 @@ isc__netmgr_destroy(isc_nm_t **netmgrp) {
#ifdef NETMGR_TRACE
if (isc_refcount_current(&mgr->references) > 1) {
isc__nm_dump_active(mgr);
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
#endif
@ -720,8 +719,7 @@ process_all_queues(isc__networker_t *worker) {
reschedule = true;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -793,8 +791,7 @@ isc__nm_async_task(isc__networker_t *worker, isc__netievent_t *ev0) {
case ISC_R_SUCCESS:
return;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -922,8 +919,7 @@ process_netievent(isc__networker_t *worker, isc__netievent_t *ievent) {
NETIEVENT_CASE(resume);
NETIEVENT_CASE_NOMORE(pause);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (true);
}
@ -1074,8 +1070,7 @@ isc__nm_enqueue_ievent(isc__networker_t *worker, isc__netievent_t *event) {
} else {
switch (event->type) {
case netievent_prio:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
break;
case netievent_privilegedtask:
type = NETIEVENT_PRIVILEGED;
@ -1462,8 +1457,7 @@ isc___nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr, isc_nmsocket_type type,
*/
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
break;
case isc_nm_tcpsocket:
@ -1482,8 +1476,7 @@ isc___nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr, isc_nmsocket_type type,
sock->statsindex = tcp6statsindex;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
break;
default:
@ -1921,8 +1914,7 @@ isc__nm_failed_read_cb(isc_nmsocket_t *sock, isc_result_t result, bool async) {
isc__nm_tlsdns_failed_read_cb(sock, result, async);
return;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2142,8 +2134,7 @@ isc__nm_alloc_cb(uv_handle_t *handle, size_t size, uv_buf_t *buf) {
buf->len = ISC_NETMGR_TCP_RECVBUF_SIZE;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
REQUIRE(buf->len <= ISC_NETMGR_RECVBUF_SIZE);
@ -2182,8 +2173,7 @@ isc__nm_start_reading(isc_nmsocket_t *sock) {
UV_RUNTIME_CHECK(uv_read_start, r);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
atomic_store(&sock->reading, true);
}
@ -2208,8 +2198,7 @@ isc__nm_stop_reading(isc_nmsocket_t *sock) {
UV_RUNTIME_CHECK(uv_read_stop, r);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
atomic_store(&sock->reading, false);
}
@ -2234,8 +2223,7 @@ processbuffer(isc_nmsocket_t *sock) {
case isc_nm_tlsdnssocket:
return (isc__nm_tlsdns_processbuffer(sock));
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2514,8 +2502,7 @@ isc_nm_send(isc_nmhandle_t *handle, isc_region_t *region, isc_nm_cb_t cb,
break;
#endif
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2545,8 +2532,7 @@ isc_nm_read(isc_nmhandle_t *handle, isc_nm_recv_cb_t cb, void *cbarg) {
break;
#endif
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2573,8 +2559,7 @@ isc_nm_cancelread(isc_nmhandle_t *handle) {
break;
#endif
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2594,8 +2579,7 @@ isc_nm_pauseread(isc_nmhandle_t *handle) {
break;
#endif
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2615,8 +2599,7 @@ isc_nm_resumeread(isc_nmhandle_t *handle) {
break;
#endif
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2646,8 +2629,7 @@ isc_nm_stoplistening(isc_nmsocket_t *sock) {
break;
#endif
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -2828,7 +2810,7 @@ isc__nmsocket_reset(isc_nmsocket_t *sock) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
break;
}
@ -2870,8 +2852,7 @@ isc__nmsocket_shutdown(isc_nmsocket_t *sock) {
case isc_nm_tlsdnslistener:
return;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -3348,8 +3329,7 @@ isc__nm_set_network_buffers(isc_nm_t *nm, uv_handle_t *handle) {
atomic_load_relaxed(&nm->send_udp_buffer_size);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (recv_buffer_size > 0) {
@ -3457,8 +3437,7 @@ isc_nm_bad_request(isc_nmhandle_t *handle) {
case isc_nm_tlssocket:
#endif /* HAVE_LIBNGHTTP2 */
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
break;
}
}
@ -3481,8 +3460,7 @@ isc_nm_xfr_allowed(isc_nmhandle_t *handle) {
return (false);
}
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
return (false);
}
@ -3526,7 +3504,7 @@ isc_nm_set_maxage(isc_nmhandle_t *handle, const uint32_t ttl) {
#endif /* HAVE_LIBNGHTTP2 */
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
break;
}
}
@ -3602,8 +3580,7 @@ nmsocket_type_totext(isc_nmsocket_type type) {
case isc_nm_httpsocket:
return ("isc_nm_httpsocket");
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -647,8 +647,7 @@ isc__nm_tcp_stoplistening(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (!isc__nm_in_netthread()) {
@ -1158,8 +1157,7 @@ tcp_stop_cb(uv_handle_t *handle) {
if (!atomic_compare_exchange_strong(&sock->closed, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc__nm_incstats(sock, STATID_CLOSE);
@ -1177,8 +1175,7 @@ tcp_close_sock(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closed, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc__nm_incstats(sock, STATID_CLOSE);

View file

@ -613,8 +613,7 @@ isc__nm_tcpdns_stoplistening(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (!isc__nm_in_netthread()) {
@ -1210,8 +1209,7 @@ tcpdns_stop_cb(uv_handle_t *handle) {
if (!atomic_compare_exchange_strong(&sock->closed, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc__nm_incstats(sock, STATID_CLOSE);
@ -1229,8 +1227,7 @@ tcpdns_close_sock(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closed, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc__nm_incstats(sock, STATID_CLOSE);

View file

@ -685,8 +685,7 @@ isc__nm_tlsdns_stoplistening(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (!isc__nm_in_netthread()) {
@ -760,8 +759,7 @@ isc__nm_async_tlsdnsshutdown(isc__networker_t *worker, isc__netievent_t *ev0) {
tls_shutdown(sock);
return;
case 0:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
case SSL_ERROR_ZERO_RETURN:
tls_error(sock, ISC_R_EOF);
break;
@ -1737,8 +1735,7 @@ tlsdns_send_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
case SSL_ERROR_WANT_READ:
break;
case 0:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
default:
return (ISC_R_TLSERROR);
}
@ -1764,8 +1761,7 @@ tlsdns_stop_cb(uv_handle_t *handle) {
if (!atomic_compare_exchange_strong(&sock->closed, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc__nm_incstats(sock, STATID_CLOSE);
@ -1788,8 +1784,7 @@ tlsdns_close_sock(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closed, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc__nm_incstats(sock, STATID_CLOSE);

View file

@ -856,8 +856,7 @@ isc__nm_tls_stoplistening(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
atomic_store(&sock->listening, false);

View file

@ -516,8 +516,7 @@ isc__nm_udp_stoplistening(isc_nmsocket_t *sock) {
if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
if (!isc__nm_in_netthread()) {
@ -1175,8 +1174,7 @@ udp_stop_cb(uv_handle_t *handle) {
if (!atomic_compare_exchange_strong(&sock->closed, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc__nm_incstats(sock, STATID_CLOSE);
@ -1197,8 +1195,7 @@ udp_close_cb(uv_handle_t *handle) {
if (!atomic_compare_exchange_strong(&sock->closed, &(bool){ false },
true)) {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc__nm_incstats(sock, STATID_CLOSE);

View file

@ -62,8 +62,7 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
return (ISC_R_SUCCESS);
}
@ -94,8 +93,7 @@ isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
case EAGAIN:
return (ISC_R_LOCKBUSY);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -142,8 +142,7 @@ isc_siphash24(const uint8_t *k, const uint8_t *in, const size_t inlen,
case 0:
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
v3 ^= b;
@ -208,8 +207,7 @@ isc_halfsiphash24(const uint8_t *k, const uint8_t *in, const size_t inlen,
case 0:
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
v3 ^= b;

View file

@ -295,8 +295,7 @@ isc_sockaddr_anyofpf(isc_sockaddr_t *sockaddr, int pf) {
isc_sockaddr_any6(sockaddr);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -366,8 +365,7 @@ isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na,
sockaddr->type.sin6.sin6_port = htons(port);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
ISC_LINK_INIT(sockaddr, link);
}

View file

@ -118,7 +118,7 @@ schedule(isc_timer_t *timer, isc_time_t *now, bool signal_ok) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/*
@ -426,7 +426,7 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) {
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
timer->index = 0;

View file

@ -511,8 +511,7 @@ get_tls_version_disable_bit(const isc_tls_protocol_version_t tls_ver) {
#endif
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
break;
};

View file

@ -596,8 +596,7 @@ isc_url_parse(const char *buf, size_t buflen, bool is_connect,
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/* Nothing's changed; soldier on */

View file

@ -211,8 +211,7 @@ isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream) {
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -399,8 +399,7 @@ get_subtype(const cfg_obj_t *obj, isc_log_t *lctx, dns_geoip_subtype_t subtype,
}
return (subtype);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -3172,8 +3172,7 @@ parse_querysource(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
} else if ((*flagp & CFG_ADDR_V6OK) != 0) {
isc_netaddr_any6(&netaddr);
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
for (;;) {
@ -3258,8 +3257,7 @@ doc_querysource(cfg_printer_t *pctx, const cfg_type_t *type) {
} else if ((*flagp & CFG_ADDR_V6OK) != 0) {
cfg_print_cstr(pctx, "<ipv6_address>");
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
cfg_print_cstr(pctx, " | * ) [ port ( <integer> | * ) ] ) | "
"( [ [ address ] ( ");
@ -3268,8 +3266,7 @@ doc_querysource(cfg_printer_t *pctx, const cfg_type_t *type) {
} else if ((*flagp & CFG_ADDR_V6OK) != 0) {
cfg_print_cstr(pctx, "<ipv6_address>");
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
cfg_print_cstr(pctx, " | * ) ] port ( <integer> | * ) ) )"
" [ dscp <integer> ]");
@ -3893,8 +3890,7 @@ cfg_print_zonegrammar(const unsigned int zonetype, unsigned int flags,
/* no zone type is specified for these */
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
for (clause = clauses; clause->name != NULL; clause++) {

View file

@ -423,8 +423,7 @@ cfg_tuple_get(const cfg_obj_t *tupleobj, const char *name) {
return (tupleobj->value.tuple[i]);
}
}
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_result_t
@ -2679,8 +2678,7 @@ cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) {
} else if (result == ISC_R_NOTFOUND) {
/* do nothing */
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
}
@ -3015,8 +3013,7 @@ token_addr(cfg_parser_t *pctx, unsigned int flags, isc_netaddr_t *na) {
isc_netaddr_any6(na);
return (ISC_R_SUCCESS);
} else {
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
if ((flags & (CFG_ADDR_V4OK | CFG_ADDR_V4PREFIXOK)) != 0) {
@ -3294,8 +3291,7 @@ cfg_parse_netprefix(cfg_parser_t *pctx, const cfg_type_t *type,
addrlen = 128;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
expectprefix = (result == ISC_R_IPV4PREFIX);
CHECK(cfg_peektoken(pctx, 0));

View file

@ -678,8 +678,7 @@ renderend:
ISC_MIN((int)respsize / 16, 256));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
#ifdef HAVE_DNSTAP
@ -708,8 +707,7 @@ renderend:
ISC_MIN((int)respsize / 16, 256));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -1072,8 +1070,7 @@ no_nsid:
memmove(addr, &client->ecs.addr.type, addrl);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_buffer_init(&buf, ecs, sizeof(ecs));
@ -1193,8 +1190,7 @@ compute_cookie(ns_client_t *client, uint32_t when, uint32_t nonce,
inputlen = 32;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
isc_siphash24(secret, input, inputlen, digest);
@ -1235,8 +1231,7 @@ compute_cookie(ns_client_t *client, uint32_t when, uint32_t nonce,
digest);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
for (i = 0; i < 8; i++) {
digest[i] ^= digest[i + 8];
@ -1246,8 +1241,7 @@ compute_cookie(ns_client_t *client, uint32_t when, uint32_t nonce,
}
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}
@ -1871,8 +1865,7 @@ ns__client_request(isc_nmhandle_t *handle, isc_result_t eresult,
ISC_MIN((int)reqsize / 16, 18));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
} else {
switch (isc_sockaddr_pf(&client->peeraddr)) {
@ -1885,8 +1878,7 @@ ns__client_request(isc_nmhandle_t *handle, isc_result_t eresult,
ISC_MIN((int)reqsize / 16, 18));
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -2731,8 +2731,7 @@ rpz_get_zbits(ns_client_t *client, dns_rdatatype_t ip_type,
}
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/*
@ -2969,8 +2968,7 @@ rpz_get_p_name(ns_client_t *client, dns_name_t *p_name, dns_rpz_zone_t *rpz,
suffix = &rpz->nsip;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/*
@ -3404,8 +3402,7 @@ dnsrps_rewrite_ip(ns_client_t *client, const isc_netaddr_t *netaddr,
recursed = true;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
do {
@ -3455,8 +3452,7 @@ dnsrps_rewrite_name(ns_client_t *client, dns_name_t *trig_name, bool recursed,
trig = LIBRPZ_TRIG_NSDNAME;
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
dns_name_toregion(trig_name, &r);
@ -7306,8 +7302,7 @@ query_checkrpz(query_ctx_t *qctx, isc_result_t result) {
qctx->want_restart = true;
return (ISC_R_COMPLETE);
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/*
@ -9202,8 +9197,7 @@ query_nodata(query_ctx_t *qctx, isc_result_t res) {
dns64_ttl(qctx->db, qctx->version);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
SAVE(qctx->client->query.dns64_aaaa, qctx->rdataset);
@ -11602,8 +11596,7 @@ query_setup_sortlist(query_ctx_t *qctx) {
case NS_SORTLISTTYPE_NONE:
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
}

View file

@ -919,7 +919,7 @@ fromhex(char c) {
printf("bad input format: %02x\n", c);
exit(3);
/* NOTREACHED */
UNREACHABLE();
}
isc_result_t

View file

@ -433,8 +433,7 @@ run_start_test(const ns__query_start_test_params_t *test) {
test->id.description, test->id.lineno);
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
/*

View file

@ -758,8 +758,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
mnemonic = "IXFR";
break;
default:
INSIST(0);
ISC_UNREACHABLE();
UNREACHABLE();
}
ns_client_log(client, DNS_LOGCATEGORY_XFER_OUT, NS_LOGMODULE_XFER_OUT,