Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the ExtUtils-ParseXS CPAN distribution.

Report information
The Basics
Id: 31533
Status: resolved
Priority: 0/
Queue: ExtUtils-ParseXS

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

Bug Information
Severity: Important
Broken in: 2.18
Fixed in: (no value)



Subject: Compilation error with OVERLOAD: keyword
I am working with Windows XP Home SP2, perl is v5.9.5 compiled with MSVC++ 2005, ExtUtils::ParseXS is 2.18. I tried to use the OVERLOAD: keyword with following xs code: MODULE = CLR PACKAGE = CLR::OverLoad STRING op_stringify(OBJECT self, ...) OVERLOAD: \"\" CODE: RETVAL = self->ToString(); OUTPUT: RETVAL When compiling, two errors occurred. CLR.c(1474) : error C2065: 'ax' : undeclared identifier CLR.c(1502) : error C2664: 'Perl_sv_setsv_flags' : cannot convert parameter 3 from 'SV' to 'SV*' Generated C code is: XS(XS_CLR__OverLoad_nil); /* prototype to pass -Wmissing-prototypes */ XS(XS_CLR__OverLoad_nil) { XSRETURN_EMPTY; <- line 1474 } /* register the overloading (type 'A') magic */ PL_amagic_generation++; /* The magic for overload gets a GV* via gv_fetchmeth as */ /* mentioned above, and looks in the SV* slot of it for */ /* the "fallback" status. */ sv_setsv( get_sv( "CLR::OverLoad::()", TRUE ), PL_sv_undef ); <- line 1502 I found the discussion about this problem. http://groups.google.com/group/perl.xs/browse_thread/thread/9f9120aeba415bde/d7ab8b44ad510c1b?#d7ab8b44ad510c1b I thought ParseXS generates incorrectly code, so I edited ParseXS.pm as follows. *** ParseXS.pm Tue Jan 30 11:56:14 2007 --- ParseXS_fixoverload.pm Fri Dec 14 21:15:58 2007 *************** *** 76,82 **** $proto_re = "[" . quotemeta('\$%&*@;[]') . "]" ; $Overload = 0; $errors = 0; ! $Fallback = 'PL_sv_undef'; # Most of the 1500 lines below uses these globals. We'll have to # clean this up sometime, probably. For now, we just pull them out --- 76,82 ---- $proto_re = "[" . quotemeta('\$%&*@;[]') . "]" ; $Overload = 0; $errors = 0; ! $Fallback = '&PL_sv_undef'; # Most of the 1500 lines below uses these globals. We'll have to # clean this up sometime, probably. For now, we just pull them out *************** *** 896,901 **** --- 896,902 ---- #XS(XS_${Packid}_nil); /* prototype to pass -Wmissing-prototypes */ #XS(XS_${Packid}_nil) #{ + # dXSARGS; # XSRETURN_EMPTY; #} # *************** *** 1318,1326 **** TrimWhitespace($_) ; my %map = ( ! TRUE => "PL_sv_yes", 1 => "PL_sv_yes", ! FALSE => "PL_sv_no", 0 => "PL_sv_no", ! UNDEF => "PL_sv_undef", ) ; # check for valid FALLBACK value --- 1319,1327 ---- TrimWhitespace($_) ; my %map = ( ! TRUE => "&PL_sv_yes", 1 => "&PL_sv_yes", ! FALSE => "&PL_sv_no", 0 => "&PL_sv_no", ! UNDEF => "&PL_sv_undef", ) ; # check for valid FALLBACK value As a result, compilation successed and the code came to work correctly! Is this way correct for this problem?
Subject: ParseXS-2.18.pm.patch
*** ParseXS.pm Tue Jan 30 11:56:14 2007 --- ParseXS_fixoverload.pm Fri Dec 14 21:15:58 2007 *************** *** 76,82 **** $proto_re = "[" . quotemeta('\$%&*@;[]') . "]" ; $Overload = 0; $errors = 0; ! $Fallback = 'PL_sv_undef'; # Most of the 1500 lines below uses these globals. We'll have to # clean this up sometime, probably. For now, we just pull them out --- 76,82 ---- $proto_re = "[" . quotemeta('\$%&*@;[]') . "]" ; $Overload = 0; $errors = 0; ! $Fallback = '&PL_sv_undef'; # Most of the 1500 lines below uses these globals. We'll have to # clean this up sometime, probably. For now, we just pull them out *************** *** 896,901 **** --- 896,902 ---- #XS(XS_${Packid}_nil); /* prototype to pass -Wmissing-prototypes */ #XS(XS_${Packid}_nil) #{ + # dXSARGS; # XSRETURN_EMPTY; #} # *************** *** 1318,1326 **** TrimWhitespace($_) ; my %map = ( ! TRUE => "PL_sv_yes", 1 => "PL_sv_yes", ! FALSE => "PL_sv_no", 0 => "PL_sv_no", ! UNDEF => "PL_sv_undef", ) ; # check for valid FALLBACK value --- 1319,1327 ---- TrimWhitespace($_) ; my %map = ( ! TRUE => "&PL_sv_yes", 1 => "&PL_sv_yes", ! FALSE => "&PL_sv_no", 0 => "&PL_sv_no", ! UNDEF => "&PL_sv_undef", ) ; # check for valid FALLBACK value
On Fri Dec 14 09:01:23 2007, YAMATO wrote: Show quoted text
> As a result, compilation successed and the code came to work > correctly! > Is this way correct for this problem?
I encountered the same problem. I think the proposed patch is correct. I'd just add PERL_UNUSED_VAR (items); to the _nil xsub to silence compiler warnings.
From: kwilliams [...] cpan.org
Thanks, I've applied the patch. -Ken
patch applied so closing out the ticket