Re: Use func(void) for functions with no parameters

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Use func(void) for functions with no parameters
Date: 2025-12-04 04:32:10
Message-ID: 980252.1764822730@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2025-12-04 04:41:44 Re: Skipping schema changes in publication
Previous Message jian he 2025-12-04 04:22:19 Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part