pgsql: Fix "variable set but not used" warning with unnamed POSIX semap

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix "variable set but not used" warning with unnamed POSIX semap
Date: 2026-10-25 22:19:01
Message-ID: E1xL6YP-00000000kVp-0Duq@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-10-25 23:28:13 pgsql: Fix tab completion for concurrent matview refresh
Previous Message Tom Lane 2026-10-25 19:14:19 pgsql: Fix leaked hash scans in pg_listening_channels().