New compiler warning from btree dedup code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: New compiler warning from btree dedup code
Date: 2022-04-06 19:59:13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I just noticed that if I build without asserts on my Mac laptop
(using Apple's latest clang, 13.1.6) I get

nbtdedup.c:68:8: warning: variable 'pagesaving' set but not used [-Wunused-but-set-variable]
Size pagesaving = 0;
1 warning generated.

Apparently, late-model clang can figure out that the variable
is incremented but not otherwise used. This is enough to
shut it up, but I wonder if you have another preference:

- Size pagesaving = 0;
+ Size pagesaving PG_USED_FOR_ASSERTS_ONLY = 0;

regards, tom lane


Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2022-04-06 20:14:04 Re: New compiler warning from btree dedup code
Previous Message Nathan Bossart 2022-04-06 19:40:39 Re: Postgres restart in the middle of exclusive backup and the presence of backup_label file