Add FALLTHROUGH macro for __attribute__((fallthrough))

Gcc 7+ and Clang 10+ have implemented __attribute__((fallthrough)) which
is explicit version of the /* FALLTHROUGH */ comment we are currently
using.

Add and apply FALLTHROUGH macro that uses the attribute if available,
but does nothing on older compilers.

In one case (lib/dns/zone.c), using the macro revealed that we were
using the /* FALLTHROUGH */ comment in wrong place, remove that comment.
This commit is contained in:
Ondřej Surý
2021-10-11 12:09:16 +02:00
committed by Ondřej Surý
parent 4a44e9dd36
commit fe7ce629f4
41 changed files with 109 additions and 97 deletions

View File

@@ -1711,7 +1711,7 @@ next_state:
update_log(log, zone, ISC_LOG_DEBUG(3),
"updated data signatures");
/* FALLTHROUGH */
FALLTHROUGH;
case remove_orphaned:
state->state = remove_orphaned;
@@ -1743,7 +1743,7 @@ next_state:
update_log(log, zone, ISC_LOG_DEBUG(3),
"rebuilding NSEC chain");
/* FALLTHROUGH */
FALLTHROUGH;
case build_chain:
state->state = build_chain;
/*
@@ -1833,7 +1833,7 @@ next_state:
CHECK(uniqify_name_list(&state->affected));
/* FALLTHROUGH */
FALLTHROUGH;
case process_nsec:
state->state = process_nsec;
@@ -1949,7 +1949,7 @@ next_state:
update_log(log, zone, ISC_LOG_DEBUG(3),
"signing rebuilt NSEC chain");
/* FALLTHROUGH */
FALLTHROUGH;
case sign_nsec:
state->state = sign_nsec;
/* Update RRSIG NSECs. */
@@ -1981,7 +1981,7 @@ next_state:
}
ISC_LIST_APPENDLIST(state->nsec_mindiff.tuples,
state->work.tuples, link);
/* FALLTHROUGH */
FALLTHROUGH;
case update_nsec3:
state->state = update_nsec3;
@@ -2073,7 +2073,7 @@ next_state:
}
}
/* FALLTHROUGH */
FALLTHROUGH;
case process_nsec3:
state->state = process_nsec3;
while ((t = ISC_LIST_HEAD(state->affected.tuples)) != NULL) {
@@ -2124,7 +2124,7 @@ next_state:
update_log(log, zone, ISC_LOG_DEBUG(3),
"signing rebuilt NSEC3 chain");
/* FALLTHROUGH */
FALLTHROUGH;
case sign_nsec3:
state->state = sign_nsec3;
/* Update RRSIG NSEC3s. */