Skip Menu |

This queue is for tickets about the Hash-Spy CPAN distribution.

Report information
The Basics
Id: 85760
Status: new
Priority: 0/
Queue: Hash-Spy

People
Owner: Nobody in particular
Requestors: TJMC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.01
Fixed in: (no value)



Subject: Hash::Spy-0.01 produces warnings when compiled with clang on mac osx
Hello, thanks for your contributions to CPAN! :) Below is a bug report for a minor issue: Hash::Spy seems to be producing a couple of warnings when compiling with clang on Mac OSX, the warnings are as follows: Hash-Spy-0.01 $ perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Hash::Spy Writing MYMETA.yml and MYMETA.json Hash-Spy-0.01 $ make cp lib/Hash/Spy.pm blib/lib/Hash/Spy.pm /opt/local/bin/perl /opt/local/lib/perl5/5.12.4/ExtUtils/xsubpp -typemap /opt/local/lib/perl5/5.12.4/ExtUtils/typemap Spy.xs > Spy.xsc && mv Spy.xsc Spy.c Please specify prototyping behavior for Spy.xs (see perlxs manual) /usr/bin/clang -c -I. -pipe -O2 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -fstack-protector -I/opt/local/include -O3 -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" "-I/opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level/CORE" Spy.c clang: warning: argument unused during compilation: '-no-cpp-precomp' Spy.xs:79:12: warning: using the result of an assignment as a condition without parentheses [-Wparentheses] if (mg = SvTIED_mg((SV*)hv, PERL_MAGIC_tied)) { ~~~^~~~~~~~~~~ Spy.xs:79:12: note: place parentheses around the assignment to silence this warning if (mg = SvTIED_mg((SV*)hv, PERL_MAGIC_tied)) { ^ ( ) Spy.xs:79:12: note: use '==' to turn this assignment into an equality comparison if (mg = SvTIED_mg((SV*)hv, PERL_MAGIC_tied)) { ^ == Spy.xs:148:9: warning: expression result unused [-Wunused-value] SvREFCNT_inc(RETVAL); ^~~~~~~~~~~~~~~~~~~~ /opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level/CORE/sv.h:231:2: note: expanded from macro 'SvREFCNT_inc' _sv; \ ^~~ 2 warnings generated. Running Mkbootstrap for Hash::Spy () chmod 644 Spy.bs rm -f blib/arch/auto/Hash/Spy/Spy.bundle env MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/clang -L/opt/local/lib -bundle -undefined dynamic_lookup -fstack-protector Spy.o -o blib/arch/auto/Hash/Spy/Spy.bundle \ \ chmod 755 blib/arch/auto/Hash/Spy/Spy.bundle cp Spy.bs blib/arch/auto/Hash/Spy/Spy.bs chmod 644 blib/arch/auto/Hash/Spy/Spy.bs Manifying blib/man3/Hash::Spy.3pm Hash-Spy-0.01 $ make test PERL_DL_NONLAZY=1 /opt/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/Hash-Spy.t .. ok t/pods.t ...... skipped: Test::Pod 1.22 required for testing POD All tests successful. Files=2, Tests=65, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.26 cusr 0.01 csys = 0.30 CPU) Result: PASS the attached patch fixes them by wrapping the assignement of mg with parentheses and replacing SvREFCNT_inc with SvREFCNT_inc_void. compiled with : Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn) Target: x86_64-apple-darwin11.4.2 Thread model: posix on perl : $ perl -V Summary of my perl5 (revision 5 version 12 subversion 4) configuration: Platform: osname=darwin, osvers=11.3.0, archname=darwin-thread-multi-2level uname='darwin gamma.local 11.3.0 darwin kernel version 11.3.0: thu jan 12 18:48:32 pst 2012; root:xnu-1699.24.23~1release_i386 i386 ' config_args='-D inc_version_list=5.12.3/darwin-thread-multi-2level 5.12.3 5.12.2/darwin-thread-multi-2level 5.12.2 5.12.1/darwin-thread-multi-2level 5.12.1 5.12.0/darwin-thread-multi-2level 5.12.0 -des -Dprefix=/opt/local -Dscriptdir=/opt/local/bin -Dcppflags=-I/opt/local/include -Dccflags=-pipe -O2 -Dldflags=-L/opt/local/lib -Dvendorprefix=/opt/local -Dusemultiplicity=y -Dusethreads -Duseshrplib -D cc=/usr/bin/clang -D ld=/usr/bin/clang -D man1ext=1pm -D man3ext=3pm -D man1dir=/opt/local/share/man/man1p -D man3dir=/opt/local/share/man/man3p -D sitebin=/opt/local/libexec/perl5.12/sitebin -D siteman1dir=/opt/local/share/perl5.12/siteman/man1 -D siteman3dir=/opt/local/share/perl5.12/siteman/man3 -D vendorbin=/opt/local/libexec/perl5.12 -D vendorman1dir=/opt/local/share/perl5.12/man/man1 -D vendorman3dir=/opt/local/share/perl5.12/man/man3 -D pager=/usr/bin/less -sR -D perlpath=/opt/local/bin/perl5.12 -D startperl=#!/opt/local/bin/perl5.12' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='/usr/bin/clang', ccflags ='-pipe -O2 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -fstack-protector -I/opt/local/include', optimize='-O3', cppflags='-I/opt/local/include -no-cpp-precomp -pipe -O2 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -fstack-protector -I/opt/local/include' ccversion='', gccversion='4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/clang', ldflags ='-L/opt/local/lib -fstack-protector' libpth=/opt/local/lib /usr/lib libs=-lgdbm -ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-L/opt/local/lib -bundle -undefined dynamic_lookup -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Built under darwin Compiled at Jun 25 2012 23:37:53 %ENV: PERL5LIB="/Users/tjmc/perl5/lib/perl5/darwin-thread-multi-2level:/Users/tjmc/perl5/lib/perl5" PERL_LOCAL_LIB_ROOT="/Users/tjmc/perl5" PERL_MB_OPT="--install_base /Users/tjmc/perl5" PERL_MM_OPT="INSTALL_BASE=/Users/tjmc/perl5" @INC: /Users/tjmc/perl5/lib/perl5/darwin-thread-multi-2level /Users/tjmc/perl5/lib/perl5/darwin-thread-multi-2level /Users/tjmc/perl5/lib/perl5 /opt/local/lib/perl5/site_perl/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.12.4 /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.12.4 /opt/local/lib/perl5/5.12.4/darwin-thread-multi-2level /opt/local/lib/perl5/5.12.4 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl . Thanks, tjmc
Subject: Hash-Spy-0.01-warnings.patch
--- Hash-Spy-0.01/Spy.xs 2013-04-22 17:48:30.000000000 +0200 +++ Hash-Spy2/Spy.xs 2013-05-30 18:14:11.000000000 +0200 @@ -76,7 +76,7 @@ PREINIT: const MAGIC *mg; CODE: - if (mg = SvTIED_mg((SV*)hv, PERL_MAGIC_tied)) { + if ((mg = SvTIED_mg((SV*)hv, PERL_MAGIC_tied))) { RETVAL = SvTIED_obj((SV*)hv, mg); if (!sv_isa(RETVAL, "Hash::Spy")) Perl_croak(aTHX_ "Hash::Spy does not support tied hashes"); @@ -145,7 +145,7 @@ if (hv_exists_ent(spy, key, 0)) { spyback(aTHX_ spy, DELETE, 1, key); RETVAL = hv_delete_ent(spy, key, 0, 0); - SvREFCNT_inc(RETVAL); + SvREFCNT_inc_void(RETVAL); if (!HvTOTALKEYS(spy)) spyback(aTHX_ spy, EMPTY, 0); }