]> granicus.if.org Git - postgresql/commit
Improve unreachability recognition in elog() macro.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 10 Sep 2016 21:54:23 +0000 (17:54 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 10 Sep 2016 21:54:23 +0000 (17:54 -0400)
commit0db3c5552a16c0e73e0c24a36a3bacc77820bf02
tree3e94c67418ef1c3435a5cdf8f253feef9b85a267
parentdfe7121dfbeec0eb13b09b04eaf9c6ca1d1f21be
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.
src/include/utils/elog.h