Re: new compiler warnings

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: new compiler warnings
Дата
Msg-id 1318940664.8007.3.camel@fsopti579.F-Secure.com
обсуждение исходный текст
Ответ на new compiler warnings  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: new compiler warnings
Список pgsql-hackers
On tis, 2011-10-18 at 01:00 -0700, Jeff Davis wrote:
> I'm not sure if these can/should be fixed or not, but here are the
> compiler warnings I'm getting on gcc and clang on ubuntu 11.10 with -O2.
> The gcc ones are mostly new.

They are expected with gcc 4.6.  There isn't anything we can do about
them.

The clang warnings are also expected.  I understand the next clang
version will address them.

> 
> ==================== GCC ========================
> 
> $ gcc --version
> gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
> Copyright (C) 2011 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is
> NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
> 
> warnings generated:
> 
> execQual.c: In function ‘GetAttributeByNum’:
> execQual.c:1112:11: warning: the comparison will always evaluate as
> ‘true’ for the address of ‘tmptup’ will never be NULL [-Waddress]
> execQual.c: In function ‘GetAttributeByName’:
> execQual.c:1173:11: warning: the comparison will always evaluate as
> ‘true’ for the address of ‘tmptup’ will never be NULL [-Waddress]
> execQual.c: In function ‘ExecEvalFieldSelect’:
> execQual.c:3922:11: warning: the comparison will always evaluate as
> ‘true’ for the address of ‘tmptup’ will never be NULL [-Waddress]
> In file included from gram.y:12962:0:
> scan.c: In function ‘yy_try_NUL_trans’:
> scan.c:16257:23: warning: unused variable ‘yyg’ [-Wunused-variable]
> elog.c: In function ‘write_pipe_chunks’:
> elog.c:2479:8: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result [-Wunused-result]
> elog.c:2488:7: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result [-Wunused-result]
> elog.c: In function ‘write_console’:
> elog.c:1797:7: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result [-Wunused-result]
> tuplesort.c: In function ‘comparetup_heap’:
> tuplesort.c:2751:12: warning: the comparison will always evaluate as
> ‘true’ for the address of ‘ltup’ will never be NULL [-Waddress]
> tuplesort.c:2752:12: warning: the comparison will always evaluate as
> ‘true’ for the address of ‘rtup’ will never be NULL [-Waddress]
> tuplesort.c: In function ‘copytup_heap’:
> tuplesort.c:2783:17: warning: the comparison will always evaluate as
> ‘true’ for the address of ‘htup’ will never be NULL [-Waddress]
> tuplesort.c: In function ‘readtup_heap’:
> tuplesort.c:2835:17: warning: the comparison will always evaluate as
> ‘true’ for the address of ‘htup’ will never be NULL [-Waddress]
> fe-connect.c: In function ‘PQconndefaults’:
> fe-connect.c:832:6: warning: the comparison will always evaluate as
> ‘false’ for the address of ‘errorBuf’ will never be NULL [-Waddress]
> fe-connect.c: In function ‘PQconninfoParse’:
> fe-connect.c:3970:6: warning: the comparison will always evaluate as
> ‘false’ for the address of ‘errorBuf’ will never be NULL [-Waddress]
> common.c: In function ‘handle_sigint’:
> common.c:247:4: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result [-Wunused-result]
> common.c:250:4: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result [-Wunused-result]
> common.c:251:4: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result [-Wunused-result]
> In file included from mainloop.c:425:0:
> psqlscan.l: In function ‘evaluate_backtick’:
> psqlscan.l:1677:6: warning: the comparison will always evaluate as
> ‘false’ for the address of ‘cmd_output’ will never be NULL [-Waddress]
> 
> ==================== CLANG ========================
> 
> $ clang --version
> clang version 2.9 (tags/RELEASE_29/final)
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> 
> A lot of warnings of the form:
> 
> ruleutils.c:698:11: warning: array index of '1' indexes past the end of
> an array (that contains 1 elements) [-Warray-bounds]
>                 value = fastgetattr(ht_trig, Anum_pg_trigger_tgargs,
>                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ruleutils.c:23:
> In file included from ../../../../src/include/catalog/indexing.h:18:
> ../../../../src/include/access/htup.h:808:3: note: instantiated from:
>                 att_isnull((attnum)-1, (tup)->t_data->t_bits) ?
> \
>                 ^
> In file included from ruleutils.c:23:
> In file included from ../../../../src/include/catalog/indexing.h:18:
> In file included from ../../../../src/include/access/htup.h:18:
> ../../../../src/include/access/tupmacs.h:21:34: note: instantiated from:
> #define att_isnull(ATT, BITS) (!((BITS)[(ATT) >> 3] & (1 << ((ATT) &
> 0x07))))
>                                  ^      ~~~~~~~~~~
> In file included from ruleutils.c:23:
> In file included from ../../../../src/include/catalog/indexing.h:18:
> ../../../../src/include/access/htup.h:153:9: note: array 't_bits'
> declared here
>         bits8           t_bits[1];              /* bitmap of NULLs --
> VARIABLE LENGTH */
> 
> ======================================================
> 
> Regards,
>     Jeff Davis
> 
> 





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: (patch) regression diffs on collate.linux.utf8 test
Следующее
От: Robert Haas
Дата:
Сообщение: Re: spinlocks on HP-UX