Fix generating Perl prototypes for XS functions with OUTLIST parameters

This commit is contained in:
Petr Písař 2018-12-05 10:06:37 +01:00
parent 4cec86e0de
commit 1885e1b53c
2 changed files with 75 additions and 1 deletions

View File

@ -0,0 +1,66 @@
From 028027e3fb6bba4f720b334e63e26f97a49cf6be Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 5 Dec 2018 15:22:52 +1100
Subject: [PATCH] (perl #133654) don't include OUTLIST parameters in the
prototype
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The generated prototype (with PROTOTYPES: ENABLE) would include
OUTLIST parameters, but these aren't arguments to the perl function.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm | 2 +-
dist/ExtUtils-ParseXS/t/002-more.t | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
index e1f0940745..94ea5f6fef 100644
--- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
+++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
@@ -467,7 +467,7 @@ EOM
$self->{defaults}->{$args[$i]} = $2;
$self->{defaults}->{$args[$i]} =~ s/"/\\"/g;
}
- $self->{proto_arg}->[$i+1] = '$';
+ $self->{proto_arg}->[$i+1] = '$' unless $only_C_inlist_ref->{$args[$i]};
}
my $min_args = $num_args - $extra_args;
$report_args =~ s/"/\\"/g;
diff --git a/dist/ExtUtils-ParseXS/t/002-more.t b/dist/ExtUtils-ParseXS/t/002-more.t
index 4aaa3ab081..e98229095c 100644
--- a/dist/ExtUtils-ParseXS/t/002-more.t
+++ b/dist/ExtUtils-ParseXS/t/002-more.t
@@ -9,7 +9,7 @@ use ExtUtils::CBuilder;
use attributes;
use overload;
-plan tests => 29;
+plan tests => 30;
my ($source_file, $obj_file, $lib_file);
@@ -48,7 +48,7 @@ SKIP: {
}
SKIP: {
- skip "no dynamic loading", 25
+ skip "no dynamic loading", 26
if !$b->have_compiler || !$Config{usedl};
my $module = 'XSMore';
$lib_file = $b->link( objects => $obj_file, module_name => $module );
@@ -92,6 +92,9 @@ SKIP: {
is_deeply [XSMore::outlist()], [ord('a'), ord('b')], 'the OUTLIST keyword';
+ # eval so compile-time sees any prototype
+ is_deeply [ eval 'XSMore::outlist()' ], [ord('a'), ord('b')], 'OUTLIST prototypes';
+
is XSMore::len("foo"), 3, 'the length keyword';
is XSMore::sum(5, 9), 14, 'the INCLUDE_COMMAND directive';
--
2.17.2

View File

@ -3,13 +3,16 @@ Name: perl-ExtUtils-ParseXS
# Epoch to compete with perl.spec # Epoch to compete with perl.spec
Epoch: 1 Epoch: 1
Version: 3.39 Version: 3.39
Release: 417%{?dist} Release: 418%{?dist}
Summary: Module and a script for converting Perl XS code into C code Summary: Module and a script for converting Perl XS code into C code
License: GPL+ or Artistic License: GPL+ or Artistic
URL: https://metacpan.org/release/ExtUtils-ParseXS URL: https://metacpan.org/release/ExtUtils-ParseXS
Source0: https://cpan.metacpan.org/authors/id/S/SM/SMUELLER/ExtUtils-ParseXS-%{base_version}.tar.gz Source0: https://cpan.metacpan.org/authors/id/S/SM/SMUELLER/ExtUtils-ParseXS-%{base_version}.tar.gz
# Unbundled from perl 5.28.0-RC1 # Unbundled from perl 5.28.0-RC1
Patch0: ExtUtils-ParseXS-3.35-Upgrade-to-3.39.patch Patch0: ExtUtils-ParseXS-3.35-Upgrade-to-3.39.patch
# Fix generating Perl prototypes for XS functions with OUTLIST parameters,
# RT#133654, in perl after 5.29.5
Patch1: perl-5.29.5-perl-133654-don-t-include-OUTLIST-parameters-in-the-.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: coreutils BuildRequires: coreutils
BuildRequires: make BuildRequires: make
@ -52,6 +55,7 @@ the glue necessary to let Perl access those functions.
%prep %prep
%setup -q -n ExtUtils-ParseXS-%{base_version} %setup -q -n ExtUtils-ParseXS-%{base_version}
%patch0 -p1 %patch0 -p1
%patch1 -p3
%build %build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1
@ -75,6 +79,10 @@ make test
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %changelog
* Wed Dec 05 2018 Petr Pisar <ppisar@redhat.com> - 1:3.39-418
- Fix generating Perl prototypes for XS functions with OUTLIST parameters
(RT#133654)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.39-417 * Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.39-417
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild