Re: [PATCH] unified frontend support for pg_malloc et al and palloc/pfree mulation (was xlogreader-v4)

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@2ndquadrant.com>
Cc: Heikki Linnakangas <hlinnakangas@vmware.com>, Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Date: 2013-01-12T23:15:17Z
Lists: pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-01-12 13:16:56 -0500, Tom Lane wrote:
>> However, using a do-block with a local variable is definitely something
>> worth considering.  I'm getting less enamored of the __builtin_constant_p
>> idea after finding out that the gcc boys seem to have curious ideas
>> about what its semantics ought to be:
>> https://bugzilla.redhat.com/show_bug.cgi?id=894515

> I wonder whether __builtin_choose_expr is any better?

Right offhand I don't see how that helps us.  AFAICS,
__builtin_choose_expr is the same as x?y:z except that y and z are not
required to have the same datatype, which is okay because they require
the value of x to be determinable at compile time.  So we couldn't just
write __builtin_choose_expr((elevel) >= ERROR, ...).  That would fail
if elevel wasn't compile-time-constant.  We could conceivably do

__builtin_choose_expr(__builtin_constant_p(elevel) && (elevel) >= ERROR, ...)

with the idea of making real sure that that expression reduces to a
compile time constant ... but stacking two nonstandard constructs on
each other seems to me to probably increase our exposure to gcc's
definitional randomness rather than reduce it.  I mean, if
__builtin_constant_p can't already be trusted to act like a constant,
why should we trust that __builtin_choose_expr doesn't also have a
curious definition of constant-ness?

			regards, tom lane


Commits

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