From 296d79f666720f5232fcab1ee9fea5ca068d3544 Mon Sep 17 00:00:00 2001 From: Ed J Date: Sat, 20 Mar 2021 16:35:25 +0000 Subject: [PATCH 1/2] use PERL_VERSION_LE not 5.33+ PERL_VERSION_LT As ExtUtils::ParseXS is dual-life it needs to use stable Perl macros. --- dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm index 39f9df933b66..16a87eeb6055 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm @@ -912,7 +912,7 @@ EOF #-Wall: if there is no $self->{Full_func_name} there are no xsubs in this .xs #so 'file' is unused print Q(<<"EOF") if $self->{Full_func_name}; -##if PERL_VERSION_LT(5, 9, 0) +##if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */ # char* file = __FILE__; ##else # const char* file = __FILE__; @@ -955,7 +955,7 @@ EOF print Q(<<"EOF") if ($self->{Overload}); # /* register the overloading (type 'A') magic */ -##if PERL_VERSION_LT(5, 9, 0) +##if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */ # PL_amagic_generation++; ##endif # /* The magic for overload gets a GV* via gv_fetchmeth as */ From f7e734123771b6e87cf77ce8e223478305566057 Mon Sep 17 00:00:00 2001 From: Ed J Date: Sun, 21 Apr 2019 22:18:13 +0100 Subject: [PATCH 2/2] ExtUtils::ParseXS fix error-message bug --- MANIFEST | 1 + dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm | 2 +- dist/ExtUtils-ParseXS/t/001-basic.t | 14 +++++++++- dist/ExtUtils-ParseXS/t/XSBroken.xs | 26 +++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 dist/ExtUtils-ParseXS/t/XSBroken.xs diff --git a/MANIFEST b/MANIFEST index 780804ef43ac..551e5832dd5f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3639,6 +3639,7 @@ dist/ExtUtils-ParseXS/t/lib/PrimitiveCapture.pm Primitive STDOUT/ERR capturing dist/ExtUtils-ParseXS/t/lib/TypemapTest/Foo.pm ExtUtils::Typemaps tests dist/ExtUtils-ParseXS/t/pseudotypemap1 A test-typemap dist/ExtUtils-ParseXS/t/typemap Standard typemap for controlled testing +dist/ExtUtils-ParseXS/t/XSBroken.xs Test file for ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/XSInclude.xsh Test file for ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/XSMore.xs Test file for ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/XSTest.pm Test file for ExtUtils::ParseXS tests diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm index 16a87eeb6055..72e698422aa4 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm @@ -1906,7 +1906,7 @@ sub generate_init { my $inputmap = $typemaps->get_inputmap(xstype => $xstype); if (not defined $inputmap) { - $self->blurt("Error: No INPUT definition for type '$type', typekind '" . $type->xstype . "' found"); + $self->blurt("Error: No INPUT definition for type '$type', typekind '$xstype' found"); return; } diff --git a/dist/ExtUtils-ParseXS/t/001-basic.t b/dist/ExtUtils-ParseXS/t/001-basic.t index 031de2473495..665180934f3d 100644 --- a/dist/ExtUtils-ParseXS/t/001-basic.t +++ b/dist/ExtUtils-ParseXS/t/001-basic.t @@ -1,10 +1,12 @@ #!/usr/bin/perl use strict; -use Test::More tests => 17; +use Test::More tests => 18; use Config; use DynaLoader; use ExtUtils::CBuilder; +use lib (-d 't' ? File::Spec->catdir(qw(t lib)) : 'lib'); +use PrimitiveCapture; my ($source_file, $obj_file, $lib_file); @@ -178,6 +180,16 @@ unless ($ENV{PERL_NO_CLEANUP}) { } ##################################################################### +{ # third block: broken typemap +my $pxs = ExtUtils::ParseXS->new; +tie *FH, 'Foo'; +my $stderr = PrimitiveCapture::capture_stderr(sub { + $pxs->process_file(filename => 'XSBroken.xs', output => \*FH); +}); +like $stderr, '/No INPUT definition/', "Exercise typemap error"; +} +##################################################################### + sub Foo::TIEHANDLE { bless {}, 'Foo' } sub Foo::PRINT { shift->{buf} .= join '', @_ } sub Foo::content { shift->{buf} } diff --git a/dist/ExtUtils-ParseXS/t/XSBroken.xs b/dist/ExtUtils-ParseXS/t/XSBroken.xs new file mode 100644 index 000000000000..791383820f0b --- /dev/null +++ b/dist/ExtUtils-ParseXS/t/XSBroken.xs @@ -0,0 +1,26 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +typedef IV MyType3; + +MODULE = XSBroken PACKAGE = XSBroken + +PROTOTYPES: ENABLE + + +TYPEMAP: <<'END' +MyType3 T_BAAR + +OUTPUT +T_BAAR + sv_setiv($arg, (IV)$var); +END + +MyType3 +typemaptest3(foo) + MyType3 foo + CODE: + RETVAL = foo; + OUTPUT: + RETVAL