Re: New compiler warnings in buildfarm - Mailing list pgsql-hackers

From Tom Lane
Subject Re: New compiler warnings in buildfarm
Date
Msg-id 3376004.1722435067@sss.pgh.pa.us
Whole thread Raw
In response to Re: New compiler warnings in buildfarm  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: New compiler warnings in buildfarm
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: "Euler Taveira"
Date:
Subject: Re: make pg_createsubscriber option names more consistent
Next
From: Jim Vanns
Date:
Subject: Suggestions to overcome 'multixact "members" limit exceeded' in temporary tables