pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
unused-but-set-variable warning on REL_13_STABLE
3+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2024-12-09 0fbcb9da18  Fix unused-but-set-variable compiler warning in reorderbuffer.c.
* unused-but-set-variable warning on REL_13_STABLE
@ 2024-12-09 19:16 Nathan Bossart <nathandbossart@gmail.com>
  2024-12-09 19:39 ` Re: unused-but-set-variable warning on REL_13_STABLE Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Nathan Bossart @ 2024-12-09 19:16 UTC (permalink / raw)
  To: pgsql-hackers

My compiler emits the following warning on REL_13_STABLE when assertions
are disabled:

	reorderbuffer.c:2471:8: warning: variable 'spilled' set but not used [-Wunused-but-set-variable]
	 2471 |         Size            spilled = 0;
	      |                         ^

Adding PG_USED_FOR_ASSERTS_ONLY (as in the attached patch) seems sufficient
to suppress this warning.  On newer versions, this variable is used for
more than assertions, so the patch only needs to be applied to v13.  Since
this is trivial, I plan to commit it shortly.

-- 
nathan

Attachments:

fix_unused_warning.patch (text/plain, 587B) download diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index c7f8fa6216..56c25e3a6d 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2468,7 +2468,7 @@ ReorderBufferSerializeTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) dlist_mutable_iter change_i; int fd = -1; XLogSegNo curOpenSegNo = 0; - Size spilled = 0; + Size spilled PG_USED_FOR_ASSERTS_ONLY = 0; elog(DEBUG2, "spill %u changes in XID %u to disk", (uint32) txn->nentries_mem, txn->xid);
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: unused-but-set-variable warning on REL_13_STABLE
  2024-12-09 19:16 unused-but-set-variable warning on REL_13_STABLE Nathan Bossart <nathandbossart@gmail.com>
@ 2024-12-09 19:39 ` Tom Lane <tgl@sss.pgh.pa.us>
  2024-12-09 22:28   ` Re: unused-but-set-variable warning on REL_13_STABLE Nathan Bossart <nathandbossart@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2024-12-09 19:39 UTC (permalink / raw)
  To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: pgsql-hackers

Nathan Bossart <nathandbossart@gmail.com> writes:
> Adding PG_USED_FOR_ASSERTS_ONLY (as in the attached patch) seems sufficient
> to suppress this warning.  On newer versions, this variable is used for
> more than assertions, so the patch only needs to be applied to v13.  Since
> this is trivial, I plan to commit it shortly.

LGTM

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: unused-but-set-variable warning on REL_13_STABLE
  2024-12-09 19:16 unused-but-set-variable warning on REL_13_STABLE Nathan Bossart <nathandbossart@gmail.com>
  2024-12-09 19:39 ` Re: unused-but-set-variable warning on REL_13_STABLE Tom Lane <tgl@sss.pgh.pa.us>
@ 2024-12-09 22:28   ` Nathan Bossart <nathandbossart@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Nathan Bossart @ 2024-12-09 22:28 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-hackers

On Mon, Dec 09, 2024 at 02:39:30PM -0500, Tom Lane wrote:
> LGTM

Thanks!  Committed.

-- 
nathan





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-12-09 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-09 19:16 unused-but-set-variable warning on REL_13_STABLE Nathan Bossart <nathandbossart@gmail.com>
2024-12-09 19:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2024-12-09 22:28   ` Nathan Bossart <nathandbossart@gmail.com>

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