Re: 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: Re: new clang warnings about unused global variables
Date: 2026-09-03 13:01:14
Message-ID: e4f4d6dc-e2ae-4b6b-9b6e-9d2f2a0261fb@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28.08.26 23:33, Peter Eisentraut wrote:
> 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.

I sense that nobody is going to have issues with this. Any objections
to backpatching this? I suspect that over time many more people are
going to run into this, so keeping the backbranches warning-free seems
sensible.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yuhang Qiu 2026-09-03 13:15:15 Re: aio: Async fsyncs for crash recovery and checkpointer
Previous Message Jochen Bandhauer 2026-09-03 12:56:05 Re: Protocol compression: a fourth design