Re: Use func(void) for functions with no parameters
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>,
pgsql-hackers@lists.postgresql.org
Date: 2025-12-04T04:32:10Z
Lists: pgsql-hackers
Bertrand Drouvot <bertranddrouvot.pg@gmail.com> writes: > On Wed, Dec 03, 2025 at 10:15:41AM -0500, Tom Lane wrote: >> Some years ago we had a buildfarm animal that would complain about >> this construct, so the tree used to be clean. Probably it's just >> chance that these have only snuck into local functions. > The buildfarm animal remark makes me think to check with -Wstrict-prototypes > and -Wold-style-definition. I just did that and found two more (added in v2 > attached) that the coccinelle script missed... I looked into enabling -Wstrict-prototypes on one of my buildfarm animals, but the attempt failed because libreadline's headers are not clean. It looks like we could silence those warnings by #define'ing HAVE_STDARG_H and _FUNCTION_DEF before including the readline headers. A quick test says that then the warnings do not appear, and psql's regression tests still pass. But it would require a good deal more investigation of possible side-effects before I'd recommend actually doing that. regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Enable -Wstrict-prototypes and -Wold-style-definition by default
- 29bf4ee7496c 19 (unreleased) landed
-
Use "foo(void)" for definitions of functions with no parameters.
- 9b05e2ec08a3 19 (unreleased) landed