summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut2026-09-11 15:43:11 +0000
committerPeter Eisentraut2026-09-11 17:24:47 +0000
commite8601cb3d48de06e642683e91ef21f528e2ab462 (patch)
tree6494726289e96c506730765c094dbbb0ecb59447 /src
parent741f9d741e6dd9bc9174e4f522fc65b87b8d5ee3 (diff)
Remove unused global variables
The new clang 23 has a new warning about set-but-unused static (internal-linkage) global variables: -Wunused-but-set-global, which is activated in PostgreSQL builds via -Wall. This triggers a few warnings in PostgreSQL code. This commit removes several such variables that were either never used or whose last use was removed some time ago. Reviewed-by: Andreas Karlsson <andreas@proxel.se> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/eb013f9d-2247-444e-8815-9d17b4ce78e7%40eisentraut.org
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlog.c10
-rw-r--r--src/backend/postmaster/postmaster.c3
-rw-r--r--src/bin/pg_dump/pg_dump_sort.c2
-rw-r--r--src/test/modules/test_resowner/test_resowner_many.c6
4 files changed, 1 insertions, 20 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 29995c67ea7..2076aff68c4 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -672,7 +672,6 @@ static TimeLineID openLogTLI = 0;
* Those values are kept consistent as long as crash recovery runs.
*/
static XLogRecPtr LocalMinRecoveryPoint;
-static TimeLineID LocalMinRecoveryPointTLI;
static bool updateMinRecoveryPoint = true;
/*
@@ -2753,7 +2752,6 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
/* update local copy */
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
- LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
if (!XLogRecPtrIsValid(LocalMinRecoveryPoint))
updateMinRecoveryPoint = false;
@@ -2788,7 +2786,6 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
ControlFile->minRecoveryPointTLI = newMinRecoveryPointTLI;
UpdateControlFile();
LocalMinRecoveryPoint = newMinRecoveryPoint;
- LocalMinRecoveryPointTLI = newMinRecoveryPointTLI;
ereport(DEBUG2,
errmsg_internal("updated min recovery point to %X/%08X on timeline %u",
@@ -3202,7 +3199,6 @@ XLogNeedsFlush(XLogRecPtr record)
if (!LWLockConditionalAcquire(ControlFileLock, LW_SHARED))
return true;
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
- LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
LWLockRelease(ControlFileLock);
/*
@@ -6208,12 +6204,10 @@ StartupXLOG(void)
if (InArchiveRecovery)
{
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
- LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
}
else
{
LocalMinRecoveryPoint = InvalidXLogRecPtr;
- LocalMinRecoveryPointTLI = 0;
}
/* Check that the GUCs used to generate the WAL allow recovery */
@@ -6750,7 +6744,6 @@ SwitchIntoArchiveRecovery(XLogRecPtr EndRecPtr, TimeLineID replayTLI)
}
/* update local copy */
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
- LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
/*
* The startup process can update its local copy of minRecoveryPoint from
@@ -8310,7 +8303,6 @@ CreateRestartPoint(int flags)
/* update local copy */
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
- LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
}
if (flags & CHECKPOINT_IS_SHUTDOWN)
ControlFile->state = DB_SHUTDOWNED_IN_RECOVERY;
@@ -9155,7 +9147,6 @@ xlog_redo(XLogReaderState *record)
if (InArchiveRecovery)
{
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
- LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
}
if (XLogRecPtrIsValid(LocalMinRecoveryPoint) && LocalMinRecoveryPoint < lsn)
{
@@ -9301,7 +9292,6 @@ xlog2_redo(XLogReaderState *record)
if (InArchiveRecovery)
{
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
- LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
}
if (XLogRecPtrIsValid(LocalMinRecoveryPoint) && LocalMinRecoveryPoint < lsn)
{
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index c5b141ed3e3..4d5338a462d 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -369,8 +369,6 @@ static time_t AbortStartTime = 0;
/* Length of said timeout */
#define SIGKILL_CHILDREN_AFTER_SECS 5
-static bool ReachedNormalRunning = false; /* T if we've reached PM_RUN */
-
bool ClientAuthInProgress = false; /* T during new-client
* authentication */
@@ -2362,7 +2360,6 @@ process_pm_child_exit(void)
StartupStatus = STARTUP_NOT_RUNNING;
FatalError = false;
AbortStartTime = 0;
- ReachedNormalRunning = true;
UpdatePMState(PM_RUN);
connsAllowed = true;
diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c
index 03e5c1c1116..3496303932b 100644
--- a/src/bin/pg_dump/pg_dump_sort.c
+++ b/src/bin/pg_dump/pg_dump_sort.c
@@ -157,7 +157,6 @@ static const int dbObjectTypePriority[] =
StaticAssertDecl(lengthof(dbObjectTypePriority) == NUM_DUMPABLE_OBJECT_TYPES,
"array length mismatch");
-static DumpId preDataBoundId;
static DumpId postDataBoundId;
@@ -569,7 +568,6 @@ sortDumpableObjects(DumpableObject **objs, int numObjs,
* Saving the boundary IDs in static variables is a bit grotty, but seems
* better than adding them to parameter lists of subsidiary functions.
*/
- preDataBoundId = preBoundaryId;
postDataBoundId = postBoundaryId;
ordering = pg_malloc_array(DumpableObject *, numObjs);
diff --git a/src/test/modules/test_resowner/test_resowner_many.c b/src/test/modules/test_resowner/test_resowner_many.c
index 4962b371bdc..8a836759134 100644
--- a/src/test/modules/test_resowner/test_resowner_many.c
+++ b/src/test/modules/test_resowner/test_resowner_many.c
@@ -43,10 +43,9 @@ typedef struct
} ManyTestResource;
/*
- * Current release phase, and priority of last call to the release callback.
+ * Priority of last call to the release callback.
* This is used to check that the resources are released in correct order.
*/
-static ResourceReleasePhase current_release_phase;
static uint32 last_release_priority = 0;
/* prototypes for local functions */
@@ -272,18 +271,15 @@ test_resowner_many(PG_FUNCTION_ARGS)
/* Start releasing */
elog(NOTICE, "releasing resources before locks");
- current_release_phase = RESOURCE_RELEASE_BEFORE_LOCKS;
last_release_priority = 0;
ResourceOwnerRelease(resowner, RESOURCE_RELEASE_BEFORE_LOCKS, false, false);
Assert(GetTotalResourceCount(before_kinds, nkinds) == 0);
elog(NOTICE, "releasing locks");
- current_release_phase = RESOURCE_RELEASE_LOCKS;
last_release_priority = 0;
ResourceOwnerRelease(resowner, RESOURCE_RELEASE_LOCKS, false, false);
elog(NOTICE, "releasing resources after locks");
- current_release_phase = RESOURCE_RELEASE_AFTER_LOCKS;
last_release_priority = 0;
ResourceOwnerRelease(resowner, RESOURCE_RELEASE_AFTER_LOCKS, false, false);
Assert(GetTotalResourceCount(before_kinds, nkinds) == 0);