new clang warnings about unused global variables

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: new clang warnings about unused global variables
Date: 2026-08-28 21:33:12
Message-ID: eb013f9d-2247-444e-8815-9d17b4ce78e7@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The new clang 23 has a new warning apparently enabled by default (at
least by default in a PostgreSQL build) about set-but-unused static
global variables: -Wunused-but-set-global. This triggers a few warnings
in PostgreSQL code. See attached patches. The first four of these are
genuine hits; these variables were never read from or the last reading
use was removed some time ago. The last one in pg_ctl is about options
that can be set from the command line on any platform but are only used
on Windows. This seems kind of weird behavior; maybe in the future we
should make those options error out on non-Windows, and then the
variables wouldn't be uselessly set.

Attachment Content-Type Size
0001-Remove-unused-global-variable-xlog.c.patch text/plain 3.5 KB
0002-Remove-unused-global-variable-test_resowner.patch text/plain 2.0 KB
0003-Remove-unused-global-variable-pg_dump.patch text/plain 1.3 KB
0004-Remove-unused-global-variable-postmaster.patch text/plain 1.2 KB
0005-Silence-warnings-about-unused-global-variables-pg_ct.patch text/plain 1.9 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-08-28 21:39:54 Re: Should the WAIT FOR command tag be "WAIT" or "WAIT FOR"?
Previous Message Nathan Bossart 2026-08-28 21:23:10 Re: REPACK ONLY is accepted but ignored