On Sat, Nov 8, 2014 at 8:56 AM, Alvaro Herrera <alvhe...@2ndquadrant.com>
wrote:

>
> I just pushed this, after some more minor tweaks.  Thanks, and please do
> continue testing!
>
>
Here's another small fix for some unused variable warnings. Unfortunately
this Microsoft compiler that I'm using does not know about
__attribute__((unused)), so some warnings are generated for these:

BrinTuple  *tmptup PG_USED_FOR_ASSERTS_ONLY;
BrinMemTuple *tmpdtup PG_USED_FOR_ASSERTS_ONLY;
Size tmpsiz PG_USED_FOR_ASSERTS_ONLY;

The attached patch moves these into within the #ifdef USE_ASSERT_CHECKING
section.

I know someone will ask so, let me explain: The reason I don't see a bunch
of other warnings for PG_USED_FOR_ASSERTS_ONLY vars when compiling without
assert checks, is that this Microsoft compiler seems to be ok with
variables being assigned values and the values never being used, but if the
variable is never assigned a value, then it'll warn you of that.

Regards

David Rowley
diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c
index ae65549..7042f67 100644
--- a/src/backend/access/brin/brin.c
+++ b/src/backend/access/brin/brin.c
@@ -107,9 +107,6 @@ brininsert(PG_FUNCTION_ARGS)
                BrinMemTuple *dtup;
                BlockNumber heapBlk;
                int                     keyno;
-               BrinTuple  *tmptup PG_USED_FOR_ASSERTS_ONLY;
-               BrinMemTuple *tmpdtup PG_USED_FOR_ASSERTS_ONLY;
-               Size tmpsiz PG_USED_FOR_ASSERTS_ONLY;
 
                CHECK_FOR_INTERRUPTS();
 
@@ -139,6 +136,10 @@ brininsert(PG_FUNCTION_ARGS)
 
 #ifdef USE_ASSERT_CHECKING
                {
+                       BrinTuple  *tmptup;
+                       BrinMemTuple *tmpdtup;
+                       Size tmpsiz;
+
                        /*
                         * When assertions are enabled, we use this as an 
opportunity to
                         * test the "union" method, which would otherwise be 
used very
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to