Peter Eisentraut <peter@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. So maybe the compiler
has had this warning for longer. I don't see it with gcc 13.3 though,
which is the newest I have handy.
> 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.
regards, tom lane