2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

Add small tweaks to the code to fix compilation when ISC assertions are disabled

While implementing the new unit testing framework cmocka, it was found that the
BIND 9 code doesn't compile when assertions are disabled or replaced with any
function (such as mock_assert() from cmocka unit testing framework) that's not
directly recognized as assertion by the compiler.

This made the compiler to complain about blocks of code that was recognized as
unreachable before, but now it isn't.

The changes in this commit include:

* assigns default values to couple of local variables,
* moves some return statements around INSIST assertions,
* adds __builtin_unreachable(); annotations after some INSIST assertions,
* fixes one broken assertion (= instead of ==)
This commit is contained in:
Ondřej Surý
2018-06-04 13:41:09 +02:00
parent 8e292b3262
commit fbd2e47f51
16 changed files with 81 additions and 19 deletions

View File

@@ -567,8 +567,8 @@ adj_trigger_cnt(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num,
const dns_rpz_cidr_key_t *tgt_ip, dns_rpz_prefix_t tgt_prefix,
bool inc)
{
dns_rpz_trigger_counter_t *cnt;
dns_rpz_zbits_t *have;
dns_rpz_trigger_counter_t *cnt = 0;
dns_rpz_zbits_t *have = 0;
switch (rpz_type) {
case DNS_RPZ_TYPE_CLIENT_IP:
@@ -611,6 +611,7 @@ adj_trigger_cnt(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num,
break;
default:
INSIST(0);
ISC_UNREACHABLE();
}
if (inc) {
@@ -2477,7 +2478,7 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
dns_rpz_addr_zbits_t tgt_set;
dns_rpz_cidr_node_t *found;
isc_result_t result;
dns_rpz_num_t rpz_num;
dns_rpz_num_t rpz_num = 0;
dns_rpz_have_t have;
int i;