Re: allow benign typedef redefinitions (C11)
Álvaro Herrera <alvherre@kurilemu.de>
Attachments
- 0001-Remove-brin-gin_tuple.h-from-tuplesort.h.patch (text/x-diff)
On 2025-Sep-19, Álvaro Herrera wrote:
> I happened to realize that brin_tuple.h (a somewhat nasty header which
> was only supposed to be used by BRIN itself and stuff like amcheck)
> recently somehow snuck into tuplesort.h with some nefarious
> consequences: that one has polluted execnodes.h, which means that header
> now depends on struct definitions that appear in genam.h. We should fix
> this. This patch is not the full solution, just a way to show the
> problem; for a definitive solution, IMO the definitions of structs
> IndexScanInstrumentation and SharedIndexScanInstrumentation should be
> elsewhere so that execnodes.h doesn't have to include genam.h.
>
> (gin_tuple.h is also there, but that one's much less of a problem.)
Here's a proposed fix for this issue, wherein I move the
IndexScanInstrumentation and SharedIndexScanInstrumentation struct
definitions from genam.h to a new file executor/instrument_node.h.
I think there's room to argue that we should also move
BitmapHeapScanInstrumentation and SharedBitmapHeapInstrumentation
(currently defined in execnodes.h) to the new file; any opinions on
this? I think these structs belong together, so I'm leaning towards
yes.
Also, does anybody strongly dislike the proposed name? I admit it looks
unlike the existing names there:
$ ls src/include/executor
execAsync.h nodeFunctionscan.h nodeSamplescan.h
execdebug.h nodeGather.h nodeSeqscan.h
execdesc.h nodeGatherMerge.h nodeSetOp.h
execExpr.h nodeGroup.h nodeSort.h
execParallel.h nodeHash.h nodeSubplan.h
execPartition.h nodeHashjoin.h nodeSubqueryscan.h
execScan.h nodeIncrementalSort.h nodeTableFuncscan.h
executor.h nodeIndexonlyscan.h nodeTidrangescan.h
functions.h nodeIndexscan.h nodeTidscan.h
hashjoin.h nodeLimit.h nodeUnique.h
instrument.h nodeLockRows.h nodeValuesscan.h
instrument_node.h nodeMaterial.h nodeWindowAgg.h
nodeAgg.h nodeMemoize.h nodeWorktablescan.h
nodeAppend.h nodeMergeAppend.h spi.h
nodeBitmapAnd.h nodeMergejoin.h spi_priv.h
nodeBitmapHeapscan.h nodeModifyTable.h tablefunc.h
nodeBitmapIndexscan.h nodeNamedtuplestorescan.h tqueue.h
nodeBitmapOr.h nodeNestloop.h tstoreReceiver.h
nodeCtescan.h nodeProjectSet.h tuptable.h
nodeCustom.h nodeRecursiveunion.h
nodeForeignscan.h nodeResult.h
It's not the *first* name lacking camelCase or with an underscore, but
almost. Note that there's already an instrument.h, which has a
completely unrelated charter.
I also left an XXX comment on genam.h about including instrument_node.h
there or adding the typedefs. I think I prefer the typedefs myself.
CC'ing Peter G because of 0fbceae841cb and David because of
5a1e6df3b84c.
Thanks,
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Small aircraft do not crash frequently ... usually only once!"
(ponder, http://thedailywtf.com/)
Commits
-
Move instrumentation-related structs to instrument_node.h
- 2defd0006255 19 (unreleased) landed
-
Don't include access/htup_details.h in executor/tuptable.h
- 1a8b5b11e48a 19 (unreleased) landed
-
Don't include execnodes.h in brin.h or gin.h
- 1b6f61bd8988 19 (unreleased) landed
-
Do a tiny bit of header file maintenance
- 3bf31dd24314 19 (unreleased) landed
-
Don't include execnodes.h in replication/conflict.h
- 7e638d7f5093 19 (unreleased) landed
- 47da1745244b 18.1 landed
-
Update some more forward declarations to use typedef
- 81fc3e28e383 19 (unreleased) landed
-
Change fmgr.h typedefs to use original names
- 4bd91912987d 19 (unreleased) landed
-
Improve ExplainState type handling in header files
- 70407d39b7ea 19 (unreleased) landed
-
Remove hbaPort type
- dc41d7415fc6 19 (unreleased) landed
-
Remove workarounds against repeat typedefs
- 1e3b5edb8eb2 19 (unreleased) landed
-
Update various forward declarations to use typedef
- d4d1fc527bdb 19 (unreleased) landed
-
Allow redeclaration of typedef yyscan_t
- ae0e1be9f2a2 19 (unreleased) landed
-
Improve pgbench definition of yyscan_t
- 675ddc4d704f 19 (unreleased) landed
-
Delay extraction of TIDBitmap per page offsets
- bfe56cdf9a4e 18.0 cited
-
Remove pgrminclude and associated scripts
- 5af699066f81 18.0 cited
-
Allow to use HeapTupleData embedded in [Buffer]HeapTupleTableSlot.
- 5408e233f066 12.0 cited