Hi,
On 2025-09-17 17:26:50 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2025-09-17 17:00:42 -0400, Tom Lane wrote:
> >> Well, we should either commit to it (and put -Wextra into our
> >> standard switches) or not.
>
> > I'd be mildly worried about -Wextra in older compilers (and clang, but just
> > because I don't regularly track -Wextra with clang). But I'd be up for trying
> > it out.
>
> Yeah, I was imagining a trial in master only to see how noisy the
> buildfarm gets ... we can either back it out or work at cleaning
> up the warnings, depending on what we see.
It turns out -Wextra works for me because I use some extra option to disable
stupid parts of -Wextra. I forgot about that because it's just part of my
scripts / my shared buildfarm animal configuration.
gcc-14 with
-Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-clobbered -Wno-missing-field-initializers
gcc-15 with
-Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-clobbered -Wno-missing-field-initializers
-Wno-unterminated-string-initialization
clang-19 with
-Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers
clang-21 with
-Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers
-Wno-unterminated-string-initialization
compile without warnings.
Note that clang-21 (or 20) also got support for nonstring:
../../home/andres/src/postgresql/src/backend/utils/adt/encode.c:152:1: warning: initializer-string for character array
istoo long, array size is 512 but initializer has size 513 (including the null terminating character); did you mean to
usethe 'nonstring' attribute? [-Wunterminated-string-initialization]
I guess due to the extra disabling arguments I feel less sure about adding
-Wextra to the default arguments. OTOH, the set of arguments to disable has
stayed fairly stable over the last few years (until
-Wno-unterminated-string-initialization).
Greetings,
Andres Freund