Compiler warning in master branch
I see this when I build at -O2 from master's tip:
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -Werror -I../../../../src/include
-D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o
brin_revmap.o brin_revmap.c -MMD -MP -MF .deps/brin_revmap.Po
brin_revmap.c: In function ‘brinRevmapExtend’:
brin_revmap.c:113:14: error: variable ‘mapBlk’ set but not used
[-Werror=unused-but-set-variable]
BlockNumber mapBlk;
^
I'm using gcc 4.8.2 here.
--
Peter Geoghegan
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Mon, Nov 10, 2014 at 4:31 PM, Peter Geoghegan <pg@heroku.com> wrote:
I see this when I build at -O2 from master's tip:
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -Werror -I../../../../src/include
-D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -c -o
brin_revmap.o brin_revmap.c -MMD -MP -MF .deps/brin_revmap.Po
brin_revmap.c: In function ‘brinRevmapExtend’:
brin_revmap.c:113:14: error: variable ‘mapBlk’ set but not used
[-Werror=unused-but-set-variable]
BlockNumber mapBlk;
^I'm using gcc 4.8.2 here.
It would appear just to need the attached.
Regards
David Rowley
Attachments:
brin_used_for_asserts_only_fix.difftext/plain; charset=US-ASCII; name=brin_used_for_asserts_only_fix.diffDownload
diff --git a/src/backend/access/brin/brin_revmap.c b/src/backend/access/brin/brin_revmap.c
index 7f55ded..272c74e 100644
--- a/src/backend/access/brin/brin_revmap.c
+++ b/src/backend/access/brin/brin_revmap.c
@@ -110,7 +110,7 @@ brinRevmapTerminate(BrinRevmap *revmap)
void
brinRevmapExtend(BrinRevmap *revmap, BlockNumber heapBlk)
{
- BlockNumber mapBlk;
+ BlockNumber mapBlk PG_USED_FOR_ASSERTS_ONLY;
mapBlk = revmap_extend_and_get_blkno(revmap, heapBlk);
David Rowley <dgrowleyml@gmail.com> wrote:> On Mon, Nov 10, 2014 at 4:31 PM, Peter Geoghegan <pg@heroku.com> wrote:
I see this when I build at -O2 from master's tip:
brin_revmap.c: In function ‘brinRevmapExtend’:
brin_revmap.c:113:14: error: variable ‘mapBlk’ set but not used
[-Werror=unused-but-set-variable]
BlockNumber mapBlk;
^
It would appear just to need the attached.
Confirmed and pushed.
Thanks to both of you!
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers