From 1c1e227ca74cd92375a607c686980896531a1ae1 Mon Sep 17 00:00:00 2001
From: Dmitry Ivanov <ivadmi5@gmail.com>
Date: Thu, 10 Aug 2023 21:04:44 +0300
Subject: [PATCH] fix: Remove dead code

---
 pgproto/CMakeLists.txt          |  7 +++++++
 pgproto/src/postgres/postgres.c | 29 +----------------------------
 pgproto/src/server/server.c     |  1 +
 3 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/pgproto/CMakeLists.txt b/pgproto/CMakeLists.txt
index 169ffd50f6..4bf7a5ba4b 100644
--- a/pgproto/CMakeLists.txt
+++ b/pgproto/CMakeLists.txt
@@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 2.8)
 
 project(protocol C)
 
+add_compile_options(
+    -Wunused-label
+    # -Wunused-macros
+    -Wunused-parameter
+    -Wunused-variable
+)
+
 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
 set(CMAKE_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_INCLUDE_PATH})
 
diff --git a/pgproto/src/postgres/postgres.c b/pgproto/src/postgres/postgres.c
index 1bf8f6041b..ad845ba47c 100644
--- a/pgproto/src/postgres/postgres.c
+++ b/pgproto/src/postgres/postgres.c
@@ -12,24 +12,6 @@
 #include "attributes.h"
 #include "tarantool/trivia/util.h"
 
-/**
- * Format of ReadyForQuery message.
- * ReadyForQuery informs the frontend that it can safely send a new command.
-*/
-struct ready_for_query_message {
-	/** Type byte, equals 'Z' */
-	uint8_t type;
-	/** Packet length without the type byte, including len field itself. */
-	uint32_t len;
-	/**
-	 * Current backend transaction status indicator.
-	 * Possible values are 'I' if idle (not in a transaction block);
-	 * 'T' if in a transaction block; or 'E' if in a failed transaction
-	 * block (queries will be rejected until block is ended).
-	 */
-	uint8_t transaction_status;
-};
-
 /**
  * Send ReadyForQuery message.
  * ReadyForQuery informs the frontend that it can safely send a new command.
@@ -45,16 +27,6 @@ send_ready_for_query(struct pg_port *port)
 	pg_flush(port);
 }
 
-/** Query message format. */
-struct query_message {
-	/** Type byte. Equals 'Q' */
-	uint8_t type;
-	/** Message length, including the len field. */
-	uint32_t len;
-	/** The query string. */
-	const char *query;
-};
-
 #define COMPARE_AND_RETURN_IF_EQUALS(query, tag)	\
 	if (strncasecmp(query, tag, strlen(tag)) == 0)	\
 		return tag
@@ -267,6 +239,7 @@ send_data_row(struct pg_port *port, const char **data,
 	      const struct row_description *row_desc,
 	      uint16_t format)
 {
+	(void)format;
 	pg_begin_msg(port, 'D');
 	pg_write_uint16(port, row_desc->natts);
 	const struct pg_attribute *atts = row_desc->atts;
diff --git a/pgproto/src/server/server.c b/pgproto/src/server/server.c
index 60bb8e0622..9e026f3c67 100644
--- a/pgproto/src/server/server.c
+++ b/pgproto/src/server/server.c
@@ -270,6 +270,7 @@ server_should_try_again(int err)
 static int
 server_worker(va_list args)
 {
+	(void)args;
 	say_info("server has been started");
 	while (! fiber_is_cancelled()) {
 		if (server_wait_for_connection()) {
-- 
GitLab