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

Andres Freund <andres@2ndquadrant.com>

From: Andres Freund <andres@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2013-01-18T16:17:13Z
Lists: pgsql-hackers
On 2013-01-18 11:11:50 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.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


Commits

  1. Prevent creation of postmaster's TCP socket during pg_upgrade testing.