Re: Enable -Wstrict-prototypes and -Wold-style-definition by default

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
Date: 2026-03-23 15:13:20
Message-ID: 4ab608af-2f90-47d8-88a5-6329f6630fff@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18.03.26 14:32, Peter Eisentraut wrote:
> On 16.03.26 10:55, Peter Eisentraut wrote:
>> On 09.03.26 17:39, Bertrand Drouvot wrote:
>>> 0001: Prevent -Wstrict-prototypes and -Wold-style-definition warnings
>>>
>>> It fixes the remaining warnings that those new flags would generate.
>>
>> I have committed this one.  I'll look at the rest next.
>
> Also committed.

I have a couple of follow-up patches that I had developed while playing
with this.

There is a warning option for MSVC that appears to have a very similar
effect to the ones we added here, so I propose we add that one as well.

Additionally, there is an option for MSVC to disable warnings in system
headers, similar to the default behavior of GCC. This would be required
here because some system header files have non-strict prototypes.

Additionally, I propose to add -Wold-style-declaration, which is
completely unrelated to -Wold-style-definition, but it has popped up a
few times via the buildfarm (grep for it in git log), so I think we
might as well add it so that everyone sees it.

Finally, I think we can remove the option -Wendif-labels, which doesn't
do anything anymore that isn't the default. (It was only not the
default before gcc 4.0.)

Attachment Content-Type Size
v2-0001-Disable-warnings-in-system-headers-in-MSVC.patch text/plain 2.0 KB
v2-0002-Enable-warning-like-Wstrict-prototypes-on-MSVC-as.patch text/plain 980 bytes
v2-0003-Remove-Wendif-labels.patch text/plain 4.6 KB
v2-0004-Add-warning-option-Wold-style-declaration.patch text/plain 2.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-03-23 15:20:39 Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
Previous Message Nathan Bossart 2026-03-23 15:09:30 Re: Add RISC-V Zbb popcount optimization