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

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH 1/5] Centralize Assert* macros into c.h so its common between backend/frontend
Date: 2013-01-18 16:17:13
Message-ID: 20130118161713.GH29501@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-01-18 11:11:50 -0500, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2013-01-18 10:33:16 -0500, Tom Lane wrote:
> >> 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).
>
> > The alternative seems to be sprinkling a few more #ifdef FRONTEND's in
> > postgres.h, if thats preferred I can prepare a patch for that although I
> > prefer my proposal.
>
> Yeah, surrounding the existing definitions with #ifndef FRONTEND was
> what I was imagining. But on reflection that seems pretty darn ugly,
> especially if the corresponding FRONTEND definitions are far away.
> Maybe we should just live with the git history disconnect.

FWIW, git blame -M -C, while noticeably more expensive, seems to be able to
connect the history:

d08741ea src/include/postgres.h (Tom Lane 2001-02-10 02:31:31 +0000 746)
d08741ea src/include/postgres.h (Tom Lane 2001-02-10 02:31:31 +0000 747) #define Assert(condition) \
c5354dff src/include/postgres.h (Bruce Momjian 2002-08-10 20:29:18 +0000 748) Trap(!(condition), "FailedAssertion")
d08741ea src/include/postgres.h (Tom Lane 2001-02-10 02:31:31 +0000 749)
d08741ea src/include/postgres.h (Tom Lane 2001-02-10 02:31:31 +0000 750) #define AssertMacro(condition) \
c5354dff src/include/postgres.h (Bruce Momjian 2002-08-10 20:29:18 +0000 751) ((void) TrapMacro(!(condition), "FailedAssertion"))
d08741ea src/include/postgres.h (Tom Lane 2001-02-10 02:31:31 +0000 752)
d08741ea src/include/postgres.h (Tom Lane 2001-02-10 02:31:31 +0000 753) #define AssertArg(condition) \
c5354dff src/include/postgres.h (Bruce Momjian 2002-08-10 20:29:18 +0000 754) Trap(!(condition), "BadArgument")
d08741ea src/include/postgres.h (Tom Lane 2001-02-10 02:31:31 +0000 755)
d08741ea src/include/postgres.h (Tom Lane 2001-02-10 02:31:31 +0000 756) #define AssertState(condition) \
c5354dff src/include/postgres.h (Bruce Momjian 2002-08-10 20:29:18 +0000 757) Trap(!(condition), "BadState")
8118de2b src/include/c.h (Andres Freund 2012-12-18 00:58:36 +0100 758)

Andres

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-01-18 16:26:00 Re: HS locking broken in HEAD
Previous Message Tom Lane 2013-01-18 16:16:15 Re: HS locking broken in HEAD