Обсуждение: Compiling warnings on old GCC

Поиск
Список
Период
Сортировка

Compiling warnings on old GCC

От
Richard Guo
Дата:
I came across the following compiling warnings on GCC (Red Hat 4.8.5-44)
4.8.5 with 'CFLAGS=-Og'

be-fsstubs.c: In function ‘be_lo_export’:
be-fsstubs.c:537:24: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (CloseTransientFile(fd) != 0)
                        ^
In file included from trigger.c:14:0:
trigger.c: In function ‘ExecCallTriggerFunc’:
../../../src/include/postgres.h:314:2: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return (Pointer) X;
  ^
trigger.c:2316:9: note: ‘result’ was declared here
  Datum  result;
         ^

I wonder if this is worth fixing, maybe by a trivial patch like
attached.

Thanks
Richard
Вложения

Re: Compiling warnings on old GCC

От
David Rowley
Дата:
On Mon, 6 Nov 2023 at 19:14, Richard Guo <guofenglinux@gmail.com> wrote:
> I came across the following compiling warnings on GCC (Red Hat 4.8.5-44)
> 4.8.5 with 'CFLAGS=-Og'

> I wonder if this is worth fixing, maybe by a trivial patch like
> attached.

There's some relevant discussion in
https://postgr.es/m/flat/20220602024243.GJ29853%40telsasoft.com

David



Re: Compiling warnings on old GCC

От
Richard Guo
Дата:

On Mon, Nov 6, 2023 at 2:51 PM David Rowley <dgrowleyml@gmail.com> wrote:
On Mon, 6 Nov 2023 at 19:14, Richard Guo <guofenglinux@gmail.com> wrote:
> I came across the following compiling warnings on GCC (Red Hat 4.8.5-44)
> 4.8.5 with 'CFLAGS=-Og'

> I wonder if this is worth fixing, maybe by a trivial patch like
> attached.

There's some relevant discussion in
https://postgr.es/m/flat/20220602024243.GJ29853%40telsasoft.com

Ah, thanks for pointing that out.  Somehow I failed to follow that
thread.

It seems that the controversial '-Og' coupled with the old GCC version
(4.8) makes it not worth fixing.  So please ignore this thread.

Thanks
Richard

Re: Compiling warnings on old GCC

От
Tom Lane
Дата:
Richard Guo <guofenglinux@gmail.com> writes:
> On Mon, Nov 6, 2023 at 2:51 PM David Rowley <dgrowleyml@gmail.com> wrote:
>> There's some relevant discussion in
>> https://postgr.es/m/flat/20220602024243.GJ29853%40telsasoft.com

> It seems that the controversial '-Og' coupled with the old GCC version
> (4.8) makes it not worth fixing.  So please ignore this thread.

Although nobody tried to enunciate a formal policy in the other thread,
I think where we ended up is that we'd consider suppressing warnings
seen with -Og, but only with reasonably-modern compiler versions.
For LTS compilers we are only going to care about warnings seen with
production flags (i.e., -O2 or better).

            regards, tom lane