Enable -Wstrict-prototypes and -Wold-style-definition by default
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Peter Eisentraut <peter@eisentraut.org>
Date: 2026-03-09T16:39:07Z
Lists: pgsql-hackers
Attachments
Hi hackers, PFA a patch to $SUBJECT. The idea is to avoid having to chase those warnings manually like 11171fe1fc8, cdf4b9aff2, 0e72b9d440, 7069dbcc31, f1283ed6cc, 7b66e2c086, e95126cf04 and 9f7c527af3 have done. The idea has been discussed in [1] and [2]. The patch is divided in 2 parts: 0001: Prevent -Wstrict-prototypes and -Wold-style-definition warnings It fixes the remaining warnings that those new flags would generate. 0002: Enable -Wstrict-prototypes and -Wold-style-definition by default Those are available in all gcc and clang versions that support C11 and as C11 is required as of f5e0186f865c, then we can add them without capability test. The new flags are moved in configure.ac late enough to avoid any error (for example, PGAC_PRINTF_ARCHETYPE which uses -Werror and would fail to detect gnu_printf if -Wstrict-prototypes is active) leading to mingw_cross_warning CI task failing. Also, readline headers trigger a lot of warnings with -Wstrict-prototypes, so we make use of the system_header pragma to hide the warnings (as discussed in [3]. [1]: https://postgr.es/m/262909b8-3f4b-42ce-acd7-bdd4a6897990%40eisentraut.org [2]: https://postgr.es/m/aTJ9T8HyJN3D024w%40ip-10-97-1-34.eu-west-3.compute.internal [3]: https://postgr.es/m/1049756.1764861448%40sss.pgh.pa.us Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
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