From: Peter Eisentraut Date: Tue, 24 Jul 2018 10:19:18 +0000 (+0200) Subject: Fix -Wimplicit-fallthrough warnings X-Git-Tag: pgbouncer_1_9_0~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e1c7a77fb4b990dc9413b325bc6afbfa91807f8;p=pgbouncer Fix -Wimplicit-fallthrough warnings These warnings started showing up with GCC 7. The code was already correct, but the intent is now a bit clearer. Compilation with recent GCCs should now be warning-free again. --- diff --git a/src/client.c b/src/client.c index 245dc5c..ecba841 100644 --- a/src/client.c +++ b/src/client.c @@ -623,7 +623,11 @@ static bool handle_client_work(PgSocket *client, PktHdr *pkt) disconnect_client(client, true, "PQexec disallowed"); return false; } + rfq_delta++; + break; case 'F': /* FunctionCall */ + rfq_delta++; + break; /* request immediate response from server */ case 'S': /* Sync */ diff --git a/src/janitor.c b/src/janitor.c index e67f5e2..df1c19d 100644 --- a/src/janitor.c +++ b/src/janitor.c @@ -299,6 +299,7 @@ void per_loop_maint(void) } else { active += statlist_count(&login_client_list); } + /* fallthrough */ case P_PAUSE: if (!active) admin_pause_done(); diff --git a/src/main.c b/src/main.c index 9cc7bf1..39bb8b2 100644 --- a/src/main.c +++ b/src/main.c @@ -857,8 +857,10 @@ int main(int argc, char *argv[]) break; case 'h': usage(0, argv[0]); + break; default: usage(1, argv[0]); + break; } } if (optind + 1 != argc) { diff --git a/src/objects.c b/src/objects.c index d88054b..97409f2 100644 --- a/src/objects.c +++ b/src/objects.c @@ -157,6 +157,7 @@ void change_client_state(PgSocket *client, SocketState newstate) case CL_WAITING_LOGIN: if (newstate == CL_ACTIVE) newstate = CL_LOGIN; + /* fallthrough */ case CL_WAITING: statlist_remove(&pool->waiting_client_list, &client->head); break; @@ -186,6 +187,7 @@ void change_client_state(PgSocket *client, SocketState newstate) break; case CL_WAITING: client->wait_start = get_cached_time(); + /* fallthrough */ case CL_WAITING_LOGIN: statlist_append(&pool->waiting_client_list, &client->head); break; diff --git a/src/sbuf.c b/src/sbuf.c index 36b3e4b..220d4b5 100644 --- a/src/sbuf.c +++ b/src/sbuf.c @@ -601,6 +601,7 @@ static bool sbuf_process_pending(SBuf *sbuf) res = sbuf_call_proto(sbuf, SBUF_EV_PKT_CALLBACK); if (!res) return false; + /* fallthrough */ /* after callback, skip pkt */ case ACT_SKIP: iobuf_tag_skip(io, avail); diff --git a/src/server.c b/src/server.c index 7a4e445..e9efb7e 100644 --- a/src/server.c +++ b/src/server.c @@ -102,6 +102,7 @@ static bool handle_server_startup(PgSocket *server, PktHdr *pkt) case 'E': /* log & ignore errors */ log_server_error("S: error while executing exec_on_query", pkt); + /* fallthrough */ default: /* ignore rest */ sbuf_prepare_skip(sbuf, pkt->len); return true; @@ -288,6 +289,7 @@ static bool handle_server_work(PgSocket *server, PktHdr *pkt) disconnect_server(server, true, "invalid server parameter"); return false; } + /* fallthrough */ case 'C': /* CommandComplete */ /* ErrorResponse and CommandComplete show end of copy mode */