mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
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. For pq_init_crypto_lib, we apply the same #ifdef HAVE_CRYPTO_LOCK that the other uses of the variable already have, so that the variable is either fully used or fully nonexistent, depending on the configuration, not half-way. 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
This commit is contained in:
@@ -645,7 +645,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;
|
||||
|
||||
/* For WALInsertLockAcquire/Release functions */
|
||||
@@ -2722,7 +2721,6 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
|
||||
|
||||
/* update local copy */
|
||||
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
|
||||
LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
|
||||
|
||||
if (XLogRecPtrIsInvalid(LocalMinRecoveryPoint))
|
||||
updateMinRecoveryPoint = false;
|
||||
@@ -2757,7 +2755,6 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
|
||||
ControlFile->minRecoveryPointTLI = newMinRecoveryPointTLI;
|
||||
UpdateControlFile();
|
||||
LocalMinRecoveryPoint = newMinRecoveryPoint;
|
||||
LocalMinRecoveryPointTLI = newMinRecoveryPointTLI;
|
||||
|
||||
ereport(DEBUG2,
|
||||
(errmsg_internal("updated min recovery point to %X/%X on timeline %u",
|
||||
@@ -3137,7 +3134,6 @@ XLogNeedsFlush(XLogRecPtr record)
|
||||
if (!LWLockConditionalAcquire(ControlFileLock, LW_SHARED))
|
||||
return true;
|
||||
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
|
||||
LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
|
||||
LWLockRelease(ControlFileLock);
|
||||
|
||||
/*
|
||||
@@ -5704,12 +5700,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 */
|
||||
@@ -6197,7 +6191,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
|
||||
@@ -7764,7 +7757,6 @@ CreateRestartPoint(int flags)
|
||||
|
||||
/* update local copy */
|
||||
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
|
||||
LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
|
||||
}
|
||||
if (flags & CHECKPOINT_IS_SHUTDOWN)
|
||||
ControlFile->state = DB_SHUTDOWNED_IN_RECOVERY;
|
||||
@@ -8593,7 +8585,6 @@ xlog_redo(XLogReaderState *record)
|
||||
if (InArchiveRecovery)
|
||||
{
|
||||
LocalMinRecoveryPoint = ControlFile->minRecoveryPoint;
|
||||
LocalMinRecoveryPointTLI = ControlFile->minRecoveryPointTLI;
|
||||
}
|
||||
if (LocalMinRecoveryPoint != InvalidXLogRecPtr && LocalMinRecoveryPoint < lsn)
|
||||
{
|
||||
|
||||
@@ -346,8 +346,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 */
|
||||
|
||||
@@ -2437,7 +2435,6 @@ process_pm_child_exit(void)
|
||||
StartupStatus = STARTUP_NOT_RUNNING;
|
||||
FatalError = false;
|
||||
AbortStartTime = 0;
|
||||
ReachedNormalRunning = true;
|
||||
pmState = PM_RUN;
|
||||
connsAllowed = true;
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ static JsonPathString scanstring;
|
||||
/* Handles to the buffer that the lexer uses internally */
|
||||
static YY_BUFFER_STATE scanbufhandle;
|
||||
static char *scanbuf;
|
||||
static int scanbuflen;
|
||||
|
||||
static void addstring(bool init, char *s, int l);
|
||||
static void addchar(bool init, char c);
|
||||
@@ -493,7 +492,6 @@ jsonpath_scanner_init(const char *str, int slen)
|
||||
* Make a scan buffer with special termination needed by flex.
|
||||
*/
|
||||
|
||||
scanbuflen = slen;
|
||||
scanbuf = palloc(slen + 2);
|
||||
memcpy(scanbuf, str, slen);
|
||||
scanbuf[slen] = scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR;
|
||||
|
||||
@@ -156,7 +156,6 @@ static const int dbObjectTypePriority[] =
|
||||
StaticAssertDecl(lengthof(dbObjectTypePriority) == (DO_SUBSCRIPTION_REL + 1),
|
||||
"array length mismatch");
|
||||
|
||||
static DumpId preDataBoundId;
|
||||
static DumpId postDataBoundId;
|
||||
|
||||
|
||||
@@ -567,7 +566,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 = (DumpableObject **) pg_malloc(numObjs * sizeof(DumpableObject *));
|
||||
|
||||
@@ -86,7 +86,9 @@ static int my_SSL_set_fd(PGconn *conn, int fd);
|
||||
|
||||
|
||||
static bool pq_init_ssl_lib = true;
|
||||
#ifdef HAVE_CRYPTO_LOCK
|
||||
static bool pq_init_crypto_lib = true;
|
||||
#endif
|
||||
|
||||
static bool ssl_lib_initialized = false;
|
||||
|
||||
@@ -112,7 +114,9 @@ pgtls_init_library(bool do_ssl, int do_crypto)
|
||||
return;
|
||||
|
||||
pq_init_ssl_lib = do_ssl;
|
||||
#ifdef HAVE_CRYPTO_LOCK
|
||||
pq_init_crypto_lib = do_crypto;
|
||||
#endif
|
||||
}
|
||||
|
||||
PostgresPollingStatusType
|
||||
|
||||
@@ -44,10 +44,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 */
|
||||
@@ -273,18 +272,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);
|
||||
|
||||
Reference in New Issue
Block a user