public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
Subject: [PATCH v1] Fix -Wstrict-prototypes warning in ecpg_init_sqlca() declaration
Date: Wed, 18 Mar 2026 18:31:08 +0000

When headerscheck compiles ecpglib_extern.h, POSTGRES_ECPG_INTERNAL is
not defined, causing sqlca.h to expand "sqlca" as a macro
(*ECPGget_sqlca()).  This causes the ecpg_init_sqlca() declaration to trigger
a -Wstrict-prototypes warning.

Fix by renaming the parameter from "sqlca" to "sqlca_p" in both the
declaration and definition, avoiding the macro expansion.

Author: Bertrand Drouvot <[email protected]>
Reported-by: Nazir Bilal Yavuz <[email protected]>
Diagnosed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/CAN55FZ1VDwJ-ZD092ChYf%2B%2BhuP%2B-S3Cg45tJ8jNH5wx2c4BHAg%40mail.gmail.com
---
 src/interfaces/ecpg/ecpglib/ecpglib_extern.h | 2 +-
 src/interfaces/ecpg/ecpglib/misc.c           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
 100.0% src/interfaces/ecpg/ecpglib/

diff --git a/src/interfaces/ecpg/ecpglib/ecpglib_extern.h b/src/interfaces/ecpg/ecpglib/ecpglib_extern.h
index bea1398fce8..c92f0aa1081 100644
--- a/src/interfaces/ecpg/ecpglib/ecpglib_extern.h
+++ b/src/interfaces/ecpg/ecpglib/ecpglib_extern.h
@@ -218,7 +218,7 @@ void		ecpg_log(const char *format,...) pg_attribute_printf(1, 2);
 bool		ecpg_auto_prepare(int lineno, const char *connection_name,
 							  const int compat, char **name, const char *query);
 bool		ecpg_register_prepared_stmt(struct statement *stmt);
-void		ecpg_init_sqlca(struct sqlca_t *sqlca);
+void		ecpg_init_sqlca(struct sqlca_t *sqlca_p);
 
 struct sqlda_compat *ecpg_build_compat_sqlda(int line, PGresult *res, int row,
 											 enum COMPAT_MODE compat);
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index 1885732a652..40ea174ae9f 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -64,9 +64,9 @@ static volatile int simple_debug = 0;
 static FILE *debugstream = NULL;
 
 void
-ecpg_init_sqlca(struct sqlca_t *sqlca)
+ecpg_init_sqlca(struct sqlca_t *sqlca_p)
 {
-	memcpy(sqlca, &sqlca_init, sizeof(struct sqlca_t));
+	memcpy(sqlca_p, &sqlca_init, sizeof(struct sqlca_t));
 }
 
 bool
-- 
2.34.1


--kE1qhMB7tHROlKew--





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v1] Fix -Wstrict-prototypes warning in ecpg_init_sqlca() declaration
  In-Reply-To: <no-message-id-724047@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox