Re: new clang warnings about unused global variables
Re: new clang warnings about unused global variables
От:
Andreas Karlsson <andreas@proxel.se>
Дата:
On 9/3/26 15:01, Peter Eisentraut wrote: > On 28.08.26 23:33, Peter Eisentraut wrote: >> The new clang 23 has a new warning apparently enabled by default (at >> least by default in a PostgreSQL build) about set-but-unused static >> global variables: -Wunused-but-set-global. This triggers a few >> warnings in PostgreSQL code. See attached patches. The first four of >> these are genuine hits; these variables were never read from or the >> last reading use was removed some time ago. The last one in pg_ctl is >> about options that can be set from the command line on any platform >> but are only used on Windows. This seems kind of weird behavior; >> maybe in the future we should make those options error out on non- >> Windows, and then the variables wouldn't be uselessly set. The rest look good but ot sure I like the last patch. Wouldn't we want to get an error on unused on Windows builds? The patch would hide if we stop using one of them on Windows. > I sense that nobody is going to have issues with this. Any objections > to backpatching this? I suspect that over time many more people are > going to run into this, so keeping the backbranches warning-free seems > sensible. Yeah, as the changes are simple and only touch unused static globals I do not see any risk with backporting. -- Andreas Karlsson Percona