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: Suppress variable-set-but-not-used warnings from clang 15.
Date: Tue, 20 Sep 2022 16:05:10 +0000
Message-ID: <E1oafkD-001DRn-U0@gemulon.postgresql.org> (raw)

Suppress variable-set-but-not-used warnings from clang 15.

clang 15+ will issue a set-but-not-used warning when the only
use of a variable is in autoincrements (e.g., "foo++;").
That's perfectly sensible, but it detects a few more cases that
we'd not noticed before.  Silence the warnings with our usual
methods, such as PG_USED_FOR_ASSERTS_ONLY, or in one case by
actually removing a useless variable.

One thing that we can't nicely get rid of is that with %pure-parser,
Bison emits "yynerrs" as a local variable that falls foul of this
warning.  To silence those, I inserted "(void) yynerrs;" in the
top-level productions of affected grammars.

Per recently-established project policy, this is a candidate
for back-patching into out-of-support branches: it suppresses
annoying compiler warnings but changes no behavior.  Hence,
back-patch to 9.5, which is as far as these patches go without
issues.  (A preliminary check shows that the prior branches
need some other set-but-not-used cleanups too, so I'll leave
them for another day.)

Discussion: https://postgr.es/m/514615.1663615243@sss.pgh.pa.us

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/760308704378a96e6a7266326087ec49922ae3f2

Modified Files
--------------
src/backend/access/gist/gistxlog.c       | 2 +-
src/backend/access/transam/xlog.c        | 2 +-
src/backend/parser/gram.y                | 1 +
src/backend/utils/adt/array_typanalyze.c | 4 +---
src/bin/pgbench/exprparse.y              | 5 ++++-
5 files changed, 8 insertions(+), 6 deletions(-)



view thread (20+ messages)  latest in thread

Message-ID: <E1oafkD-001DRn-U0@gemulon.postgresql.org>
Permalink:  ../E1oafkD-001DRn-U0@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oafkD-001DRn-U0@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: Suppress variable-set-but-not-used warnings from clang 15.
  In-Reply-To: <E1oafkD-001DRn-U0@gemulon.postgresql.org>
  References: <E1oafkD-001DRn-U0@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