pgsql: Silence compiler warnings

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Silence compiler warnings
Date: 2016-12-07 04:02:44
Message-ID: E1cETRM-00036u-F2@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Silence compiler warnings

Rearrange a bit of code to ensure that 'mode' in LWLockRelease is
obviously always set, which seems a bit cleaner and avoids a compiler
warning (thanks to Robert for the suggestion!).

In GetCachedPlan(), initialize 'plan' to silence a compiler warning, but
also add an Assert() to make sure we don't ever actually fall through
with 'plan' still being set to NULL, since we are about to dereference
it.

Neither of these appear to be live bugs but at least gcc
5.4.0-6ubuntu1~16.04.4 doesn't quite have the smarts to realize that.

Discussion: https://www.postgresql.org/message-id/20161129152102.GR13284%40tamriel.snowman.net

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d97b14ddab2059e1d73c0cd17f26bac4ef13e682

Modified Files
--------------
src/backend/storage/lmgr/lwlock.c | 9 ++++-----
src/backend/utils/cache/plancache.c | 4 +++-
2 files changed, 7 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2016-12-07 06:41:24 pgsql: Fix whitespace.
Previous Message Tom Lane 2016-12-07 00:52:53 pgsql: Fix unsafe assumption that struct timeval.tv_sec is a "long".