Re: new clang warnings about unused global variables

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andreas Karlsson <andreas(at)proxel(dot)se>
Subject: Re: new clang warnings about unused global variables
Date: 2026-11-24 13:04:52
Message-ID: 3ae641ec-81c4-487e-87ba-390da6d034ed@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/09/2026 21:58, Peter Eisentraut wrote:
> On 07.09.26 20:39, Tom Lane wrote:
>> Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
>>> On 03.09.26 15:52, Tom Lane wrote:
>>>> But I concur with Andreas that 0005 looks a bit half-baked.
>>>> Maybe that's the right amount of effort for the back branches,
>>>> but something else should happen in HEAD.
>>
>>> Right.  Here is another patch at the end (0006) that I propose for
>>> master only that makes using unsupported options an error.  Some
>>> Windows-only options already behaved that way, so this just makes the
>>> rest consistent.
>>
>> With that addition, this looks fine to me.
>
> This has been committed and backpatched.  There were a few more issues of this
> kind in the backbranches, which I have also fixed.

Building current master on macOS with a recent clang, I still get two of these
warnings, both in psql:

input.c:36:12: warning: variable 'history_lines_added' set but not used
[-Wunused-but-set-global]
tab-complete.in.c:225:13: warning: variable 'completion_last_char' set but not
used [-Wunused-but-set-global]

They only appear when psql is linked against a line-editing library that lacks
some optional functions, such as libedit, which ships with macOS. That is
probably why they didn't show up in your build.

See the sketch solution in the attached patch.

--
regards, Andrei Lepikhov,
pgEdge

Attachment Content-Type Size
v0-0001-Silence-Wunused-but-set-global-warnings-with-libe.patch text/plain 2.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chengpeng Yan 2026-11-24 13:06:04 Re: [PATCH] Fix encoding-dependent LIKE/regex selectivity estimates
Previous Message Tatsuya Kawata 2026-11-24 12:59:52 Re: Hash aggregation shows only the last execution's stats for parallel workers