pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Silencing the remaining clang 15 warnings
Date: Mon, 19 Sep 2022 19:06:53 -0400
Message-ID: <542990.1663628813@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+hUKGJ3ib9tmBfYka1+_=UY55oMYCpKF_ZSQPf6i5B4ph6xng@mail.gmail.com>
References: <514615.1663615243@sss.pgh.pa.us>
	<CA+hUKGJ3ib9tmBfYka1+_=UY55oMYCpKF_ZSQPf6i5B4ph6xng@mail.gmail.com>

Thomas Munro <thomas.munro@gmail.com> writes:
> On Tue, Sep 20, 2022 at 7:20 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> * xlog.c's AdvanceXLInsertBuffer has a local variable "npages"
>> that is only read in the "#ifdef WAL_DEBUG" stanza at the
>> bottom.  Here I've done the rather ugly and brute-force thing
>> of wrapping all the variable's references in "#ifdef WAL_DEBUG".
>> (I tried marking it PG_USED_FOR_ASSERTS_ONLY, but oddly that
>> did not silence the warning.)  I kind of wonder how useful this
>> function's WAL_DEBUG output is --- maybe just dropping that
>> altogether would be better?

> No opinion on the value of the message, but maybe
> pg_attribute_unused() would be better?

I realized that the reason PG_USED_FOR_ASSERTS_ONLY didn't help
is that it expands to empty in an assert-enabled build, which is
what I was testing.  So yeah, using pg_attribute_unused() directly
would probably work better.

(Also, I tried an assert-disabled build and found one additional new
warning; same deal where clang doesn't believe "foo++;" is reason to
consider foo to be used.  That one, PG_USED_FOR_ASSERTS_ONLY can fix.)

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <542990.1663628813@sss.pgh.pa.us>
Permalink:  ../542990.1663628813@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/542990.1663628813@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, thomas.munro@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Silencing the remaining clang 15 warnings
  In-Reply-To: <542990.1663628813@sss.pgh.pa.us>

* 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