Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>, Peter Eisentraut <peter@eisentraut.org>,
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2026-03-18T17:26:26Z
Lists: pgsql-hackers
Hi, On 2026-03-18 13:03:03 -0400, Tom Lane wrote: > Nazir Bilal Yavuz <byavuz81@gmail.com> writes: > > I got this warning while running headerscheck after this commit: > > > ~/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); > > Kinda surprising that that's not a syntax error. Indeed. I don't even really understand what that POSTGRES_ECPG_INTERNAL business is about. Is that really just so we can use a local "sqlca" variable in some of our own ecpglib code while code using ecpg can't do that? Please tell me it ain't so. > 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? 1) seems to be the preferrable approach. It's what code using ecpg already has to do, right? Greetings, Andres Freund
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add warning option -Wold-style-declaration
- c73e8ee061ad 19 (unreleased) landed
-
configure: Apply -Werror=vla to C++ as well as C
- 488ab592d9ea 19 (unreleased) landed
-
Enable warning like -Wstrict-prototypes on MSVC as well
- b4a132022444 19 (unreleased) landed
-
Remove compiler warning option -Wendif-labels
- 87e1891c459e 19 (unreleased) landed
-
Disable warnings in system headers in MSVC
- bccfc73acde9 19 (unreleased) landed
-
Fix -Wstrict-prototypes warning in ecpg_init_sqlca() declaration.
- f91b8ff6af91 19 (unreleased) landed