]> granicus.if.org Git - pgbouncer/commitdiff
Fix -Wimplicit-fallthrough warnings
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 24 Jul 2018 10:19:18 +0000 (12:19 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 24 Jul 2018 10:19:18 +0000 (12:19 +0200)
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.

src/client.c
src/janitor.c
src/main.c
src/objects.c
src/sbuf.c
src/server.c

index 245dc5c6047e972a75fad426b3a55e4d0d272190..ecba8412a12fe67ef07ae3aa276b61a5ae6b1c94 100644 (file)
@@ -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 */
index e67f5e2a030b79e5d5e69a12963f60e3478eb247..df1c19d5362999ed90c69133b721ac1c6dced036 100644 (file)
@@ -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();
index 9cc7bf194a9a7d2bcde18c13e4c22b1879735a3d..39bb8b2b93955ec77858207c3eb5fc78191c6e06 100644 (file)
@@ -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) {
index d88054b636468221a01a2101cf8fc38a37aaf616..97409f27961d44ed09ef5dc23f72a2c9f2f84c50 100644 (file)
@@ -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;
index 36b3e4bb5ef491e59c4bf1abfa2593e3b162bb8b..220d4b55234b79e0ecb26d66e73742bd822f4711 100644 (file)
@@ -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);
index 7a4e445c0cda4a688dd60ee6beaf6c0b8430dd81..e9efb7ea4f377406ba6472a30458aaf2afa2e70a 100644 (file)
@@ -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 */