pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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-00000000kVp-0Duq@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_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e406c4e7ad22f0140d73a19eaa0765e5d765283e

Modified Files
--------------
src/backend/port/posix_sema.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1xL6YP-00000000kVp-0Duq@gemulon.postgresql.org>
Permalink:  ../E1xL6YP-00000000kVp-0Duq@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xL6YP-00000000kVp-0Duq@gemulon.postgresql.org

 · 

reply

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-00000000kVp-0Duq@gemulon.postgresql.org>
  References: <E1xL6YP-00000000kVp-0Duq@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