From: | Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Nathan Bossart <nathan(at)postgresql(dot)org> |
Cc: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pgsql: Prevent redeclaration of typedef TocEntry. |
Date: | 2025-04-04 21:40:48 |
Message-ID: | 202504042140.qo66ggw6wzsz@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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)
Attachment | Content-Type | Size |
---|---|---|
0001-cleanup-pg_dump-headers-a-bit.patch | text/x-diff | 1.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-04-04 22:26:58 | pgsql: functions.c: copy trees from source_list before parse analysis e |
Previous Message | Andrew Dunstan | 2025-04-04 21:08:15 | pgsql: Fix a couple of error messages and tests for them |