Re: Add Postgres module info
Yurii Rashkovskii <yrashk@omnigres.com>
From: Yurii Rashkovskii <yrashk@omnigres.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrei Lepikhov <lepihov@gmail.com>, Euler Taveira <euler@eulerto.com>, Robert Haas <robertmhaas@gmail.com>, Michael Paquier <michael@paquier.xyz>, Alexander Korotkov <aekorotkov@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-03-27T01:38:50Z
Lists: 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. 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 >
Commits
-
Avoid mixing designated and non-designated field initializers.
- d66997dfe8fe 18.0 landed
-
Use PG_MODULE_MAGIC_EXT in our installable shared libraries.
- 55527368bd07 18.0 landed
-
Introduce PG_MODULE_MAGIC_EXT macro.
- 9324c8c58065 18.0 landed