Skip Menu |

This queue is for tickets about the Params-Validate CPAN distribution.

Report information
The Basics
Id: 96364
Status: resolved
Priority: 0/
Queue: Params-Validate

People
Owner: Nobody in particular
Requestors: jmash01 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.11



Subject: Compile Failure on Win32/64 with MSVC
Date: Tue, 10 Jun 2014 12:20:35 -0700
To: bug-Params-Validate [...] rt.cpan.org
From: J Mash <jmash01 [...] gmail.com>
The following errors occur when trying to install this module on MSWin32-x86 and MSWin32-x64 on Perl 5.10.1, 5.18.0, and 5.20.0 (and possibly more) when compiled with an MSVC compiler: Building Params-Validate Generating script 'lib\Params\Validate\XS.ccs' cl -nologo -c @"lib\Params\Validate\XS.ccs" -Fo"lib\Params\Validate\XS.obj" "lib\Params\Validate\XS.c" XS.c lib\\Params\\Validate\\XS.xs(283) : error C2275: 'SV' : illegal use of this type as an expression C:\Perl\5.18.0\lib\MSWin32-x64-multi-thread\CORE\perl.h(2459) : see declaration of 'SV' lib\\Params\\Validate\\XS.xs(283) : error C2065: 'caller' : undeclared identifier lib\\Params\\Validate\\XS.xs(289) : error C2143: syntax error : missing ';' before 'const' lib\\Params\\Validate\\XS.xs(291) : error C2275: 'GV' : illegal use of this type as an expression C:\Perl\5.18.0\lib\MSWin32-x64-multi-thread\CORE\perl.h(2465) : see declaration of 'GV' lib\\Params\\Validate\\XS.xs(291) : error C2065: 'cvgv' : undeclared identifier lib\\Params\\Validate\\XS.xs(292) : error C2065: 'cx' : undeclared identifier lib\\Params\\Validate\\XS.xs(293) : error C2065: 'cx' : undeclared identifier lib\\Params\\Validate\\XS.xs(293) : error C2223: left of '->cx_u' must point to struct/union lib\\Params\\Validate\\XS.xs(295) : error C2065: 'caller' : undeclared identifier lib\\Params\\Validate\\XS.xs(298) : error C2065: 'cvgv' : undeclared identifier lib\\Params\\Validate\\XS.xs(298) : error C2065: 'cx' : undeclared identifier lib\\Params\\Validate\\XS.xs(298) : error C2223: left of '->cx_u' must point to struct/union lib\\Params\\Validate\\XS.xs(298) : error C2198: 'S_CvGV' : too few arguments for call lib\\Params\\Validate\\XS.xs(299) : error C2065: 'caller' : undeclared identifier lib\\Params\\Validate\\XS.xs(300) : error C2065: 'cvgv' : undeclared identifier lib\\Params\\Validate\\XS.xs(300) : error C2065: 'cvgv' : undeclared identifier lib\\Params\\Validate\\XS.xs(300) : error C2223: left of '->sv_flags' must point to struct/union lib\\Params\\Validate\\XS.xs(301) : error C2065: 'caller' : undeclared identifier lib\\Params\\Validate\\XS.xs(301) : error C2065: 'cvgv' : undeclared identifier lib\\Params\\Validate\\XS.xs(305) : error C2065: 'caller' : undeclared identifier lib\\Params\\Validate\\XS.xs(310) : error C2065: 'caller' : undeclared identifier lib\\Params\\Validate\\XS.xs(321) : error C2065: 'caller' : undeclared identifier lib\\Params\\Validate\\XS.xs(328) : error C2061: syntax error : identifier 'validate_isa' lib\\Params\\Validate\\XS.xs(328) : error C2059: syntax error : ';' lib\\Params\\Validate\\XS.xs(328) : error C2059: syntax error : 'type' error building dll file from 'lib\Params\Validate\XS.c' The source of the issue is that the MSVC compiler requires variables to be declared at the top of the block before any code. The following block of code moved a couple of variable declarations, which allowed the module to compile and test successfully for me: /* get called subroutine fully qualified name */ static SV* get_called(HV* options) { SV** temp; if ((temp = hv_fetch(options, "called", 6, 0))) { SvGETMAGIC(*temp); return *temp; } else { * const PERL_CONTEXT *cx;* * GV *cvgv;* IV frame; * SV *buffer;* * SV *caller;* if ((temp = hv_fetch(options, "stack_skip", 10, 0))) { SvGETMAGIC(*temp); frame = SvIV(*temp); } else { frame = 1; } #if PERL_VERSION >= 14 if (frame > 0) { frame--; } * cx = caller_cx(frame, NULL);* if (cx) { switch (CxTYPE(cx)) { case CXt_EVAL: caller = newSVpv("\"eval\"", 6); break; case CXt_SUB: cvgv = CvGV(cx->blk_sub.cv); caller = newSV(0); if (cvgv && isGV(cvgv)) { gv_efullname4(caller, cvgv, NULL, 1); } break; default: caller = newSVpv("(unknown)", 9); break; } } else { caller = newSVpv("(unknown)", 9); } #else * buffer = sv_2mortal(newSVpvf("(caller(%d))[3]", (int) frame));* caller = eval_pv(SvPV_nolen(buffer), 1); if (SvTYPE(caller) == SVt_NULL) { sv_setpv(caller, "(unknown"); } #endif return caller; } }
On Tue Jun 10 15:20:47 2014, jmash01@gmail.com wrote: Show quoted text
> The following errors occur when trying to install this module on > MSWin32-x86 and MSWin32-x64 on Perl 5.10.1, 5.18.0, and 5.20.0 (and > possibly more) when compiled with an MSVC compiler: > > Building Params-Validate > Generating script 'lib\Params\Validate\XS.ccs' > cl -nologo -c @"lib\Params\Validate\XS.ccs" -Fo"lib\Params\Validate\XS.obj" > "lib\Params\Validate\XS.c" > XS.c > lib\\Params\\Validate\\XS.xs(283) : error C2275: 'SV' : illegal use of this > type as an expression > C:\Perl\5.18.0\lib\MSWin32-x64-multi-thread\CORE\perl.h(2459) : see > declaration of 'SV' > lib\\Params\\Validate\\XS.xs(283) : error C2065: 'caller' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(289) : error C2143: syntax error : missing ';' > before 'const' > lib\\Params\\Validate\\XS.xs(291) : error C2275: 'GV' : illegal use of this > type as an expression > C:\Perl\5.18.0\lib\MSWin32-x64-multi-thread\CORE\perl.h(2465) : see > declaration of 'GV' > lib\\Params\\Validate\\XS.xs(291) : error C2065: 'cvgv' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(292) : error C2065: 'cx' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(293) : error C2065: 'cx' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(293) : error C2223: left of '->cx_u' must > point to struct/union > lib\\Params\\Validate\\XS.xs(295) : error C2065: 'caller' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(298) : error C2065: 'cvgv' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(298) : error C2065: 'cx' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(298) : error C2223: left of '->cx_u' must > point to struct/union > lib\\Params\\Validate\\XS.xs(298) : error C2198: 'S_CvGV' : too few > arguments for call > lib\\Params\\Validate\\XS.xs(299) : error C2065: 'caller' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(300) : error C2065: 'cvgv' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(300) : error C2065: 'cvgv' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(300) : error C2223: left of '->sv_flags' must > point to struct/union > lib\\Params\\Validate\\XS.xs(301) : error C2065: 'caller' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(301) : error C2065: 'cvgv' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(305) : error C2065: 'caller' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(310) : error C2065: 'caller' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(321) : error C2065: 'caller' : undeclared > identifier > lib\\Params\\Validate\\XS.xs(328) : error C2061: syntax error : identifier > 'validate_isa' > lib\\Params\\Validate\\XS.xs(328) : error C2059: syntax error : ';' > lib\\Params\\Validate\\XS.xs(328) : error C2059: syntax error : 'type' > error building dll file from 'lib\Params\Validate\XS.c' > > > The source of the issue is that the MSVC compiler requires variables to be > declared at the top of the block before any code. The following block of > code moved a couple of variable declarations, which allowed the module to > compile and test successfully for me: > > /* get called subroutine fully qualified name */ > static SV* > get_called(HV* options) { > SV** temp; > > if ((temp = hv_fetch(options, "called", 6, 0))) { > SvGETMAGIC(*temp); > return *temp; > } > else { > * const PERL_CONTEXT *cx;* > * GV *cvgv;* > IV frame; > * SV *buffer;* > * SV *caller;* > > if ((temp = hv_fetch(options, "stack_skip", 10, 0))) { > SvGETMAGIC(*temp); > frame = SvIV(*temp); > } > else { > frame = 1; > } > > #if PERL_VERSION >= 14 > if (frame > 0) { > frame--; > } > > * cx = caller_cx(frame, NULL);* > > if (cx) { > switch (CxTYPE(cx)) { > case CXt_EVAL: > caller = newSVpv("\"eval\"", 6); > break; > case CXt_SUB: > cvgv = CvGV(cx->blk_sub.cv); > caller = newSV(0); > if (cvgv && isGV(cvgv)) { > gv_efullname4(caller, cvgv, NULL, 1); > } > break; > default: > caller = newSVpv("(unknown)", 9); > break; > } > } > else { > caller = newSVpv("(unknown)", 9); > } > #else > * buffer = sv_2mortal(newSVpvf("(caller(%d))[3]", (int) frame));* > > caller = eval_pv(SvPV_nolen(buffer), 1); > if (SvTYPE(caller) == SVt_NULL) { > sv_setpv(caller, "(unknown"); > } > #endif > > return caller; > } > }
Patches (or better yet, pull requests) are welcome. I don't do windows development myself. The GitHub repo is at https://github.com/autarch/Params-Validate
Subject: Compile Failure on Win32/64 with MSVC [rt.cpan.org #96364]
Date: Fri, 13 Jun 2014 11:03:09 -0700
To: bug-Params-Validate [...] rt.cpan.org
From: J Mash <jmash01 [...] gmail.com>
Alright, pull request submitted -- Let me know if there's anything else I can do to help.