Fix unused-but-set-variable compiler warning in reorderbuffer.c.
authorNathan Bossart <[email protected]>
Mon, 9 Dec 2024 22:26:23 +0000 (16:26 -0600)
committerNathan Bossart <[email protected]>
Mon, 9 Dec 2024 22:26:23 +0000 (16:26 -0600)
On v13, this variable is only used for an assertion, so adding
PG_USED_FOR_ASSERTS_ONLY is sufficient to suppress this warning on
builds with assertions disabled.  Older versions are unsupported,
and newer versions use the variable for more than the assertion, so
this patch only needs to be applied to REL_13_STABLE.

Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/Z1dCFnzrP24O8WNR%40nathan

src/backend/replication/logical/reorderbuffer.c

index c7f8fa6216c06bf2de0f87e6725a34b038ebeaa5..56c25e3a6da5fe5d7ea980ef13aa5ab7599c1c72 100644 (file)
@@ -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);