| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Enable -Wstrict-prototypes and -Wold-style-definition by default |
| Date: | 2026-03-18 19:15:33 |
| Message-ID: | abr51elajA2zUOl7@ip-10-97-1-34.eu-west-3.compute.internal |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Wed, Mar 18, 2026 at 01:03:03PM -0400, Tom Lane wrote:
> Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> writes:
> > I got this warning while running headerscheck after this commit:
Thanks for the report!
> > ~/Desktop/projects/postgres/src/interfaces/ecpg/ecpglib/ecpglib_extern.h:221:40:
> > warning: function declaration isn’t a prototype [-Wstrict-prototypes]
> > 221 | void ecpg_init_sqlca(struct sqlca_t *sqlca)
>
> Yeah, I see that too. I believe the problem is that headerscheck
> doesn't cause POSTGRES_ECPG_INTERNAL to become defined, so that
> what the compiler is seeing is (from sqlca.h):
>
> #ifndef POSTGRES_ECPG_INTERNAL
> #define sqlca (*ECPGget_sqlca())
> #endif
>
> and then
>
> void ecpg_init_sqlca(struct sqlca_t *sqlca);
Oh right, confirmed with:
"
$ gcc -E -I src/interfaces/ecpg/include -I src/include -I src/interfaces/libpq \
-include src/include/postgres_fe.h src/interfaces/ecpg/ecpglib/ecpglib_extern.h \
| grep ECPGget_sqlca
$ struct sqlca_t *ECPGget_sqlca(void);
$ void ecpg_init_sqlca(struct sqlca_t *(*ECPGget_sqlca()));
"
> Kinda surprising that that's not a syntax error.
Yeah...
> We could plausibly fix this either by
>
> (1) renaming ecpg_init_sqlca's parameter to something else;
>
> (2) ensuring that POSTGRES_ECPG_INTERNAL is defined. I'd be inclined
> to make ecpglib_extern.h do that rather than expecting headerscheck
> to know about it.
>
> Neither of these options are beautiful, but perhaps #1 is slightly
> less ugly. Any preferences?
I'd vote for #1 too, done in the attached.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-Wstrict-prototypes-warning-in-ecpg_init_sqlca.patch | text/x-diff | 2.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Henson Choi | 2026-03-18 19:22:16 | Re: SQL Property Graph Queries (SQL/PGQ) |
| Previous Message | Srinath Reddy Sadipiralla | 2026-03-18 19:12:19 | Re: Adding REPACK [concurrently] |