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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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: 2023-12-27 15:05:28
Message-ID: 2494006.1703689528@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jelte Fennema-Nio <postgres(at)jeltef(dot)nl> writes:
> 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.

This has already been debated, and the conclusion was that we would
stick to the existing style for consistency reasons. The fact that
back-portable patches required it was only one of the arguments, and
not the decisive one.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-12-27 15:18:21 Re: pg_upgrade failing for 200+ million Large Objects
Previous Message Justin Pryzby 2023-12-27 15:02:25 cannot abort transaction 2737414167, it was already committed