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 15:17:28
Message-ID: 1049756.1764861448@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 11:32:10PM -0500, Tom Lane wrote:
>> I looked into enabling -Wstrict-prototypes on one of my buildfarm
>> animals, but the attempt failed because libreadline's headers are
>> not clean.

> It took me some time to reproduce the errors...

> The reason is that gcc/clang treat certain directories (like /usr/include and
> /usr/local/include on my system) as "system headers" and suppress warnings from
> them, even with -Wsystem-headers.

Oh, duh. You guessed correctly: I was trying this on BF animal
indri, which gets a lot of stuff from MacPorts and therefore these
headers are under /opt/local/include. I wonder whether I should
adjust its build flags to treat that as a system directory.
It hasn't been a problem up to now, but ...

> Yeah, what about using Pragma Directives instead, like in the
> attached?

Yeah, a pragma is probably safer than what I was thinking about.
But I'd be inclined to just use "#pragma GCC system_header" in
input.h, since that's already tested and used elsewhere in the tree.
There's little enough other stuff in that file that I think we
could just do it, and not bother breaking out a sub-include file
like we did in plperl and plpython.

In any case, I don't think we should bother unless there's a push to
enable -Wstrict-prototypes by default, which I've not heard being
proposed.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Klika 2025-12-04 15:17:51 Re: Adding REPACK [concurrently]
Previous Message Dilip Kumar 2025-12-04 15:11:48 Re: Proposal: Support Logical replication of large objects