The SvPVX field of a XS AUTOLOAD sub can contain both the prototype
and the name of an AUTOLOADed sub. The CvPROTO macro knows where in
the buffer to find the prototype. All code that reads the prototype
should use it. When I introduced it with commit
8fa6a4095, one code
path was missed: *regular_prototyped_sub = \&prototyped_XS_AUTOLOAD
was using the sub name of the rhs, instead of the prototype, in the
prototype check.
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 15;
use XS::APItest;
eval 'sub a($){}';
like $w, qr/^Prototype mismatch: sub main::a \(\*\$\) vs \(\$\)/m,
'proto warnings respect AUTOLOAD prototypes';
+ undef $w;
+ *a = \&AUTOLOAD;
+ like $w, qr/^Prototype mismatch: sub main::a \(\$\) vs \(\*\$\)/m,
+ 'GV assignment proto warnings respect AUTOLOAD prototypes';
}
}
if (!intro)
cv_ckproto_len_flags(cv, (const GV *)dstr,
- SvPOK(sref) ? SvPVX_const(sref) : NULL,
- SvPOK(sref) ? SvCUR(sref) : 0,
+ SvPOK(sref) ? CvPROTO(sref) : NULL,
+ SvPOK(sref) ? CvPROTOLEN(sref) : 0,
SvPOK(sref) ? SvUTF8(sref) : 0);
}
GvCVGEN(dstr) = 0; /* Switch off cacheness. */