Re: elog/ereport noreturn decoration

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: elog/ereport noreturn decoration
Дата
Msg-id CA+TgmobeQyoKCrDmowxc35P01KABunAznq_FRTWoROPT5k14gA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: elog/ereport noreturn decoration  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: elog/ereport noreturn decoration  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, Jul 14, 2012 at 6:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> A small sidetrack here.  I've managed to set up the Solaris Studio
>> compiler on Linux and tried this out.  It turns out these "statement not
>> reached" warnings have nothing to do with knowledge about library
>> functions such as abort() or exit() not returning.  The warnings come
>> mostly from loops that never end (except by returning from the function)
>> and some other more silly cases where the supposed fallback return
>> statement is clearly unnecessary.  I think these should be fixed,
>> because the code is wrong and could mask real errors if someone ever
>> wanted to rearrange those loops or something.
>
>> Patch attached.  I tried this out with old and new versions of gcc,
>> clang, and the Solaris compiler, and everyone was happy about.  I didn't
>> touch the regex code.  And there's some archeological knowledge about
>> Perl in there.
>
> Hm.  I seem to recall that at least some of these lines were themselves
> put in to suppress compiler warnings.  So we may just be moving the
> warnings from one set of non-mainstream compilers to another set.
> Still, we might as well try it and see if there's a net reduction.
> (In some places we might need to tweak the code a bit harder than this,
> to make it clearer that the unreachable spot is unreachable.)

You mean things like this?

-
-    /* keep compiler happy */
-    return NULL;

I admit that compiler warnings are horribly annoying and we probably
ought to favor new compilers over old ones, at least in master, but
I'm kinda skeptical about the contention that no compiler anywhere
will complain if we remove hunks like that one.  The comment seems
pretty clear.  I feel like we're missing something here.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Предыдущее
От: Gurjeet Singh
Дата:
Сообщение: Re: Getting rid of pre-assignment of index names in CREATE TABLE LIKE
Следующее
От: Kohei KaiGai
Дата:
Сообщение: Re: pgsql_fdw in contrib