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

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

@@ -277,7 +277,7 @@ parse_url_char(state_t s, const char ch) {
return (s_dead);
}
/* FALLTHROUGH */
FALLTHROUGH;
case s_req_server_start:
case s_req_server:
if (ch == '/') {
@@ -399,7 +399,7 @@ http_parse_host_char(host_state_t s, const char ch) {
return (s_http_host);
}
/* FALLTHROUGH */
FALLTHROUGH;
case s_http_host_v6_end:
if (ch == ':') {
return (s_http_host_port_start);
@@ -412,7 +412,7 @@ http_parse_host_char(host_state_t s, const char ch) {
return (s_http_host_v6_end);
}
/* FALLTHROUGH */
FALLTHROUGH;
case s_http_host_v6_start:
if (isxdigit((unsigned char)ch) || ch == ':' || ch == '.') {
return (s_http_host_v6);
@@ -428,7 +428,7 @@ http_parse_host_char(host_state_t s, const char ch) {
return (s_http_host_v6_end);
}
/* FALLTHROUGH */
FALLTHROUGH;
case s_http_host_v6_zone_start:
/* RFC 6874 Zone ID consists of 1*( unreserved / pct-encoded) */
if (isalnum((unsigned char)ch) || ch == '%' || ch == '.' ||
@@ -578,7 +578,7 @@ isc_url_parse(const char *buf, size_t buflen, bool is_connect,
case s_req_server_with_at:
found_at = 1;
/* FALLTHROUGH */
FALLTHROUGH;
case s_req_server:
uf = ISC_UF_HOST;
break;