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

Поиск
Список
Период
Сортировка
От Jelte Fennema-Nio
Тема Re: Should we remove -Wdeclaration-after-statement?
Дата
Msg-id CAGECzQQwu9iyq--0jjRtVT39AhWDbUqwF6k3nc=TkzPyKSVNYw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Should we remove -Wdeclaration-after-statement?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Should we remove -Wdeclaration-after-statement?  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Список pgsql-hackers
On Wed, 27 Dec 2023 at 16:05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> This has already been debated, and the conclusion was that we would
> stick to the existing style for consistency reasons.

I looked through the archives quite a bit, but I couldn't find any
conclusive debate about the current declaration style. Definitely not
one with "consistency reasons" as being the conclusion. Could you
point me to the place where that conclusion was reached? Or could you
at least clarify what consistency you believe is lost by removing the
warning? The threads discussing this warning that I did find were the
following:

The initial addition of the warning flag[1], which has very little discussion.

Introducing the C99 requirement[2]. Robert and you both preferred the
current declaration style. Andrew and Andres both would want to accept
the new declaration style.

Another where removal of this warning was suggested[3], and where
Andres said he was in favor of removing the warning. But he didn't
think fighting for it was worth the effort at the time to fight you
and Robert, when he was trying to get the general C99 requirement in.

And finally, one that was started by me, where I suggest an automated
refactor[4]. This change got shot down because it would cause lots of
backpatching problems (and because it was using perl regexes instead
of an AST parser to do the automated refactor). Ranier and you were
proponents of the current declaration style. Chapman was in favor of
the new declaration style. Andrew seems neutral.

P.S. Note, that I'm not suggesting a complete refactor this time. I'm
only proposing to relax the rules, and disable the warning, so newly
written code can benefit. But if the only reason not to remove the
warning is that then there would be two styles of declaration in the
codebase, then I'm happy to create another refactoring script that
moves declarations down to their first usage. (Which could then be run
on all backbranches to make sure there is no backpatching pain)

[1]: https://www.postgresql.org/message-id/flat/417263F8.4060102%40samurai.com
[2]:
https://www.postgresql.org/message-id/flat/CA%2BTgmoYvHzFkwChsamwbBrLNJRcRq%2BfyTwveFaN_YOWUsRnfpw%40mail.gmail.com#931f4c68237caf4c60b4dc298236aef1
[3]:
https://www.postgresql.org/message-id/flat/20181213210012.i7iihamlbi7vfdiw%40alap3.anarazel.de#00304f9dfc039da87383fed30be62cff
[4]:
https://www.postgresql.org/message-id/flat/AM5PR83MB0178E68E4FF1BAF9C66DF0D1F7C09%40AM5PR83MB0178.EURPRD83.prod.outlook.com



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: postgres_fdw fails to see that array type belongs to extension
Следующее
От: "Tristan Partin"
Дата:
Сообщение: Re: Add support for __attribute__((returns_nonnull))