Обсуждение: Proposed mid-cycle update of typedefs.list

Поиск
Список
Период
Сортировка

Proposed mid-cycle update of typedefs.list

От
Tom Lane
Дата:
I happened to notice that the buildfarm's current typedefs list
adds quite a few names that were not previously being captured,
for example

@@ -48,10 +48,15 @@ AggPath
 AggSplit
 AggState
 AggStatePerAgg
+AggStatePerAggData
 AggStatePerGroup
+AggStatePerGroupData
 AggStatePerHash
+AggStatePerHashData
 AggStatePerPhase
+AggStatePerPhaseData
 AggStatePerTrans
+AggStatePerTransData
 AggStrategy
 AggTransInfo
 Aggref

This is great, because it means that the declarations of these
structs need not look funny anymore.  But I am not quite sure why
this happened.  It's not a BF tooling change as I first thought,
because multiple animals are reporting these names and the
same animals are not capturing these names on the back branches.
The best theory I can come up with is that 1b105f947 et al
used these names in palloc0_array and similar calls, and that
somehow looks like a capturable typedef reference ... but how?

Anyway, I'll gladly take this outcome.  I propose applying the
attached to sync the in-tree typedefs list with what the
buildfarm is currently reporting.

One change I did not apply is that the buildfarm's list omits pgoff_t,
although we certainly still use that.  This is evidently because
pgoff_t is defined as a macro not a typedef name.  I guess we've been
manually preserving that name in the list, but it seems like we should
change "#define pgoff_t off_t" to "typedef off_t pgoff_t;" to avoid
that manual hack.  I've not done that here, though.

            regards, tom lane

diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c
index 7ce3c5e2685..3b3c87fd62e 100644
--- a/src/backend/access/heap/rewriteheap.c
+++ b/src/backend/access/heap/rewriteheap.c
@@ -150,7 +150,7 @@ typedef struct RewriteStateData
     HTAB       *rs_old_new_tid_map; /* unmatched B tuples */
     HTAB       *rs_logical_mappings;    /* logical remapping files */
     uint32        rs_num_rewrite_mappings;    /* # in memory mappings */
-}            RewriteStateData;
+} RewriteStateData;

 /*
  * The lookup keys for the hash tables are tuple TID and xmin (we must check
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index ec4e3628bd5..3bc85986829 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -168,7 +168,7 @@ typedef struct GlobalTransactionData
     bool        ondisk;            /* true if prepare state file is on disk */
     bool        inredo;            /* true if entry was added via xlog_redo */
     char        gid[GIDSIZE];    /* The GID assigned to the prepared xact */
-}            GlobalTransactionData;
+} GlobalTransactionData;

 /*
  * Two Phase Commit shared state.  Access to this struct is protected
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index c0e5ab8dbbf..d92d632e248 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -109,7 +109,7 @@ typedef struct WindowStatePerFuncData
     uint8        ignore_nulls;    /* ignore nulls */

     WindowObject winobj;        /* object used in window function API */
-}            WindowStatePerFuncData;
+} WindowStatePerFuncData;

 /*
  * For plain aggregate window functions, we also have one of these.
diff --git a/src/backend/partitioning/partdesc.c b/src/backend/partitioning/partdesc.c
index 5624f503fec..985f48fc34d 100644
--- a/src/backend/partitioning/partdesc.c
+++ b/src/backend/partitioning/partdesc.c
@@ -37,7 +37,7 @@ typedef struct PartitionDirectoryData
     MemoryContext pdir_mcxt;
     HTAB       *pdir_hash;
     bool        omit_detached;
-}            PartitionDirectoryData;
+} PartitionDirectoryData;

 typedef struct PartitionDirectoryEntry
 {
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index b67ce57656a..bf54655bb96 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -87,7 +87,7 @@ typedef struct ArrayIteratorData
     /* current position information, updated on each iteration */
     char       *data_ptr;        /* our current position in the array */
     int            current_item;    /* the item # we're at in the array */
-}            ArrayIteratorData;
+} ArrayIteratorData;

 static bool ReadArrayDimensions(char **srcptr, int *ndim_p,
                                 int *dim, int *lBound,
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h
index db19ffd9897..d2a3adcc5e5 100644
--- a/src/include/access/gin_private.h
+++ b/src/include/access/gin_private.h
@@ -373,7 +373,7 @@ typedef struct GinScanEntryData
     bool        reduceResult;
     uint32        predictNumberResult;
     GinBtreeData btree;
-}            GinScanEntryData;
+} GinScanEntryData;

 typedef struct GinScanOpaqueData
 {
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 632c4332a8c..f7e4ae3843c 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -106,7 +106,7 @@ typedef struct BitmapHeapScanDescData
     HeapScanDescData rs_heap_base;

     /* Holds no data */
-}            BitmapHeapScanDescData;
+} BitmapHeapScanDescData;
 typedef struct BitmapHeapScanDescData *BitmapHeapScanDesc;

 /*
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h
index 87a8be10461..78989a959d4 100644
--- a/src/include/access/relscan.h
+++ b/src/include/access/relscan.h
@@ -191,7 +191,7 @@ typedef struct IndexScanDescData

     /* parallel index scan information, in shared memory */
     struct ParallelIndexScanDescData *parallel_scan;
-}            IndexScanDescData;
+} IndexScanDescData;

 /* Generic structure for parallel scans */
 typedef struct ParallelIndexScanDescData
@@ -214,6 +214,6 @@ typedef struct SysScanDescData
     struct IndexScanDescData *iscan;    /* only valid in index-scan case */
     struct SnapshotData *snapshot;    /* snapshot to unregister at end of scan */
     struct TupleTableSlot *slot;
-}            SysScanDescData;
+} SysScanDescData;

 #endif                            /* RELSCAN_H */
diff --git a/src/include/executor/nodeAgg.h b/src/include/executor/nodeAgg.h
index 6c4891bbaeb..df52fa1e1af 100644
--- a/src/include/executor/nodeAgg.h
+++ b/src/include/executor/nodeAgg.h
@@ -173,7 +173,7 @@ typedef struct AggStatePerTransData
     FunctionCallInfo serialfn_fcinfo;

     FunctionCallInfo deserialfn_fcinfo;
-}            AggStatePerTransData;
+} AggStatePerTransData;

 /*
  * AggStatePerAggData - per-aggregate information
@@ -229,7 +229,7 @@ typedef struct AggStatePerAggData
      * aggregates because the final function is read-write.
      */
     bool        shareable;
-}            AggStatePerAggData;
+} AggStatePerAggData;

 /*
  * AggStatePerGroupData - per-aggregate-per-group working state
@@ -264,7 +264,7 @@ typedef struct AggStatePerGroupData
      * NULL and not auto-replace it with a later input value. Only the first
      * non-NULL input will be auto-substituted.
      */
-}            AggStatePerGroupData;
+} AggStatePerGroupData;

 /*
  * AggStatePerPhaseData - per-grouping-set-phase state
@@ -297,7 +297,7 @@ typedef struct AggStatePerPhaseData
      *----------
      */
     ExprState  *evaltrans_cache[2][2];
-}            AggStatePerPhaseData;
+} AggStatePerPhaseData;

 /*
  * AggStatePerHashData - per-hashtable state
@@ -319,7 +319,7 @@ typedef struct AggStatePerHashData
     AttrNumber *hashGrpColIdxInput; /* hash col indices in input slot */
     AttrNumber *hashGrpColIdxHash;    /* indices in hash table tuples */
     Agg           *aggnode;        /* original Agg node, for numGroups etc. */
-}            AggStatePerHashData;
+} AggStatePerHashData;


 extern AggState *ExecInitAgg(Agg *node, EState *estate, int eflags);
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 64ff6996431..3968429f991 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -882,7 +882,7 @@ typedef struct TupleHashTableData
     ExprState  *in_hash_expr;    /* ExprState for hashing input datatype(s) */
     ExprState  *cur_eq_func;    /* comparator for input vs. table */
     ExprContext *exprcontext;    /* expression context */
-}            TupleHashTableData;
+} TupleHashTableData;

 typedef tuplehash_iterator TupleHashIterator;

diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index 46a8655621d..b5ff456ef7f 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -639,7 +639,7 @@ typedef struct PartitionSchemeData

     /* Cached information about partition comparison functions. */
     struct FmgrInfo *partsupfunc;
-}            PartitionSchemeData;
+} PartitionSchemeData;

 typedef struct PartitionSchemeData *PartitionScheme;

diff --git a/src/include/utils/skipsupport.h b/src/include/utils/skipsupport.h
index c42be001fb5..bc51847cf61 100644
--- a/src/include/utils/skipsupport.h
+++ b/src/include/utils/skipsupport.h
@@ -90,7 +90,7 @@ typedef struct SkipSupportData
      */
     SkipSupportIncDec decrement;
     SkipSupportIncDec increment;
-}            SkipSupportData;
+} SkipSupportData;

 extern SkipSupport PrepareSkipSupportFromOpclass(Oid opfamily, Oid opcintype,
                                                  bool reverse);
diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h
index 0bf55902aa1..63a7cc13a31 100644
--- a/src/include/utils/tuplesort.h
+++ b/src/include/utils/tuplesort.h
@@ -57,7 +57,7 @@ typedef struct SortCoordinateData

     /* Private opaque state (points to shared memory) */
     Sharedsort *sharedsort;
-}            SortCoordinateData;
+} SortCoordinateData;

 typedef struct SortCoordinateData *SortCoordinate;

diff --git a/src/test/modules/test_int128/test_int128.c b/src/test/modules/test_int128/test_int128.c
index 1efd4ff68b3..f4c4f3a1de0 100644
--- a/src/test/modules/test_int128/test_int128.c
+++ b/src/test/modules/test_int128/test_int128.c
@@ -51,7 +51,7 @@ typedef union
         int64        hi;
 #endif
     }            hl;
-}            test128;
+} test128;

 #define INT128_HEX_FORMAT    "%016" PRIx64 "%016" PRIx64

diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index efa32dc1295..d7459af2ba3 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -48,10 +48,15 @@ AggPath
 AggSplit
 AggState
 AggStatePerAgg
+AggStatePerAggData
 AggStatePerGroup
+AggStatePerGroupData
 AggStatePerHash
+AggStatePerHashData
 AggStatePerPhase
+AggStatePerPhaseData
 AggStatePerTrans
+AggStatePerTransData
 AggStrategy
 AggTransInfo
 Aggref
@@ -151,6 +156,7 @@ ArrayExpr
 ArrayExprIterState
 ArrayIOData
 ArrayIterator
+ArrayIteratorData
 ArrayMapState
 ArrayMetaState
 ArraySortCachedInfo
@@ -268,6 +274,7 @@ BitmapAndState
 BitmapHeapPath
 BitmapHeapScan
 BitmapHeapScanDesc
+BitmapHeapScanDescData
 BitmapHeapScanInstrumentation
 BitmapHeapScanState
 BitmapIndexScan
@@ -618,7 +625,6 @@ DatumTupleFields
 DbInfo
 DbInfoArr
 DbLocaleInfo
-DbOidName
 DeClonePtrType
 DeadLockState
 DeallocateStmt
@@ -1078,6 +1084,7 @@ GinPostingList
 GinPostingTreeScanItem
 GinQualCounts
 GinScanEntry
+GinScanEntryData
 GinScanItem
 GinScanKey
 GinScanKeyData
@@ -1102,6 +1109,7 @@ GistSplitVector
 GistTsVectorOptions
 GistVacState
 GlobalTransaction
+GlobalTransactionData
 GlobalVisHorizonKind
 GlobalVisState
 GrantRoleOptions
@@ -1273,6 +1281,7 @@ IndexPath
 IndexRuntimeKeyInfo
 IndexScan
 IndexScanDesc
+IndexScanDescData
 IndexScanInstrumentation
 IndexScanState
 IndexStateFlagsAction
@@ -1729,9 +1738,9 @@ MultiSortSupportData
 MultiXactId
 MultiXactMember
 MultiXactOffset
+MultiXactOffset32
 MultiXactStateData
 MultiXactStatus
-MultiXactWriter
 MultirangeIOData
 MultirangeParseState
 MultirangeType
@@ -1752,7 +1761,6 @@ NamedArgExpr
 NamedDSAState
 NamedDSHState
 NamedDSMState
-NamedLWLockTranche
 NamedLWLockTrancheRequest
 NamedTuplestoreScan
 NamedTuplestoreScanState
@@ -2126,6 +2134,7 @@ PartitionCmd
 PartitionDesc
 PartitionDescData
 PartitionDirectory
+PartitionDirectoryData
 PartitionDirectoryEntry
 PartitionDispatch
 PartitionElem
@@ -2145,6 +2154,7 @@ PartitionRangeBound
 PartitionRangeDatum
 PartitionRangeDatumKind
 PartitionScheme
+PartitionSchemeData
 PartitionSpec
 PartitionStrategy
 PartitionTupleRouting
@@ -2298,7 +2308,6 @@ PlannerParamItem
 Point
 Pointer
 PolicyInfo
-PolyNumAggState
 Pool
 PopulateArrayContext
 PopulateArrayState
@@ -2604,6 +2613,7 @@ RewriteMappingDataEntry
 RewriteMappingFile
 RewriteRule
 RewriteState
+RewriteStateData
 RmgrData
 RmgrDescData
 RmgrId
@@ -2805,6 +2815,7 @@ SinglePartitionSpec
 Size
 SkipPages
 SkipSupport
+SkipSupportData
 SkipSupportIncDec
 SlabBlock
 SlabContext
@@ -2835,6 +2846,7 @@ SortBy
 SortByDir
 SortByNulls
 SortCoordinate
+SortCoordinateData
 SortGroupClause
 SortItem
 SortPath
@@ -2870,8 +2882,8 @@ SpecialJoinInfo
 SpinDelayStatus
 SplitInterval
 SplitLR
-SplitPartitionContext
 SplitPageLayout
+SplitPartitionContext
 SplitPoint
 SplitTextOutputData
 SplitVar
@@ -2947,6 +2959,7 @@ SyncStandbySlotsConfigData
 SyncingRelationsState
 SysFKRelationship
 SysScanDesc
+SysScanDescData
 SyscacheCallbackFunction
 SysloggerStartupData
 SystemRowsSamplerData
@@ -3138,6 +3151,7 @@ TupleHashEntry
 TupleHashEntryData
 TupleHashIterator
 TupleHashTable
+TupleHashTableData
 TupleQueueReader
 TupleTableSlot
 TupleTableSlotOps
@@ -3213,7 +3227,6 @@ VacAttrStats
 VacAttrStatsP
 VacDeadItemsInfo
 VacErrPhase
-VacObjFilter
 VacOptValue
 VacuumParams
 VacuumRelation
@@ -3285,10 +3298,10 @@ WaitEventIO
 WaitEventIPC
 WaitEventSet
 WaitEventTimeout
-WaitLSNType
-WaitLSNState
 WaitLSNProcInfo
 WaitLSNResult
+WaitLSNState
+WaitLSNType
 WaitPMResult
 WaitStmt
 WalCloseMethod
@@ -3331,6 +3344,7 @@ WindowObjectData
 WindowStatePerAgg
 WindowStatePerAggData
 WindowStatePerFunc
+WindowStatePerFuncData
 WithCheckOption
 WithClause
 WordBoundaryNext
@@ -3944,7 +3958,6 @@ pg_unicode_recompinfo
 pg_usec_time_t
 pg_utf_to_local_combined
 pg_uuid_t
-pg_wc_probefunc
 pg_wchar
 pg_wchar_tbl
 pgp_armor_headers_state
@@ -3965,6 +3978,8 @@ pgthreadlock_t
 pid_t
 pivot_field
 planner_hook_type
+planner_setup_hook_type
+planner_shutdown_hook_type
 planstate_tree_walker_callback
 plperl_array_info
 plperl_call_data
@@ -4039,6 +4054,7 @@ reduce_outer_joins_partial_state
 reduce_outer_joins_pass1_state
 reduce_outer_joins_pass2_state
 reference
+regc_wc_probefunc
 regex_arc_t
 regexp
 regexp_matches_ctx
@@ -4165,6 +4181,7 @@ tar_file
 td_entry
 teSection
 temp_tablespaces_extra
+test128
 test_re_flags
 test_regex_ctx
 test_shm_mq_header
@@ -4236,6 +4253,7 @@ varatt_expanded
 varattrib_1b
 varattrib_1b_e
 varattrib_4b
+vartag_external
 vbits
 verifier_context
 walrcv_alter_slot_fn
@@ -4364,7 +4382,6 @@ xmlGenericErrorFunc
 xmlNodePtr
 xmlNodeSetPtr
 xmlParserCtxtPtr
-xmlParserErrors
 xmlParserInputPtr
 xmlSaveCtxt
 xmlSaveCtxtPtr

Re: Proposed mid-cycle update of typedefs.list

От
Andres Freund
Дата:
Hi,

On 2025-12-14 14:57:48 -0500, Tom Lane wrote:
> I happened to notice that the buildfarm's current typedefs list
> adds quite a few names that were not previously being captured,
> for example
> 
> @@ -48,10 +48,15 @@ AggPath
>  AggSplit
>  AggState
>  AggStatePerAgg
> +AggStatePerAggData
>  AggStatePerGroup
> +AggStatePerGroupData
>  AggStatePerHash
> +AggStatePerHashData
>  AggStatePerPhase
> +AggStatePerPhaseData
>  AggStatePerTrans
> +AggStatePerTransData
>  AggStrategy
>  AggTransInfo
>  Aggref
> 
> This is great, because it means that the declarations of these
> structs need not look funny anymore.  But I am not quite sure why
> this happened.  It's not a BF tooling change as I first thought,
> because multiple animals are reporting these names and the
> same animals are not capturing these names on the back branches.
> The best theory I can come up with is that 1b105f947 et al
> used these names in palloc0_array and similar calls, and that
> somehow looks like a capturable typedef reference ... but how?

That's indeed curious. I wonder if it's because the return type is cast
differently:

Before:
    peraggs = (AggStatePerAgg) palloc0(sizeof(AggStatePerAggData) * numaggs);
after
    peraggs = palloc0_array(AggStatePerAggData, numaggs);
where palloc_array() will transform that to

    peraggs = (AggStatePerAggData*) palloc(sizeof(AggStatePerAggData) * numaggs);

note that the return type is cast to AggStatePerAggData instead of
AggStatePerAgg.  Other than the sizeof() there previously were no references
to AggStatePerAggData. But I guess the intermediary of type
AggStatePerAggData* now leads to it being in the debug info.


LGTM.


> One change I did not apply is that the buildfarm's list omits pgoff_t,
> although we certainly still use that.  This is evidently because
> pgoff_t is defined as a macro not a typedef name.  I guess we've been
> manually preserving that name in the list, but it seems like we should
> change "#define pgoff_t off_t" to "typedef off_t pgoff_t;" to avoid
> that manual hack.  I've not done that here, though.

Sounds like a good idea to me.


Greetings,

Andres Freund



Re: Proposed mid-cycle update of typedefs.list

От
Tom Lane
Дата:
Andres Freund <andres@anarazel.de> writes:
> On 2025-12-14 14:57:48 -0500, Tom Lane wrote:
>> The best theory I can come up with is that 1b105f947 et al
>> used these names in palloc0_array and similar calls, and that
>> somehow looks like a capturable typedef reference ... but how?

> That's indeed curious. I wonder if it's because the return type is cast
> differently:

Guess it must be.  I had thought that our tooling captures types
that are used to declare variables or fields of struct variables,
but evidently that's not the whole story.  One thing we do know
for sure is that "sizeof(footype)" does not create a capturable
reference to footype.  But maybe references within casts do?

>> One change I did not apply is that the buildfarm's list omits pgoff_t,
>> although we certainly still use that.  This is evidently because
>> pgoff_t is defined as a macro not a typedef name.  I guess we've been
>> manually preserving that name in the list, but it seems like we should
>> change "#define pgoff_t off_t" to "typedef off_t pgoff_t;" to avoid
>> that manual hack.  I've not done that here, though.

> Sounds like a good idea to me.

I'll go deal with these things shortly.

            regards, tom lane



Re: Proposed mid-cycle update of typedefs.list

От
Michael Paquier
Дата:
On Sun, Dec 14, 2025 at 04:38:59PM -0500, Tom Lane wrote:
> I'll go deal with these things shortly.

Thanks for cleaning up all that!
--
Michael

Вложения