Re: Silencing the remaining clang 15 warnings

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Silencing the remaining clang 15 warnings
Дата
Msg-id 542990.1663628813@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Silencing the remaining clang 15 warnings  (Thomas Munro <thomas.munro@gmail.com>)
Ответы Re: Silencing the remaining clang 15 warnings  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: Silencing the remaining clang 15 warnings
Следующее
От: Michel Pelletier
Дата:
Сообщение: Proposal to use JSON for Postgres Parser format