From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix "variable set but not used" warning with unnamed POSIX semap
Date: Sun, 25 Oct 2026 22:19:01 +0000
Message-ID: <E1xL6YP-00000000kVx-0Zo1@gemulon.postgresql.org> (raw)
Fix "variable set but not used" warning with unnamed POSIX semaphores.
Late-model clang is able to notice, when building posix_sema.c with
USE_NAMED_POSIX_SEMAPHORES not defined, that the static variable
nextSemKey is set once and read nowhere. Rearrange the #ifdef's
to not declare or set it unless USE_NAMED_POSIX_SEMAPHORES. As a
small side benefit, we can skip a stat() call altogether if we're
not going to need it to initialize this variable, which I think
clarifies the code a fraction.
Per buildfarm member fritillary.
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/a45e1d0ee7486a3278739cd8d895902173f90b0d
Modified Files
--------------
src/backend/port/posix_sema.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix "variable set but not used" warning with unnamed POSIX semap
In-Reply-To: <E1xL6YP-00000000kVx-0Zo1@gemulon.postgresql.org>
References: <E1xL6YP-00000000kVx-0Zo1@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox