pgsql: Improve unreachability recognition in elog() macro.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve unreachability recognition in elog() macro.
Date: 2016-09-10 21:54:44
Message-ID: E1biqEW-0002ZT-Lg@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve unreachability recognition in elog() macro.

Some experimentation with an older version of gcc showed that it is able
to determine whether "if (elevel_ >= ERROR)" is compile-time constant
if elevel_ is declared "const", but otherwise not so much. We had
accounted for that in ereport() but were too miserly with braces to
make it so in elog(). I don't know how many currently-interesting
compilers have the same quirk, but in case it will save some code
space, let's make sure that elog() is on the same footing as ereport()
for this purpose.

Back-patch to 9.3 where we introduced pg_unreachable() calls into
elog/ereport.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/43ef6abcbb6010593a000a0d42303f138b9f5b4c

Modified Files
--------------
src/include/utils/elog.h | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2016-09-11 13:28:01 pgsql: Implement binary heap replace-top operation in a smarter way.
Previous Message Tom Lane 2016-09-10 20:21:50 Re: Re: [COMMITTERS] pgsql: Use LEFT JOINs in some system views in case referenced row doesn