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

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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-03 15:53:37
Message-ID: aTBdAYRqO5vYx0hd@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, Dec 03, 2025 at 10:15:41AM -0500, Tom Lane wrote:
> Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> writes:
> > I noticed the only changes here are for `static` definitions. Are we
> > just more careful with normal functions, or does the compiler complain
> > more easily about such "incomplete" definitions when they're in
> > headers or need to be linked against?
>
> 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.

Thank you both for looking at it!

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...

Those new two (run_apply_worker() and usage()) are also static, so that's just
chance.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v2-0001-Use-func-void-for-functions-with-no-parameters.patch text/x-diff 6.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-12-03 15:55:40 Re: Remove useless pointer advance in StatsShmemInit()
Previous Message Andres Freund 2025-12-03 15:52:51 Re: Minor LLVM cleanups