Re: Add Postgres module info
От | Yurii Rashkovskii |
---|---|
Тема | Re: Add Postgres module info |
Дата | |
Msg-id | CAG=VW14mctsR543gpzLCuJ9JgJqwa=ptmBfGvxEjs+k8Jf7-Bg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Add Postgres module info (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Add Postgres module info
|
Список | pgsql-hackers |
Hi Tom,
This recent patch is great but causes a small problem. It mixes designated and non-designated initializers, specifically in `PG_MODULE_MAGIC_DATA(0)`.
While this is permissible in C, when imported in C++ code (in extern "C"), it causes GCC to emit an error: `either all initializer clauses should be designated or none of them should be`.
In Clang, this is a warning: `mixture of designated and non-designated initializers in the same initializer list is a C99 extension`
I understand that this won't affect C extensions, it causes a need for an unnecessary workaround for C++ extensions. C++ extensions are, of course, not first-class-supported, but they are documented as essentially feasible (and I am exercising this successfully)
Can we amend `PG_MODULE_MAGIC_DATA` to use designated initializers exclusively? This way there will be no special-casing for C++, yet it will provide relief for its users.
This recent patch is great but causes a small problem. It mixes designated and non-designated initializers, specifically in `PG_MODULE_MAGIC_DATA(0)`.
While this is permissible in C, when imported in C++ code (in extern "C"), it causes GCC to emit an error: `either all initializer clauses should be designated or none of them should be`.
In Clang, this is a warning: `mixture of designated and non-designated initializers in the same initializer list is a C99 extension`
I understand that this won't affect C extensions, it causes a need for an unnecessary workaround for C++ extensions. C++ extensions are, of course, not first-class-supported, but they are documented as essentially feasible (and I am exercising this successfully)
Can we amend `PG_MODULE_MAGIC_DATA` to use designated initializers exclusively? This way there will be no special-casing for C++, yet it will provide relief for its users.
On Wed, Mar 26, 2025 at 8:15 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Hearing no further discussion, I've pushed this.
regards, tom lane
В списке pgsql-hackers по дате отправления: