From 8e183d9bd49a78c0d0647230202ccc710ebcd06b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 22 Sep 2026 19:30:29 +0200 Subject: [PATCH] Silence warnings about unused global variables Similar to commit "Remove unused global variables", silence -Wunused-but-set-global warnings from clang 23 (included in -Wall). These are variables that are used in assert-enabled builds only, so annotate them with PG_USED_FOR_ASSERTS_ONLY. --- src/backend/utils/cache/syscache.c | 2 +- src/test/modules/test_resowner/test_resowner_many.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index f7f4f56a4d2..b4f2dbdee08 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -85,7 +85,7 @@ StaticAssertDecl(lengthof(cacheinfo) == SysCacheSize, static CatCache *SysCache[SysCacheSize]; -static bool CacheInitialized = false; +static bool CacheInitialized PG_USED_FOR_ASSERTS_ONLY = false; /* Sorted array of OIDs of tables that have caches on them */ static Oid SysCacheRelationOid[SysCacheSize]; diff --git a/src/test/modules/test_resowner/test_resowner_many.c b/src/test/modules/test_resowner/test_resowner_many.c index d96dc09831c..c85f0eb9ed0 100644 --- a/src/test/modules/test_resowner/test_resowner_many.c +++ b/src/test/modules/test_resowner/test_resowner_many.c @@ -47,7 +47,7 @@ typedef struct * Priority of last call to the release callback. * This is used to check that the resources are released in correct order. */ -static uint32 last_release_priority = 0; +static uint32 last_release_priority PG_USED_FOR_ASSERTS_ONLY = 0; /* prototypes for local functions */ static void ReleaseManyTestResource(Datum res);