pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Why does pgindent's README say to download typedefs.list from the buildfarm?
Date: Wed, 15 May 2024 19:32:05 -0400
Message-ID: <1919000.1715815925@sss.pgh.pa.us> (raw)
In-Reply-To: <1833482.1715804603@sss.pgh.pa.us>
References: <20240422192218.GB367217@nathanxps13>
	<3154983.1713816488@sss.pgh.pa.us>
	<20240422202010.GA420168@nathanxps13>
	<20240423200455.GA850264@nathanxps13>
	<CA+Tgmoacj1F=h6HQocSo7btsYDE7Sh+9Lz-g=uZpDMFUVMeCjQ@mail.gmail.com>
	<20240515192952.GA1428991@nathanxps13>
	<CA+TgmobNVBN=Ki=N_5s__T3fvvaD3ppawjEs6KrQB5jUXBL2pA@mail.gmail.com>
	<1833482.1715804603@sss.pgh.pa.us>

I wrote:
> This works for me.  One point that could stand discussion while we're
> here is whether the once-a-cycle run should use the verbatim buildfarm
> results or it's okay to editorialize on that typedefs list.  I did a
> little of the latter in da256a4a7, and I feel like we should either
> bless that practice in this document or decide that it was a bad idea.

> For reference, what I added to the buildfarm's list was

> +InjectionPointCacheEntry
> +InjectionPointCondition
> +InjectionPointConditionType
> +InjectionPointEntry
> +InjectionPointSharedState
> +NotificationHash
> +ReadBuffersFlags
> +ResourceOwnerData
> +WaitEventExtension
> +WalSyncMethod

I realized that the reason the InjectionPoint typedefs were missing
is that none of the buildfarm animals that contribute typedefs are
building with --enable-injection-points.  I rectified that on sifaka,
and now those are in the list available from the buildfarm.

As for the remainder, they aren't showing up because no variable
or field is declared using them, which means no debug symbol
table entry is made for them.  This means we could just drop those
typedefs and be little the worse off notationally.  I experimented
with a patch for that, as attached.  (In the case of NotificationHash,
I thought it better to arrange for there to be a suitable variable;
but it could certainly be done the other way too.)  Is this too anal?

			regards, tom lane

Attachments:

remove-useless-typedefs.patch (text/x-diff, 4.6K) download diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index d0891e3f0e..6861f028d2 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -2253,10 +2253,13 @@ AsyncExistsPendingNotify(Notification *n) if (pendingNotifies->hashtab != NULL) { /* Use the hash table to probe for a match */ - if (hash_search(pendingNotifies->hashtab, - &n, - HASH_FIND, - NULL)) + NotificationHash *ent; + + ent = hash_search(pendingNotifies->hashtab, + &n, + HASH_FIND, + NULL); + if (ent) return true; } else diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c index ab9343bc5c..3bde0eba4d 100644 --- a/src/backend/utils/resowner/resowner.c +++ b/src/backend/utils/resowner/resowner.c @@ -107,7 +107,7 @@ StaticAssertDecl(RESOWNER_HASH_MAX_ITEMS(RESOWNER_HASH_INIT_SIZE) >= RESOWNER_AR /* * ResourceOwner objects look like this */ -typedef struct ResourceOwnerData +struct ResourceOwnerData { ResourceOwner parent; /* NULL if no parent (toplevel owner) */ ResourceOwner firstchild; /* head of linked list of children */ @@ -155,7 +155,7 @@ typedef struct ResourceOwnerData /* The local locks cache. */ LOCALLOCK *locks[MAX_RESOWNER_LOCKS]; /* list of owned locks */ -} ResourceOwnerData; +}; /***************************************************************************** @@ -415,7 +415,7 @@ ResourceOwnerCreate(ResourceOwner parent, const char *name) ResourceOwner owner; owner = (ResourceOwner) MemoryContextAllocZero(TopMemoryContext, - sizeof(ResourceOwnerData)); + sizeof(*owner)); owner->name = name; if (parent) diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 76787a8267..1a1f11a943 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -19,14 +19,14 @@ /* Sync methods */ -typedef enum WalSyncMethod +enum WalSyncMethod { WAL_SYNC_METHOD_FSYNC = 0, WAL_SYNC_METHOD_FDATASYNC, WAL_SYNC_METHOD_OPEN, /* for O_SYNC */ WAL_SYNC_METHOD_FSYNC_WRITETHROUGH, WAL_SYNC_METHOD_OPEN_DSYNC /* for O_DSYNC */ -} WalSyncMethod; +}; extern PGDLLIMPORT int wal_sync_method; extern PGDLLIMPORT XLogRecPtr ProcLastRecPtr; diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 42211bfec4..edb7011743 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -107,14 +107,14 @@ typedef struct BufferManagerRelation #define BMR_REL(p_rel) ((BufferManagerRelation){.rel = p_rel}) #define BMR_SMGR(p_smgr, p_relpersistence) ((BufferManagerRelation){.smgr = p_smgr, .relpersistence = p_relpersistence}) -typedef enum ReadBuffersFlags +enum ReadBuffersFlags { /* Zero out page if reading fails. */ READ_BUFFERS_ZERO_ON_ERROR = (1 << 0), /* Call smgrprefetch() if I/O necessary. */ READ_BUFFERS_ISSUE_ADVICE = (1 << 1), -} ReadBuffersFlags; +}; struct ReadBuffersOperation { diff --git a/src/include/utils/wait_event.h b/src/include/utils/wait_event.h index 080e92d1cf..72c4d60930 100644 --- a/src/include/utils/wait_event.h +++ b/src/include/utils/wait_event.h @@ -53,11 +53,11 @@ extern PGDLLIMPORT uint32 *my_wait_event_info; * * The ID retrieved can be used with pgstat_report_wait_start() or equivalent. */ -typedef enum +enum WaitEventExtension { WAIT_EVENT_EXTENSION = PG_WAIT_EXTENSION, WAIT_EVENT_EXTENSION_FIRST_USER_DEFINED, -} WaitEventExtension; +}; extern void WaitEventExtensionShmemInit(void); extern Size WaitEventExtensionShmemSize(void); diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list index 2b83c340fb..a5cf553c4b 100644 --- a/src/tools/pgindent/typedefs.list +++ b/src/tools/pgindent/typedefs.list @@ -1231,6 +1231,7 @@ InitSampleScan_function InitializeDSMForeignScan_function InitializeWorkerForeignScan_function InjectionPointCacheEntry +InjectionPointCallback InjectionPointCondition InjectionPointConditionType InjectionPointEntry @@ -2326,7 +2327,6 @@ ReInitializeDSMForeignScan_function ReScanForeignScan_function ReadBufPtrType ReadBufferMode -ReadBuffersFlags ReadBuffersOperation ReadBytePtrType ReadExtraTocPtrType @@ -2443,7 +2443,6 @@ ReservoirState ReservoirStateData ResourceElem ResourceOwner -ResourceOwnerData ResourceOwnerDesc ResourceReleaseCallback ResourceReleaseCallbackItem @@ -3100,7 +3099,6 @@ WaitEvent WaitEventActivity WaitEventBufferPin WaitEventClient -WaitEventExtension WaitEventExtensionCounterData WaitEventExtensionEntryById WaitEventExtensionEntryByName @@ -3128,7 +3126,6 @@ WalSndState WalSummarizerData WalSummaryFile WalSummaryIO -WalSyncMethod WalTimeSample WalUsage WalWriteMethod

view thread (29+ messages)  latest in thread

Message-ID: <1919000.1715815925@sss.pgh.pa.us>
Permalink:  ../1919000.1715815925@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1919000.1715815925@sss.pgh.pa.us

 ·  · 

reply

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: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, nathandbossart@gmail.com
  Subject: Re: Why does pgindent's README say to download typedefs.list from the buildfarm?
  In-Reply-To: <1919000.1715815925@sss.pgh.pa.us>

* 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