From: Álvaro Herrera <alvherre@kurilemu.de>
To: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: allow benign typedef redefinitions (C11)
Date: Sun, 28 Sep 2025 11:23:51 +0200
Message-ID: <a08ed217-1bf3-4c1d-97ca-7f5ca93e53cf@app.fastmail.com> (raw)
In-Reply-To: <10d32190-f31b-40a5-b177-11db55597355@eisentraut.org>
References: <10d32190-f31b-40a5-b177-11db55597355@eisentraut.org>
Hello,
Here's another simple piece that I noticed while fooling around with the doxygen report -- genam.h was including tidbitmap.h and relcache.h for the sake of one typedefs each, and this was bleeding in other places in a rather random fashion, particularly through amapi.h. I propose the following to fix it. The changes to inet.h and varbit.h are surprising, but required. (It's possible that we should be including varatt.h in more datatype headers than just those two, but at least these are the ones that complained. So another option would be to include varatt.h in the files that include those headers. However, that seems to me to be the wrong direction).
--
Álvaro Herrera
Attachments:0001-Remove-genam.h-s-dependency-on-relcache.h-and-tidbit.patch (text/x-patch, 2.5K) download
From 32ad7228b3073e296f87670d6e4d8a0dbfdd100a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Herrera?= <alvherre@kurilemu.de>
Date: Sun, 28 Sep 2025 11:15:51 +0200
Subject: [PATCH] Remove genam.h's dependency on relcache.h and tidbitmap.h
---
src/include/access/amapi.h | 2 ++
src/include/access/genam.h | 6 ++++--
src/include/access/nbtree.h | 1 +
src/include/utils/inet.h | 1 +
src/include/utils/varbit.h | 1 +
5 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/include/access/amapi.h b/src/include/access/amapi.hindex 2b4482dc1e6..63dd41c1f21 100644--- a/src/include/access/amapi.h+++ b/src/include/access/amapi.h@@ -15,6 +15,8 @@
#include "access/cmptype.h"
#include "access/genam.h"
#include "access/stratnum.h"
+#include "nodes/nodes.h"+#include "nodes/pg_list.h"
/*
* We don't wish to include planner header files here, since most of an index
diff --git a/src/include/access/genam.h b/src/include/access/genam.hindex ac62f6a6abd..e23eb04650b 100644--- a/src/include/access/genam.h+++ b/src/include/access/genam.h@@ -17,15 +17,17 @@
#include "access/htup.h"
#include "access/sdir.h"
#include "access/skey.h"
-#include "nodes/tidbitmap.h"
#include "storage/buf.h"
#include "storage/lockdefs.h"
-#include "utils/relcache.h"
#include "utils/snapshot.h"
/* We don't want this file to depend on execnodes.h. */
typedef struct IndexInfo IndexInfo;
typedef struct TupleTableSlot TupleTableSlot;
+/* or tidbitmap.h */+typedef struct TIDBitmap TIDBitmap;+/* or relcache.h */+typedef struct RelationData *Relation;
/*
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.hindex 9ab467cb8fd..db1345f54c8 100644--- a/src/include/access/nbtree.h+++ b/src/include/access/nbtree.h@@ -22,6 +22,7 @@
#include "catalog/pg_index.h"
#include "lib/stringinfo.h"
#include "storage/bufmgr.h"
+#include "storage/dsm.h"
#include "storage/shm_toc.h"
#include "utils/skipsupport.h"
diff --git a/src/include/utils/inet.h b/src/include/utils/inet.hindex ace8957f220..f08cf2abc95 100644--- a/src/include/utils/inet.h+++ b/src/include/utils/inet.h@@ -15,6 +15,7 @@
#define INET_H
#include "fmgr.h"
+#include "varatt.h"
/*
* This is the internal storage format for IP addresses
diff --git a/src/include/utils/varbit.h b/src/include/utils/varbit.hindex 7b81e8e6bbc..f633e232502 100644--- a/src/include/utils/varbit.h+++ b/src/include/utils/varbit.h@@ -18,6 +18,7 @@
#include <limits.h>
#include "fmgr.h"
+#include "varatt.h"
/*
* Modeled on struct varlena from c.h, but data type is bits8.
--
2.47.3
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-hackers@postgresql.org
Cc: alvherre@kurilemu.de, peter@eisentraut.org
Subject: Re: allow benign typedef redefinitions (C11)
In-Reply-To: <a08ed217-1bf3-4c1d-97ca-7f5ca93e53cf@app.fastmail.com>
* 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