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

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Enable -Wstrict-prototypes and -Wold-style-definition by default
Date: 2026-03-27 13:23:14
Message-ID: acaEwtP0sn0HAlLG@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 Fri, Mar 27, 2026 at 01:15:29PM +0100, Peter Eisentraut wrote:
> On 27.03.26 11:07, Bertrand Drouvot wrote:
> > That looks ok but I wonder if we should also add '-Werror=vla' to it (
> > and remove it from common_warning_flags) to be in sync with what configure.ac
> > is doing:
> >
> > "
> > PGAC_PROG_CC_CFLAGS_OPT([-Werror=vla])
> > # -Wvla is not applicable for C++
> > "
>
> Hmm. This comment is not actually fully correct. With g++, you can write a
> VLA and it will work, and also -Wvla will warn about it. So we should
> actually add that option to C++ as well. (It is true that VLAs are not in
> standard C++, and g++ with -pedantic will also warn about it.)

Oh right, just did a few tests and agree with your comment above. I agree that
it should also be added for C++ in autoconf then.

What about the attached?

That said, your patch LGTM given that the VLA remark was not appropriate.

Regards,

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

Attachment Content-Type Size
v1-0001-configure-Apply-Werror-vla-to-C-as-well-as-C.patch text/x-diff 4.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-03-27 13:32:27 Re: Add "format" target to make and ninja to run pgindent and pgperltidy
Previous Message olivier cano 2026-03-27 13:20:40 Proposal: Supporting URI SAN in Certificate Authentication