Re: [HACKERS] Warnings in objectaddress.c

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Warnings in objectaddress.c
Дата
Msg-id 2317.1507081287@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Warnings in objectaddress.c  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [HACKERS] Warnings in objectaddress.c  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Perhaps we should apply some glorified version of this:

> +    if (list_length(object) < 2)
> +        elog(ERROR, "fail");

> However, I'm not 100% sure that would be sufficient to suppress these
> warnings, because the compiler has got to be smart enough to know that
> elog() doesn't return and that i >= 2 is sufficient to guarantee that
> everything is initialized.

I'm betting it wouldn't help.  I was considering something along the line
of unrolling the loop:
Assert(list_length(object) == 2);
assign typenames[0] and typeoids[0] from linitial(object)
assign typenames[1] and typeoids[1] from lsecond(object)

This would involve duplicating the loop body, but that's only 3 lines,
so I think it wouldn't even net out as more code.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] 64-bit queryId?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Re: protocol version negotiation (Re: Libpq PGRES_COPY_BOTH - version compatibility)