From: Stephen Frost <sfrost@snowman.net>
To: pgsql-hackers@postgresql.org
Subject: Compiler warnings
Date: Tue, 29 Nov 2016 10:21:02 -0500
Message-ID: <20161129152102.GR13284@tamriel.snowman.net> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Greetings,
Not sure if anyone else has been seeing these, but I'm getting a bit
tired of them. Neither is a live bug, but they also seem pretty simple
to fix. The attached patch makes both of these warnings go away. At
least for my common build, these are the only warnings that are thrown.
I'm building with:
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
.../src/backend/storage/lmgr/lwlock.c: In function ‘LWLockRelease’:
.../src/backend/storage/lmgr/lwlock.c:1802:5: warning: ‘mode’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (mode == LW_EXCLUSIVE)
^
.../src/backend/utils/cache/plancache.c: In function ‘GetCachedPlan’:
.../src/backend/utils/cache/plancache.c:1232:9: warning: ‘plan’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return plan;
^
Thoughts?
Thanks!
Stephen
Attachments:
[text/x-diff] silence-warnings.patch (1.1K, ../20161129152102.GR13284@tamriel.snowman.net/2-silence-warnings.patch)
download | inline diff:diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.cnew file mode 100644index 9c6862f..909ff45
*** a/src/backend/storage/lmgr/lwlock.c
--- b/src/backend/storage/lmgr/lwlock.c
*************** LWLockUpdateVar(LWLock *lock, uint64 *va
*** 1770,1776 ****
void
LWLockRelease(LWLock *lock)
{
! LWLockMode mode;
uint32 oldstate;
bool check_waiters;
int i;
--- 1770,1776 ----
void
LWLockRelease(LWLock *lock)
{
! LWLockMode mode = LW_EXCLUSIVE;
uint32 oldstate;
bool check_waiters;
int i;
diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.cnew file mode 100644index 884cdab..b5d97c8
*** a/src/backend/utils/cache/plancache.c
--- b/src/backend/utils/cache/plancache.c
*************** GetCachedPlan(CachedPlanSource *plansour
*** 1196,1204 ****
*/
qlist = NIL;
}
! }
!
! if (customplan)
{
/* Build a custom plan */
plan = BuildCachedPlan(plansource, qlist, boundParams);
--- 1196,1203 ----
*/
qlist = NIL;
}
! }
! else
{
/* Build a custom plan */
plan = BuildCachedPlan(plansource, qlist, boundParams);
[application/pgp-signature] signature.asc (818B, ../20161129152102.GR13284@tamriel.snowman.net/3-signature.asc)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: sfrost@snowman.net
Subject: Re: Compiler warnings
In-Reply-To: <20161129152102.GR13284@tamriel.snowman.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox