Prevent redeclaration of typedef TocEntry.
authorNathan Bossart <[email protected]>
Fri, 4 Apr 2025 20:56:23 +0000 (15:56 -0500)
committerNathan Bossart <[email protected]>
Fri, 4 Apr 2025 20:56:23 +0000 (15:56 -0500)
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).

Per buildfarm.

src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup_archiver.h

index 5c8c1b3ea0a35d28259323da7859d124cd9652e0..8586cdaf5418dc0ae4e546b8524370a126980b0c 100644 (file)
@@ -286,7 +286,10 @@ typedef int DumpId;
  */
 
 /* forward declaration to avoid including pg_backup_archiver.h here */
+#ifndef HAVE_TOCENTRY_TYPEDEF
 typedef struct _tocEntry TocEntry;
+#define HAVE_TOCENTRY_TYPEDEF 1
+#endif
 
 typedef char *(*DefnDumperPtr) (Archive *AH, const void *userArg, const TocEntry *te);
 typedef int (*DataDumperPtr) (Archive *AH, const void *userArg);
index 859fbd322d142a63d0f0dff2f7f845cccf7621bc..e81a76ba25e59f6cde2ab6dc3fa3c298ea9ea1af 100644 (file)
 #define WORKER_IGNORED_ERRORS        12
 
 typedef struct _archiveHandle ArchiveHandle;
+#ifndef HAVE_TOCENTRY_TYPEDEF
 typedef struct _tocEntry TocEntry;
+#define HAVE_TOCENTRY_TYPEDEF 1
+#endif
 struct ParallelState;
 
 #define READ_ERROR_EXIT(fd) \