Re: Should we remove -Wdeclaration-after-statement?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Should we remove -Wdeclaration-after-statement?
Date: 2024-01-29 19:58:04
Message-ID: 20240129195804.hzshn7jjkt2itowi@awork3.anarazel.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-12-27 12:48:40 +0100, Jelte Fennema-Nio wrote:
> Postgres currently requires all variables to be declared at the top of
> the function, because it specifies -Wdeclaration-after-statement. One
> of the reasons that we had this warning was because C89 required this
> style of declaration. Requiring it everywhere made backporting easier,
> since some of our older supported PG versions needed to compile on
> C89. Now that we have dropped support for PG11 that reason goes away,
> since now all supported Postgres versions require C99. So, I think
> it's worth reconsidering if we want this warning to be enabled or not.

+1 for allowing declarations to be intermixed with code, -infinity for
changing existing code to do so.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-01-29 20:01:06 Re: Should we remove -Wdeclaration-after-statement?
Previous Message Nathan Bossart 2024-01-29 19:53:13 Re: Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)