From: Álvaro Herrera <alvherre@alvh.no-ip.org>
To: Nathan Bossart <nathan@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Prevent redeclaration of typedef TocEntry.
Date: Fri, 4 Apr 2025 23:40:48 +0200
Message-ID: <202504042140.qo66ggw6wzsz@alvherre.pgsql> (raw)
In-Reply-To: <E1u0o5j-002h4U-0h@gemulon.postgresql.org>
On 2025-Apr-04, Nathan Bossart wrote:
> Prevent redeclaration of typedef TocEntry.
>
> Commit 9c02e3a986 added a forward declaration for this typedef that
> caused redeclarations, which is not valid in C99. To fix, add some
> preprocessor guards to avoid a redefinition, as is done elsewhere
> (e.g., commit 382092a0cd).
Hmm, I have the impression that this results from some very old
untidyness in the pg_dump headers in general. The fact that
DataDumperPtr is in pg_backup.h seems now more of an accident than
something we would really choose to do nowadays -- it's been that way
since pg_dump was introduced in commit 500b62b0570f apparently. I'm
sure there were good reasons to have it there then. But we've
restructured the pg_dump headers at least once, and as far as I can see
there aren't anymore. AFAICS we could move both DefnDumperPtr and
DataDumperPtr typedefs to pg_backup_archiver.h, together with struct
_tocEntry (the only place where they are used), and we'd have less of a
mess here. Then we don't need struct TocEntry in pg_backup.h anymore.
Plus, these function typedefs aren't really "public interface" for
pg_dump anyway (which is what pg_backup.h claims to be), so I think it
would be a sensible cleanup. Patch attached.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Thou shalt check the array bounds of all strings (indeed, all arrays), for
surely where thou typest "foo" someone someday shall type
"supercalifragilisticexpialidocious" (5th Commandment for C programmers)
Attachments:
0001-cleanup-pg_dump-headers-a-bit.patch (text/x-diff, 0B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org, nathan@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Prevent redeclaration of typedef TocEntry.
In-Reply-To: <202504042140.qo66ggw6wzsz@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox