Bug#875424: cop.h: shadows a previous local variable

Christian Brabandt cb at 256bit.org
Mon Sep 11 08:12:31 UTC 2017


Package: libperl5.24
Version: 5.24.1-3+deb9u1
Severity: normal
Tags: patch

Hi compiling vim with perl-support generates this warning:

/usr/bin/perl -e 'unless ( $] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$_ $_\n" }}' > auto/if_perl.c
/usr/bin/perl /usr/share/perl/5.24/ExtUtils/xsubpp -prototypes -typemap \
    /usr/share/perl/5.24/ExtUtils/typemap if_perl.xs >> auto/if_perl.c
gcc -c -I. -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv  -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib/x86_64-linux-gnu/perl/5.24/CORE  -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -g -DDEBUG -Wall -Wextra -Wshadow -Wmissing-prototypes -Wmaybe-uninitialized        -o objects/if_perl.o auto/if_perl.c
In file included from /usr/lib/x86_64-linux-gnu/perl/5.24/CORE/perl.h:3905:0,
                 from if_perl.xs:58:
/usr/lib/x86_64-linux-gnu/perl/5.24/CORE/inline.h: In function ‘S_cx_popsub_args’:
/usr/lib/x86_64-linux-gnu/perl/5.24/CORE/cop.h:612:13: warning: declaration of ‘av’ shadows a previous local [-Wshadow]
         AV *av = GvAV(PL_defgv);                                        \
             ^
/usr/lib/x86_64-linux-gnu/perl/5.24/CORE/cop.h:612:13: note: in definition of macro ‘CX_POP_SAVEARRAY’
         AV *av = GvAV(PL_defgv);                                        \
             ^~
In file included from /usr/lib/x86_64-linux-gnu/perl/5.24/CORE/perl.h:5859:0,
                 from if_perl.xs:58:
/usr/lib/x86_64-linux-gnu/perl/5.24/CORE/inline.h:518:9: note: shadowed declaration is here
     AV *av;
         ^~
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -g -DDEBUG -Wall -Wextra -Wshadow -Wmissing-prototypes -Wmaybe-uninitialized        version.c -o objects/version.o
link.sh: $LINK_AS_NEEDED set to 'yes': invoking linker directly.


Those warnings are generated from the referenced perl header files, so I 
believe this should be fixed in libperl5.24.

This patch fixes it:

--- cop.h       2017-09-11 10:07:48.436509355 +0200
+++ cop.h.new   2017-09-11 10:07:40.564473144 +0200
@@ -609,10 +609,10 @@
 /* Restore old @_ */
 #define CX_POP_SAVEARRAY(cx)                                           \
     STMT_START {                                                       \
-        AV *av = GvAV(PL_defgv);                                        \
+        AV *_av = GvAV(PL_defgv);                                        \
        GvAV(PL_defgv) = cx->blk_sub.savearray;                         \
         cx->blk_sub.savearray = NULL;                                   \
-        SvREFCNT_dec(av);                                              \
+        SvREFCNT_dec(_av);                                             \
     } STMT_END

 /* junk in @_ spells trouble when cloning CVs and in pp_caller(), so don't

 Thanks.

 Best,
 Christian


-- System Information:
Debian Release: 9.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libperl5.24 depends on:
ii  libbz2-1.0         1.0.6-8.1
ii  libc6              2.24-11+deb9u1
ii  libdb5.3           5.3.28-12+b1
ii  libgdbm3           1.8.3-14
ii  perl-modules-5.24  5.24.1-3+deb9u1
ii  zlib1g             1:1.2.8.dfsg-5

libperl5.24 recommends no packages.

libperl5.24 suggests no packages.

-- no debconf information


More information about the Perl-maintainers mailing list