[PATCH v1] Suppress strict-prototypes warnings from readline headers

Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To:
Date: 2025-12-04T09:18:24Z
Lists: pgsql-hackers
---
 src/bin/psql/input.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 100.0% src/bin/psql/

diff --git a/src/bin/psql/input.h b/src/bin/psql/input.h
index 6b2f84e0d0c..fe9cc5f9769 100644
--- a/src/bin/psql/input.h
+++ b/src/bin/psql/input.h
@@ -17,6 +17,16 @@
 #ifdef HAVE_LIBREADLINE
 #define USE_READLINE 1
 
+/*
+ * Suppress strict-prototypes warnings from readline headers.
+ * Some readline implementations have old-style function declarations
+ * that trigger -Wstrict-prototypes, which we can't fix in third party code.
+ */
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
+
 #if defined(HAVE_READLINE_READLINE_H)
 #include <readline/readline.h>
 #if defined(HAVE_READLINE_HISTORY_H)
@@ -33,6 +43,11 @@
 #include <history.h>
 #endif
 #endif							/* HAVE_READLINE_READLINE_H, etc */
+
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+
 #endif							/* HAVE_LIBREADLINE */
 
 #include "pqexpbuffer.h"
-- 
2.34.1


--jihcFAM3VdCRSn27--