2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

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

@@ -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);