Re: Re: [PATCH 1/5] Centralize Assert* macros into c.h so its common between backend/frontend

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: [PATCH 1/5] Centralize Assert* macros into c.h so its common between backend/frontend
Дата
Msg-id 7496.1358523196@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Re: [PATCH 1/5] Centralize Assert* macros into c.h so its common between backend/frontend  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: Re: [PATCH 1/5] Centralize Assert* macros into c.h so its common between backend/frontend  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Here's a different idea: move all the Assert() and StaticAssert() etc
> definitions from c.h and postgres.h into a new header, say pgassert.h.
> That header is included directly by postgres.h (just like palloc.h and
> elog.h already are) so we don't have to touch the backend code at all.
> Frontend programs that want that functionality can just #include
> "pgassert.h" by themselves.  The definitions are (obviously) protected
> by #ifdef FRONTEND so that it all works in both environments cleanly.

That might work.  Files using c.h would have to include this too, but
as described it should work in either environment for them.  The other
corner case is pg_controldata.c and other frontend programs that include
postgres.h --- but it looks like they #define FRONTEND first, so they'd
get the correct set of Assert definitions.

Whether it's really any better than just sticking them in c.h isn't
clear.

Really I'd prefer not to move the backend definitions out of postgres.h
at all, just because doing so will lose fifteen years of git history
about those particular lines (or at least make it a lot harder to
locate with git blame).
        regards, tom lane



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Re: [PATCH 1/5] Centralize Assert* macros into c.h so its common between backend/frontend
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Re: [PATCH 1/5] Centralize Assert* macros into c.h so its common between backend/frontend