Fix -Wstrict-prototypes warning in ecpg_init_sqlca() declaration.

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
This commit is contained in:
Tom Lane 2026-03-18 15:25:12 -04:00
parent ec80215c03
commit f91b8ff6af
2 changed files with 3 additions and 3 deletions

View 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);

View 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