pgsql: Remove unused global variables

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove unused global variables
Date: 2026-09-11 19:33:21
Message-ID: E1x56zw-00000004Tif-0rya@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Reinit was already documented in a comment as dead code, and it was
removed in a later branch. To minimize the surgery there, just add an
unused attribute to silence the warning.

Reviewed-by: Andreas Karlsson <andreas(at)proxel(dot)se>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://www.postgresql.org/message-id/flat/eb013f9d-2247-444e-8815-9d17b4ce78e7%40eisentraut.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4096767a94b039aebcc84e347ea1744374a6f6eb

Modified Files
--------------
src/backend/postmaster/postmaster.c | 2 +-
src/backend/utils/adt/jsonpath_scan.l | 2 --
src/bin/pg_dump/pg_dump_sort.c | 2 --
src/interfaces/libpq/fe-secure-openssl.c | 4 ++++
4 files changed, 5 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2026-09-11 19:38:29 pgsql: Fix optional-argument handling in in-tree getopt_long().
Previous Message Peter Eisentraut 2026-09-11 19:09:43 pgsql: pg_ctl: Silence warnings about unused global variables