From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: New string-truncation warnings from GCC 15 |
Date: | 2025-09-17 23:03:05 |
Message-ID: | clutvse7itrftsji27ndmt6zvnp5j6kbpskuq72qahd45mshuo@b4ens2gojro3 |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2025-09-17 17:26:50 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)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 is too long, array size is 512 but initializer has size 513 (including the null terminating character); did you mean to use the '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
From | Date | Subject | |
---|---|---|---|
Next Message | Masahiko Sawada | 2025-09-17 23:18:31 | Re: Parallel heap vacuum |
Previous Message | Michael Paquier | 2025-09-17 22:50:06 | Re: Incorrect logic in XLogNeedsFlush() |