From: Nathan Bossart <nathandbossart@gmail.com>
To: pgsql-hackers@postgresql.org
Subject: unused-but-set-variable warning on REL_13_STABLE
Date: Mon, 9 Dec 2024 13:16:38 -0600
Message-ID: <Z1dCFnzrP24O8WNR@nathan> (raw)
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) downloaddiff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.cindex 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);
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: nathandbossart@gmail.com
Subject: Re: unused-but-set-variable warning on REL_13_STABLE
In-Reply-To: <Z1dCFnzrP24O8WNR@nathan>
* 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