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

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Should we remove -Wdeclaration-after-statement?
Дата
Msg-id 20240129195804.hzshn7jjkt2itowi@awork3.anarazel.de
обсуждение исходный текст
Ответ на Should we remove -Wdeclaration-after-statement?  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Ответы Re: Should we remove -Wdeclaration-after-statement?  (Andrew Dunstan <andrew@dunslane.net>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Should we remove -Wdeclaration-after-statement?