]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix -Wstrict-prototypes warning in ecpg_init_sqlca() declaration.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 18 Mar 2026 19:25:12 +0000 (15:25 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 18 Mar 2026 19:27:49 +0000 (15:27 -0400)
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 <bertranddrouvot.pg@gmail.com>
Reported-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAN55FZ1VDwJ-ZD092ChYf%2B%2BhuP%2B-S3Cg45tJ8jNH5wx2c4BHAg%40mail.gmail.com

src/interfaces/ecpg/ecpglib/ecpglib_extern.h
src/interfaces/ecpg/ecpglib/misc.c

index bea1398fce8799f869f68caa984b2934d2e54bc9..c92f0aa1081e635c8e5aed0d150e7d1f5ed845fa 100644 (file)
@@ -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);
index 1885732a65203b4f9fdfe407ff8b9bb9cb6e5add..40ea174ae9fde576255387da1891cc403e49771b 100644 (file)
@@ -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