Re: Re: [COMMITTERS] pgsql: Fix blatantly uninitialized variable in recent commit.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: [COMMITTERS] pgsql: Fix blatantly uninitialized variable in recent commit.
Дата
Msg-id 8847.1297959995@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Re: [COMMITTERS] pgsql: Fix blatantly uninitialized variable in recent commit.  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: Re: [COMMITTERS] pgsql: Fix blatantly uninitialized variable in recent commit.  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Re: Re: [COMMITTERS] pgsql: Fix blatantly uninitialized variable in recent commit.  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> It might be worth trying to clean up those warn_unused_result
>> things, if other people are seeing those.

> elog.c: In function *write_console*:
> elog.c:1708: warning: ignoring return value of *write*, declared
> with attribute warn_unused_result
> elog.c: In function *write_pipe_chunks*:
> elog.c:2401: warning: ignoring return value of *write*, declared
> with attribute warn_unused_result
> elog.c:2410: warning: ignoring return value of *write*, declared
> with attribute warn_unused_result
> --
> common.c: In function *handle_sigint*:
> common.c:247: warning: ignoring return value of *write*, declared
> with attribute warn_unused_result
> common.c:250: warning: ignoring return value of *write*, declared
> with attribute warn_unused_result
> common.c:251: warning: ignoring return value of *write*, declared
> with attribute warn_unused_result

In at least some of these cases, I think ignoring the write() result
is intentional, because there's really nothing useful we can do about
it if it fails (oh, you wish we'd log a failure to write to the log?).
Would you check whether just casting the function result to (void)
shuts it up?

> option.c: In function *parseCommandLine*:
> option.c:92: warning: ignoring return value of *getcwd*, declared
> with attribute warn_unused_result
> option.c: In function *get_pkglibdir*:
> option.c:336: warning: ignoring return value of *fgets*, declared
> with attribute warn_unused_result

These look like they probably are genuine bugs, or if not bugs at least
the kind of sloppy coding the warning is meant to catch.
        regards, tom lane


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Debian readline/libedit breakage
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Debian readline/libedit breakage