Обсуждение: recent compiler warnings

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

recent compiler warnings

От
Jeff Janes
Дата:
Sorry for starting a new thread, I can't find the correct one to reply to.

Using: gcc version 4.8.3 20140627 [gcc-4_8-branch revision 212064] (SUSE Linux)

commit ed0097e4f9e6b1 has introduced two compiler warnings:

gistutil.c: In function 'gistproperty':
gistutil.c:855:16: warning: variable 'rd_index' set but not used
[-Wunused-but-set-variable] Form_pg_index rd_index;               ^
amutils.c: In function 'test_indoption':
amutils.c:118:16: warning: variable 'rd_index' set but not used
[-Wunused-but-set-variable] Form_pg_index rd_index;               ^

commit ed0097e4f9e6b1227935e01fa67f12a238b66064
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   Sat Aug 13 18:31:14 2016 -0400
   Add SQL-accessible functions for inspecting index AM properties.


I don't know if this compiler is a too clever by half, or not clever enough.

Cheers,

Jeff



Re: recent compiler warnings

От
Andres Freund
Дата:
On 2016-08-23 19:54:39 -0700, Jeff Janes wrote:
> Sorry for starting a new thread, I can't find the correct one to reply to.
> 
> Using: gcc version 4.8.3 20140627 [gcc-4_8-branch revision 212064] (SUSE Linux)
> 
> commit ed0097e4f9e6b1 has introduced two compiler warnings:
> 
> gistutil.c: In function 'gistproperty':
> gistutil.c:855:16: warning: variable 'rd_index' set but not used
> [-Wunused-but-set-variable]
>   Form_pg_index rd_index;
>                 ^
> amutils.c: In function 'test_indoption':
> amutils.c:118:16: warning: variable 'rd_index' set but not used
> [-Wunused-but-set-variable]
>   Form_pg_index rd_index;
>                 ^
> 
> commit ed0097e4f9e6b1227935e01fa67f12a238b66064
> Author: Tom Lane <tgl@sss.pgh.pa.us>
> Date:   Sat Aug 13 18:31:14 2016 -0400
> 
>     Add SQL-accessible functions for inspecting index AM properties.
> 
> 
> I don't know if this compiler is a too clever by half, or not clever enough.

That's probably when compiling without assertions, right? rd_index is
only read from within Assert()'s.... Probably needs a
PG_USED_FOR_ASSERTS_ONLY slapped on.



Re: recent compiler warnings

От
Tom Lane
Дата:
Andres Freund <andres@anarazel.de> writes:
> On 2016-08-23 19:54:39 -0700, Jeff Janes wrote:
>> commit ed0097e4f9e6b1 has introduced two compiler warnings:

> That's probably when compiling without assertions, right? rd_index is
> only read from within Assert()'s.... Probably needs a
> PG_USED_FOR_ASSERTS_ONLY slapped on.

Yeah, looks like that to me too.  I'm on it.
        regards, tom lane