[multiple] replace fall through comment with attr

replace /* fall through */ comment with __attribute_fallthrough__ macro

Note: not adding attribute to code with external origins:
  xxhash.h (algo_xxhash.h)
  ls-hpack/lshpack.c
so to avoid warnings, may need to compile with -Wno-implicit-fallthrough
master
Glenn Strauss 2 years ago
parent fefdf7f097
commit 76faed9145

@ -515,7 +515,7 @@ static int connection_handle_write_state(request_st * const r, connection * cons
log_error(r->conf.errh, __FILE__, __LINE__,
"unexpected subrequest handler ret-value: %d %d",
con->fd, rc);
/* fall through */
__attribute_fallthrough__
case HANDLER_ERROR:
connection_set_state_error(r, CON_STATE_ERROR);
return CON_STATE_ERROR;
@ -1073,7 +1073,7 @@ connection_state_machine_loop (request_st * const r, connection * const con)
r->loops_per_request = 0;
connection_set_state(r, CON_STATE_READ);
/* fall through */
__attribute_fallthrough__
case CON_STATE_READ:
/*(should not be reached by HTTP/2 streams)*/
if (!connection_handle_read_state(con)) {
@ -1085,13 +1085,13 @@ connection_state_machine_loop (request_st * const r, connection * const con)
break;
}
/*if (r->state != CON_STATE_REQUEST_END) break;*/
/* fall through */
__attribute_fallthrough__
case CON_STATE_REQUEST_END: /* transient */
ostate = (0 == r->reqbody_length)
? CON_STATE_HANDLE_REQUEST
: CON_STATE_READ_POST;
connection_set_state(r, ostate);
/* fall through */
__attribute_fallthrough__
case CON_STATE_READ_POST:
case CON_STATE_HANDLE_REQUEST:
switch (http_response_handler(r)) {
@ -1112,19 +1112,19 @@ connection_state_machine_loop (request_st * const r, connection * const con)
connection_set_state_error(r, CON_STATE_ERROR);
continue;
}
/* fall through */
/*__attribute_fallthrough__*/
/*case CON_STATE_RESPONSE_START:*//*occurred;transient*/
if (r->http_version > HTTP_VERSION_1_1)
h2_send_headers(r, con);
else
http_response_write_header(r);
connection_set_state(r, CON_STATE_WRITE);
/* fall through */
__attribute_fallthrough__
case CON_STATE_WRITE:
if (connection_handle_write_state(r, con)
!= CON_STATE_RESPONSE_END)
break;
/* fall through */
__attribute_fallthrough__
case CON_STATE_RESPONSE_END: /* transient */
case CON_STATE_ERROR: /* transient */
if (r->http_version > HTTP_VERSION_1_1 && r != &con->request)

@ -1030,7 +1030,7 @@ static void gw_restart_dead_procs(gw_host * const host, log_error_st * const err
}
if (proc->state != PROC_STATE_DIED) break;
/* fall through *//*(we have a dead proc now)*/
__attribute_fallthrough__/*(we have a dead proc now)*/
case PROC_STATE_DIED:
/* local procs get restarted by us,
@ -1891,7 +1891,7 @@ static handler_t gw_write_request(gw_handler_ctx * const hctx, request_st * cons
hctx->reconnects = 0;
break;
}
/* fall through */
__attribute_fallthrough__
case GW_STATE_CONNECT_DELAYED:
if (hctx->state == GW_STATE_CONNECT_DELAYED) { /*(not GW_STATE_INIT)*/
int socket_error = fdevent_connect_status(hctx->fd);
@ -1906,7 +1906,7 @@ static handler_t gw_write_request(gw_handler_ctx * const hctx, request_st * cons
gw_proc_connect_success(hctx->host, hctx->proc, hctx->conf.debug, r);
gw_set_state(hctx, GW_STATE_PREPARE_WRITE);
/* fall through */
__attribute_fallthrough__
case GW_STATE_PREPARE_WRITE:
/* ok, we have the connection */
@ -1930,7 +1930,7 @@ static handler_t gw_write_request(gw_handler_ctx * const hctx, request_st * cons
fdevent_fdnode_event_add(hctx->ev, hctx->fdn, FDEVENT_IN|FDEVENT_RDHUP);
gw_set_state(hctx, GW_STATE_WRITE);
/* fall through */
__attribute_fallthrough__
case GW_STATE_WRITE:
if (!chunkqueue_is_empty(&hctx->wb)) {
log_error_st * const errh = r->conf.errh;

@ -979,7 +979,8 @@ void http_response_backend_done (request_st * const r) {
r->http_status = 500;
r->handler_module = NULL;
break;
} /* else fall through */
}
__attribute_fallthrough__
case CON_STATE_WRITE:
if (!r->resp_body_finished) {
if (r->http_version == HTTP_VERSION_1_1)

@ -435,7 +435,7 @@ static int cgi_recv_response(request_st * const r, handler_ctx * const hctx) {
return HANDLER_GO_ON;
case HANDLER_ERROR:
http_response_backend_error(r);
/* fall through */
__attribute_fallthrough__
case HANDLER_FINISHED:
cgi_connection_close(hctx);
return HANDLER_FINISHED;

@ -1718,7 +1718,7 @@ static int mod_extforward_network_read (connection *con,
case -2: errh = con->srv->errh;
log_error(errh,__FILE__,__LINE__,
"hap-PROXY proto received invalid/unsupported request");
/* fall through */
__attribute_fallthrough__
default: rc = -1; break;
}

@ -2925,7 +2925,7 @@ connection_write_cq_ssl (connection *con, chunkqueue *cq, off_t max_bytes)
if (wr == 0) return -2;
/* fall through */
__attribute_fallthrough__
default:
while((err = ERR_get_error())) {
log_error(errh, __FILE__, __LINE__,
@ -3003,7 +3003,7 @@ connection_read_cq_ssl (connection *con, chunkqueue *cq, off_t max_bytes)
switch ((rc = SSL_get_error(hctx->ssl, len))) {
case SSL_ERROR_WANT_WRITE:
con->is_writable = -1;
/* fall through */
__attribute_fallthrough__
case SSL_ERROR_WANT_READ:
con->is_readable = 0;
@ -3036,7 +3036,7 @@ connection_read_cq_ssl (connection *con, chunkqueue *cq, off_t max_bytes)
switch(oerrno) {
case ECONNRESET:
if (!hctx->conf.ssl_log_noise) break;
/* fall through */
__attribute_fallthrough__
default:
/* (oerrno should be something like ECONNABORTED not 0
* if client disconnected before anything was sent
@ -3059,7 +3059,7 @@ connection_read_cq_ssl (connection *con, chunkqueue *cq, off_t max_bytes)
/* FIXME: later */
}
/* fall through */
__attribute_fallthrough__
default:
while((ssl_err = ERR_get_error())) {
switch (ERR_GET_REASON(ssl_err)) {
@ -3220,7 +3220,7 @@ mod_openssl_close_notify(handler_ctx *hctx)
break;
}
/* fall through */
__attribute_fallthrough__
default:
if (!SSL_is_init_finished(hctx->ssl)) {

@ -3062,7 +3062,7 @@ webdav_propfind_live_props (const webdav_propfind_bufs * const restrict pb,
buffer * const restrict b = pb->b_200;
switch (pnum) {
case WEBDAV_PROP_ALL:
/*(fall through)*/
__attribute_fallthrough__
/*case WEBDAV_PROP_CREATIONDATE:*/ /* (located in database, if present)*/
#if 0
case WEBDAV_PROP_CREATIONDATE: {
@ -5100,7 +5100,7 @@ mod_webdav_copymove_b (request_st * const r, const plugin_config * const pconf,
break;
}
}
/* fall through */
__attribute_fallthrough__
/*case ENOTDIR:*/
default:
http_status_set_error(r, 409); /* Conflict */
@ -5715,7 +5715,7 @@ mod_webdav_unlock (request_st * const r, const plugin_config * const pconf)
http_status_set_fin(r, 204); /* No Content */
return HANDLER_FINISHED;
}
/* fall through */
__attribute_fallthrough__
default:
case -1: /* lock does not exist */
case -2: /* URI not in scope of locktoken and depth */
@ -5792,7 +5792,8 @@ PHYSICALPATH_FUNC(mod_webdav_physical_handler)
break;
case HTTP_METHOD_DELETE:
case HTTP_METHOD_MOVE:
reject_reqbody = 1; /*(fall through)*/ __attribute_fallthrough__
reject_reqbody = 1;
__attribute_fallthrough__
case HTTP_METHOD_PROPPATCH:
case HTTP_METHOD_PUT:
check_readonly = check_lock_src = 1;

@ -2657,7 +2657,7 @@ connection_write_cq_ssl (connection *con, chunkqueue *cq, off_t max_bytes)
if (wr == 0) return -2;
/* fall through */
__attribute_fallthrough__
default:
while((err = ERR_get_error())) {
log_error(errh, __FILE__, __LINE__,
@ -2737,7 +2737,7 @@ connection_read_cq_ssl (connection *con, chunkqueue *cq, off_t max_bytes)
switch ((rc = SSL_get_error(hctx->ssl, len))) {
case SSL_ERROR_WANT_WRITE:
con->is_writable = -1;
/* fall through */
__attribute_fallthrough__
case SSL_ERROR_WANT_READ:
con->is_readable = 0;
@ -2770,7 +2770,7 @@ connection_read_cq_ssl (connection *con, chunkqueue *cq, off_t max_bytes)
switch(oerrno) {
case ECONNRESET:
if (!hctx->conf.ssl_log_noise) break;
/* fall through */
__attribute_fallthrough__
default:
/* (oerrno should be something like ECONNABORTED not 0
* if client disconnected before anything was sent
@ -2793,7 +2793,7 @@ connection_read_cq_ssl (connection *con, chunkqueue *cq, off_t max_bytes)
/* FIXME: later */
}
/* fall through */
__attribute_fallthrough__
default:
while((ssl_err = ERR_get_error())) {
switch (ERR_GET_REASON(ssl_err)) {
@ -2954,7 +2954,7 @@ mod_openssl_close_notify(handler_ctx *hctx)
break;
}
/* fall through */
__attribute_fallthrough__
default:
if (!SSL_is_init_finished(hctx->ssl)) {

@ -1585,7 +1585,7 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
switch (fdevent_reaped_logger_pipe(pid)) {
default: break;
case -1: if (!timer) alarm((timer = 5));
/* fall through */
__attribute_fallthrough__
case 1: continue;
}
/**

@ -426,7 +426,7 @@ int sock_addr_from_str_hints(sock_addr * const restrict saddr, socklen_t * const
return 1;
}
#else
/* fall through */
__attribute_fallthrough__
#endif
#ifdef HAVE_IPV6
case AF_INET6:

Loading…
Cancel
Save