Hi,

On 2024-07-31 10:11:07 -0400, Tom Lane wrote:
> Peter Eisentraut <pe...@eisentraut.org> writes:
> > On 30.07.24 18:19, Tom Lane wrote:
> >> Sometime in the last month or so, flaviventris's bleeding-edge
> >> version of gcc has started whining[1] about truncation of a
> >> string literal's implicit trailing '\0' in contexts like this:
> >> ../pgsql/src/backend/commands/copyto.c:106:41: warning:
> >> initializer-string for array of 'char' is too long
> >> [-Wunterminated-string-initialization]
> >> 106 | static const char BinarySignature[11] = "PGCOPY\n\377\r\n\0";
> >> |                                         ^~~~~~~~~~~~~~~~~~~~
>
> > According to the gcc documentation, this warning is part of -Wextra.
> > And indeed flaviventris runs with -Wextra:
>
> > 'CFLAGS' => '-O1 -ggdb -g3 -fno-omit-frame-pointer -Wall -Wextra
> > -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers
> > -O0',
>
> Ah --- and it was not doing that a month ago.

Hm? I've not touched flaviventris config since at least the 26th of March. And
a buildfarm run from before then also shows -Wextra:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=flaviventris&dt=2024-03-17%2011%3A17%3A01


> So maybe the compiler has had this warning for longer.

It's very new:

commit 44c9403ed1833ae71a59e84f9e37af3182be0df5
Author:     Alejandro Colomar <a...@kernel.org>
AuthorDate: 2024-06-29 15:10:43 +0200
Commit:     Martin Uecker <uec...@gcc.gnu.org>
CommitDate: 2024-07-14 11:41:00 +0200

    c, objc: Add -Wunterminated-string-initialization


It might be worth piping up in the gcc bugtracker and suggesting that the
warning isn't issued when there's an explicit \0?


> > So I think the appropriate fix here for now is to add
> > -Wno-unterminated-string-initialization to this buildfarm configuration.
>
> Agreed; our policy so far has been to treat -Wextra warnings with
> suspicion, and there is not anything really wrong with these bits
> of code.
>
> It looks like serinus needs this fix too.

Added to both.  I've forced runs for both animals, so the bf should show
results of that soon.

Greetings,

Andres Freund


Reply via email to