Re: typedef struct LogicalDecodingContext - Mailing list pgsql-hackers

From Peter Smith
Subject Re: typedef struct LogicalDecodingContext
Date
Msg-id CAHut+Ptf5d4aexif2ufsXB+pF3tM6oH7CNi8RDg99LjATm9y7g@mail.gmail.com
Whole thread Raw
In response to Re: typedef struct LogicalDecodingContext  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: typedef struct LogicalDecodingContext  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Mar 2, 2023 at 10:04 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Peter Smith <smithpb2250@gmail.com> writes:
> > AFAICT just by pre-declaring the typedef struct
> > LogicalDecodingContext, all of those 'struct LogicalDecodingContext'
> > can be culled, resulting in cleaner and more consistent function
> > signatures.
>
> Sadly, this is almost certainly going to cause bitching on the part of
> some compilers, because depending on the order of header inclusions
> they are going to see multiple typedefs for the same name.  Redundant
> "struct foo" declarations are portable C, but redundant "typedef foo"
> not so much.
>

Bah, I should not have used that tip-of-an-iceberg metaphor; it turns
out I was actually standing on the ship...

So does your reply mean there is no way really to be sure if such
changes are OK or not, other than to push them and then revert them
if/when one of the BF animals complains? If that is the case, then
it's not worth the hassle to pursue this any further.

> I also wonder if this passes headerscheck and cpluspluscheck.

Thanks for pointing me to those - I didn't know about them.

Aside: Is there missing documentation for those targets here:
https://www.postgresql.org/docs/devel/regress.html

~

FWIW, both those tests passed OK. What does "pass" even mean -- does
it confirm this patch doesn't suffer the multiple typedef problem you
anticipated after all?

[postgres@CentOS7-x64 oss_postgres_misc]$ make headerscheck
make -C ./src/backend generated-headers
make[1]: Entering directory `/home/postgres/oss_postgres_misc/src/backend'
make -C catalog distprep generated-header-symlinks
make[2]: Entering directory
`/home/postgres/oss_postgres_misc/src/backend/catalog'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory
`/home/postgres/oss_postgres_misc/src/backend/catalog'
make -C nodes distprep generated-header-symlinks
make[2]: Entering directory `/home/postgres/oss_postgres_misc/src/backend/nodes'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory `/home/postgres/oss_postgres_misc/src/backend/nodes'
make -C utils distprep generated-header-symlinks
make[2]: Entering directory `/home/postgres/oss_postgres_misc/src/backend/utils'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory `/home/postgres/oss_postgres_misc/src/backend/utils'
make[1]: Leaving directory `/home/postgres/oss_postgres_misc/src/backend'
./src/tools/pginclude/headerscheck . /home/postgres/oss_postgres_misc
[postgres@CentOS7-x64 oss_postgres_misc]$


[postgres@CentOS7-x64 oss_postgres_misc]$ make cpluspluscheck
make -C ./src/backend generated-headers
make[1]: Entering directory `/home/postgres/oss_postgres_misc/src/backend'
make -C catalog distprep generated-header-symlinks
make[2]: Entering directory
`/home/postgres/oss_postgres_misc/src/backend/catalog'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory
`/home/postgres/oss_postgres_misc/src/backend/catalog'
make -C nodes distprep generated-header-symlinks
make[2]: Entering directory `/home/postgres/oss_postgres_misc/src/backend/nodes'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory `/home/postgres/oss_postgres_misc/src/backend/nodes'
make -C utils distprep generated-header-symlinks
make[2]: Entering directory `/home/postgres/oss_postgres_misc/src/backend/utils'
make[2]: Nothing to be done for `distprep'.
make[2]: Nothing to be done for `generated-header-symlinks'.
make[2]: Leaving directory `/home/postgres/oss_postgres_misc/src/backend/utils'
make[1]: Leaving directory `/home/postgres/oss_postgres_misc/src/backend'
./src/tools/pginclude/cpluspluscheck . /home/postgres/oss_postgres_misc
[postgres@CentOS7-x64 oss_postgres_misc]$

------
Kind Regards,
Peter Smith.
Fujitsu Australia



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Minimal logical decoding on standbys
Next
From: Michael Paquier
Date:
Subject: Re: Allow +group in pg_ident.conf