2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +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

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