From: Ondřej Surý Date: Mon, 28 Mar 2022 10:59:43 +0000 (+0200) Subject: Consistenly use UNREACHABLE() instead of ISC_UNREACHABLE() X-Git-Tag: v9.19.0~40^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4dceab142dee58245b4870184fd0df03c7198e40;p=thirdparty%2Fbind9.git Consistenly use UNREACHABLE() instead of ISC_UNREACHABLE() In couple places, we have missed INSIST(0) or ISC_UNREACHABLE() replacement on some branches with UNREACHABLE(). Replace all ISC_UNREACHABLE() or INSIST(0) calls with UNREACHABLE(). --- diff --git a/bin/tests/test_client.c b/bin/tests/test_client.c index 10517f24c7b..edc6d66320f 100644 --- a/bin/tests/test_client.c +++ b/bin/tests/test_client.c @@ -232,7 +232,7 @@ parse_options(int argc, char **argv) { break; default: - INSIST(0); + UNREACHABLE(); } } diff --git a/bin/tests/test_server.c b/bin/tests/test_server.c index 066dcf9e7ff..2d80db44571 100644 --- a/bin/tests/test_server.c +++ b/bin/tests/test_server.c @@ -152,7 +152,7 @@ parse_options(int argc, char **argv) { break; default: - INSIST(0); + UNREACHABLE(); } } diff --git a/cocci/unreachable.spatch b/cocci/unreachable.spatch index 100f1a0abe1..84c0c344bb5 100644 --- a/cocci/unreachable.spatch +++ b/cocci/unreachable.spatch @@ -11,3 +11,9 @@ - INSIST(0); - ISC_UNREACHABLE(); + UNREACHABLE(); + +@@ +@@ + +- UNREACHABLE(); + UNREACHABLE(); diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index 4fa7501e32d..aa611d7c730 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -2590,7 +2590,7 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type, zbits &= have.nsipv4; break; default: - INSIST(0); + UNREACHABLE(); break; } } else if (netaddr->family == AF_INET6) { @@ -2616,7 +2616,7 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type, zbits &= have.nsipv6; break; default: - INSIST(0); + UNREACHABLE(); break; } } else { diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 2bce1c7d7ca..17d20046855 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -2273,7 +2273,7 @@ isc__nm_process_sock_buffer(isc_nmsocket_t *sock) { } break; default: - INSIST(0); + UNREACHABLE(); } } } @@ -2799,7 +2799,6 @@ isc__nmsocket_reset(isc_nmsocket_t *sock) { REQUIRE(sock->parent == NULL); break; default: - INSIST(0); UNREACHABLE(); break; } @@ -3493,7 +3492,6 @@ isc_nm_set_maxage(isc_nmhandle_t *handle, const uint32_t ttl) { case isc_nm_tlssocket: #endif /* HAVE_LIBNGHTTP2 */ default: - INSIST(0); UNREACHABLE(); break; } diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index c76ea74dda3..2691a44de44 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -82,7 +82,7 @@ isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { } break; default: - INSIST(0); + UNREACHABLE(); } switch (ret) { diff --git a/lib/isc/timer.c b/lib/isc/timer.c index f833000601f..5d54e3843a5 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -117,7 +117,6 @@ schedule(isc_timer_t *timer, isc_time_t *now, bool signal_ok) { due = timer->idle; break; default: - INSIST(0); UNREACHABLE(); } @@ -425,7 +424,6 @@ dispatch(isc_timermgr_t *manager, isc_time_t *now) { need_schedule = false; break; default: - INSIST(0); UNREACHABLE(); } diff --git a/lib/ns/query.c b/lib/ns/query.c index cb1a579307f..b9e76eb8971 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -293,7 +293,7 @@ get_hooktab(query_ctx_t *qctx) { result = _res; \ goto cleanup; \ default: \ - INSIST(0); \ + UNREACHABLE(); \ } \ } \ } while (false)