Re: patch: Use pg_assume in jsonb_util.c to fix GCC 15 warnings

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: patch: Use pg_assume in jsonb_util.c to fix GCC 15 warnings
Дата
Msg-id CAH2-WzkXwnY=cNGDODOyW=AhT4H8Rj7MiOk3mcN=Ua2w8C=RZg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: patch: Use pg_assume in jsonb_util.c to fix GCC 15 warnings  (Andres Freund <andres@anarazel.de>)
Ответы Re: patch: Use pg_assume in jsonb_util.c to fix GCC 15 warnings
Re: patch: Use pg_assume in jsonb_util.c to fix GCC 15 warnings
Список pgsql-hackers
On Sat, Jul 12, 2025 at 1:55 PM Andres Freund <andres@anarazel.de> wrote:
> I had played with using pg_assume here too, but I couldn't really convince
> myself that it's a good idea...

In the past, it was often necessary to work around MSVC's inability to
see that a block containing elog(ERROR) doesn't actually need to
initialize variables that'll never actually be used in code that comes
after that block. We still have many "keep compiler quiet" variable
initializations due to this.

Is that still something that we need to worry about? I don't recall
running into it in quite a few years, though that might just be a
coincidence.

It looks like MSVC uses __assume for this now, by way of
elog/ereport's use of pg_unreachable. You also used __assume to
implement pg_assume for MSVC. It seems reasonable to surmise that we
can officially stop worrying about elog(ERROR) related warnings/to
suppose that we no longer have to add "keep compiler quiet" variable
initializations after an elog(ERROR). If it works for MSVC +
pg_assume, then it ought to also work for MSVC + pg_unreachable.
Right?

--
Peter Geoghegan



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