3.44 bump

This commit is contained in:
Jitka Plesnikova 2022-01-07 11:48:05 +01:00
parent fbb6712c3c
commit 0989c06232
6 changed files with 135 additions and 1187 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ ExtUtils-ParseXS-2.18.tar.gz
/ExtUtils-ParseXS-3.24.tar.gz
/ExtUtils-ParseXS-3.30.tar.gz
/ExtUtils-ParseXS-3.35.tar.gz
/ExtUtils-ParseXS-3.44.tar.gz

View File

@ -1,126 +0,0 @@
From 4f8996e1ea5a5f24b1d5b4462f56a917daa67a47 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Fri, 26 Apr 2019 15:59:36 +0200
Subject: [PATCH] Upgrade to 3.40
The generated prototype (with PROTOTYPES: ENABLE) would include
OUTLIST parameters, but these aren't arguments to the perl function.
---
lib/ExtUtils/ParseXS.pm | 4 ++--
lib/ExtUtils/ParseXS/Constants.pm | 2 +-
lib/ExtUtils/ParseXS/CountLines.pm | 2 +-
lib/ExtUtils/ParseXS/Eval.pm | 2 +-
lib/ExtUtils/ParseXS/Utilities.pm | 2 +-
t/002-more.t | 7 +++++--
6 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/lib/ExtUtils/ParseXS.pm b/lib/ExtUtils/ParseXS.pm
index e1f0940..fba7f4d 100644
--- a/lib/ExtUtils/ParseXS.pm
+++ b/lib/ExtUtils/ParseXS.pm
@@ -11,7 +11,7 @@ use Symbol;
our $VERSION;
BEGIN {
- $VERSION = '3.39';
+ $VERSION = '3.40';
require ExtUtils::ParseXS::Constants; ExtUtils::ParseXS::Constants->VERSION($VERSION);
require ExtUtils::ParseXS::CountLines; ExtUtils::ParseXS::CountLines->VERSION($VERSION);
require ExtUtils::ParseXS::Utilities; ExtUtils::ParseXS::Utilities->VERSION($VERSION);
@@ -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/lib/ExtUtils/ParseXS/Constants.pm b/lib/ExtUtils/ParseXS/Constants.pm
index 45b5674..2c392e3 100644
--- a/lib/ExtUtils/ParseXS/Constants.pm
+++ b/lib/ExtUtils/ParseXS/Constants.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use Symbol;
-our $VERSION = '3.39';
+our $VERSION = '3.40';
=head1 NAME
diff --git a/lib/ExtUtils/ParseXS/CountLines.pm b/lib/ExtUtils/ParseXS/CountLines.pm
index 5b48449..a9258f9 100644
--- a/lib/ExtUtils/ParseXS/CountLines.pm
+++ b/lib/ExtUtils/ParseXS/CountLines.pm
@@ -1,7 +1,7 @@
package ExtUtils::ParseXS::CountLines;
use strict;
-our $VERSION = '3.39';
+our $VERSION = '3.40';
our $SECTION_END_MARKER;
diff --git a/lib/ExtUtils/ParseXS/Eval.pm b/lib/ExtUtils/ParseXS/Eval.pm
index 9eba5e5..840bac7 100644
--- a/lib/ExtUtils/ParseXS/Eval.pm
+++ b/lib/ExtUtils/ParseXS/Eval.pm
@@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Eval;
use strict;
use warnings;
-our $VERSION = '3.39';
+our $VERSION = '3.40';
=head1 NAME
diff --git a/lib/ExtUtils/ParseXS/Utilities.pm b/lib/ExtUtils/ParseXS/Utilities.pm
index ae25b33..58f3856 100644
--- a/lib/ExtUtils/ParseXS/Utilities.pm
+++ b/lib/ExtUtils/ParseXS/Utilities.pm
@@ -5,7 +5,7 @@ use Exporter;
use File::Spec;
use ExtUtils::ParseXS::Constants ();
-our $VERSION = '3.39';
+our $VERSION = '3.40';
our (@ISA, @EXPORT_OK);
@ISA = qw(Exporter);
diff --git a/t/002-more.t b/t/002-more.t
index 4aaa3ab..e982290 100644
--- a/t/002-more.t
+++ b/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.20.1

View File

@ -1,728 +0,0 @@
From 9e7a7caf4d42a74235accb7a397b5313ecbbbc94 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Thu, 6 May 2021 07:58:11 +0200
Subject: [PATCH] Upgrade to 3.43
---
lib/ExtUtils/ParseXS.pm | 10 ++-
lib/ExtUtils/ParseXS/Constants.pm | 2 +-
lib/ExtUtils/ParseXS/CountLines.pm | 2 +-
lib/ExtUtils/ParseXS/Eval.pm | 2 +-
lib/ExtUtils/ParseXS/Utilities.pm | 2 +-
lib/ExtUtils/Typemaps.pm | 2 +-
lib/ExtUtils/Typemaps/Cmd.pm | 2 +-
lib/ExtUtils/Typemaps/InputMap.pm | 2 +-
lib/ExtUtils/Typemaps/OutputMap.pm | 2 +-
lib/ExtUtils/Typemaps/Type.pm | 2 +-
lib/perlxs.pod | 40 +++++++--
lib/perlxstut.pod | 126 +++++++++++++++++------------
t/001-basic.t | 29 +++++--
t/002-more.t | 3 +-
t/003-usage.t | 3 +-
t/XSBroken.xs | 26 ++++++
16 files changed, 171 insertions(+), 84 deletions(-)
create mode 100644 t/XSBroken.xs
diff --git a/lib/ExtUtils/ParseXS.pm b/lib/ExtUtils/ParseXS.pm
index fba7f4d..d2205ac 100644
--- a/lib/ExtUtils/ParseXS.pm
+++ b/lib/ExtUtils/ParseXS.pm
@@ -11,7 +11,7 @@ use Symbol;
our $VERSION;
BEGIN {
- $VERSION = '3.40';
+ $VERSION = '3.43';
require ExtUtils::ParseXS::Constants; ExtUtils::ParseXS::Constants->VERSION($VERSION);
require ExtUtils::ParseXS::CountLines; ExtUtils::ParseXS::CountLines->VERSION($VERSION);
require ExtUtils::ParseXS::Utilities; ExtUtils::ParseXS::Utilities->VERSION($VERSION);
@@ -42,6 +42,7 @@ use ExtUtils::ParseXS::Utilities qw(
our @EXPORT_OK = qw(
process_file
report_error_count
+ errors
);
##############################
@@ -911,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_REVISION == 5 && PERL_VERSION < 9)
+##if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
# char* file = __FILE__;
##else
# const char* file = __FILE__;
@@ -954,7 +955,7 @@ EOF
print Q(<<"EOF") if ($self->{Overload});
# /* register the overloading (type 'A') magic */
-##if (PERL_REVISION == 5 && PERL_VERSION < 9)
+##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 */
@@ -1012,6 +1013,7 @@ sub report_error_count {
return $Singleton->{errors}||0;
}
}
+*errors = \&report_error_count;
# Input: ($self, $_, @{ $self->{line} }) == unparsed input.
# Output: ($_, @{ $self->{line} }) == (rest of line, following lines).
@@ -1904,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/lib/ExtUtils/ParseXS/Constants.pm b/lib/ExtUtils/ParseXS/Constants.pm
index 2c392e3..d7668c4 100644
--- a/lib/ExtUtils/ParseXS/Constants.pm
+++ b/lib/ExtUtils/ParseXS/Constants.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use Symbol;
-our $VERSION = '3.40';
+our $VERSION = '3.43';
=head1 NAME
diff --git a/lib/ExtUtils/ParseXS/CountLines.pm b/lib/ExtUtils/ParseXS/CountLines.pm
index a9258f9..c592621 100644
--- a/lib/ExtUtils/ParseXS/CountLines.pm
+++ b/lib/ExtUtils/ParseXS/CountLines.pm
@@ -1,7 +1,7 @@
package ExtUtils::ParseXS::CountLines;
use strict;
-our $VERSION = '3.40';
+our $VERSION = '3.43';
our $SECTION_END_MARKER;
diff --git a/lib/ExtUtils/ParseXS/Eval.pm b/lib/ExtUtils/ParseXS/Eval.pm
index 840bac7..c509531 100644
--- a/lib/ExtUtils/ParseXS/Eval.pm
+++ b/lib/ExtUtils/ParseXS/Eval.pm
@@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Eval;
use strict;
use warnings;
-our $VERSION = '3.40';
+our $VERSION = '3.43';
=head1 NAME
diff --git a/lib/ExtUtils/ParseXS/Utilities.pm b/lib/ExtUtils/ParseXS/Utilities.pm
index 58f3856..6cc8a0e 100644
--- a/lib/ExtUtils/ParseXS/Utilities.pm
+++ b/lib/ExtUtils/ParseXS/Utilities.pm
@@ -5,7 +5,7 @@ use Exporter;
use File::Spec;
use ExtUtils::ParseXS::Constants ();
-our $VERSION = '3.40';
+our $VERSION = '3.43';
our (@ISA, @EXPORT_OK);
@ISA = qw(Exporter);
diff --git a/lib/ExtUtils/Typemaps.pm b/lib/ExtUtils/Typemaps.pm
index a762322..62a2b1b 100644
--- a/lib/ExtUtils/Typemaps.pm
+++ b/lib/ExtUtils/Typemaps.pm
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.38';
+our $VERSION = '3.43';
require ExtUtils::ParseXS;
require ExtUtils::ParseXS::Constants;
diff --git a/lib/ExtUtils/Typemaps/Cmd.pm b/lib/ExtUtils/Typemaps/Cmd.pm
index 3c33f54..5bddcc0 100644
--- a/lib/ExtUtils/Typemaps/Cmd.pm
+++ b/lib/ExtUtils/Typemaps/Cmd.pm
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::Cmd;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.38';
+our $VERSION = '3.43';
use ExtUtils::Typemaps;
diff --git a/lib/ExtUtils/Typemaps/InputMap.pm b/lib/ExtUtils/Typemaps/InputMap.pm
index bf19df1..fd2efc8 100644
--- a/lib/ExtUtils/Typemaps/InputMap.pm
+++ b/lib/ExtUtils/Typemaps/InputMap.pm
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::InputMap;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.38';
+our $VERSION = '3.43';
=head1 NAME
diff --git a/lib/ExtUtils/Typemaps/OutputMap.pm b/lib/ExtUtils/Typemaps/OutputMap.pm
index 90adb48..d4210c5 100644
--- a/lib/ExtUtils/Typemaps/OutputMap.pm
+++ b/lib/ExtUtils/Typemaps/OutputMap.pm
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::OutputMap;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.38';
+our $VERSION = '3.43';
=head1 NAME
diff --git a/lib/ExtUtils/Typemaps/Type.pm b/lib/ExtUtils/Typemaps/Type.pm
index 01bd51d..36d5753 100644
--- a/lib/ExtUtils/Typemaps/Type.pm
+++ b/lib/ExtUtils/Typemaps/Type.pm
@@ -4,7 +4,7 @@ use strict;
use warnings;
require ExtUtils::Typemaps;
-our $VERSION = '3.38';
+our $VERSION = '3.43';
=head1 NAME
diff --git a/lib/perlxs.pod b/lib/perlxs.pod
index 1419ee0..5aa215b 100644
--- a/lib/perlxs.pod
+++ b/lib/perlxs.pod
@@ -79,6 +79,11 @@ Note: For some extensions, Dave Beazley's SWIG system may provide a
significantly more convenient mechanism for creating the extension
glue code. See L<http://www.swig.org/> for more information.
+For simple bindings to C libraries as well as other machine code libraries,
+consider instead using the much simpler
+L<libffi|http://sourceware.org/libffi/> interface via CPAN modules like
+L<FFI::Platypus> or L<FFI::Raw>.
+
=head2 On The Road
Many of the examples which follow will concentrate on creating an interface
@@ -598,7 +603,7 @@ and C<$type> can be used as in typemaps.
bool_t
rpcb_gettime(host,timep)
- char *host = (char *)SvPV_nolen($arg);
+ char *host = (char *)SvPVbyte_nolen($arg);
time_t &timep = 0;
OUTPUT:
timep
@@ -625,7 +630,7 @@ Here's a truly obscure example:
bool_t
rpcb_gettime(host,timep)
time_t &timep; /* \$v{timep}=@{[$v{timep}=$arg]} */
- char *host + SvOK($v{timep}) ? SvPV_nolen($arg) : NULL;
+ char *host + SvOK($v{timep}) ? SvPVbyte_nolen($arg) : NULL;
OUTPUT:
timep
@@ -988,7 +993,7 @@ The XS code, with ellipsis, follows.
char *host = "localhost";
CODE:
if( items > 1 )
- host = (char *)SvPV_nolen(ST(1));
+ host = (char *)SvPVbyte_nolen(ST(1));
RETVAL = rpcb_gettime( host, &timep );
OUTPUT:
timep
@@ -1289,7 +1294,7 @@ prototypes.
char *host = "localhost";
CODE:
if( items > 1 )
- host = (char *)SvPV_nolen(ST(1));
+ host = (char *)SvPVbyte_nolen(ST(1));
RETVAL = rpcb_gettime( host, &timep );
OUTPUT:
timep
@@ -1743,8 +1748,8 @@ example.
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
$var = ($type)SvIV((SV*)SvRV( $arg ));
else{
- warn("${Package}::$func_name() -- " .
- "$var is not a blessed SV reference");
+ warn(\"${Package}::$func_name() -- \"
+ \"$var is not a blessed SV reference\");
XSRETURN_UNDEF;
}
@@ -1980,6 +1985,8 @@ all the data that needs to be interpreter-local.
Always place the START_MY_CXT macro directly after the declaration
of C<my_cxt_t>.
+=for apidoc Amnh||START_MY_CXT
+
=item MY_CXT_INIT
The MY_CXT_INIT macro initializes storage for the C<my_cxt_t> struct.
@@ -1989,11 +1996,15 @@ are maintaining multiple interpreters, it should be called once in each
interpreter instance, except for interpreters cloned from existing ones.
(But see L</MY_CXT_CLONE> below.)
+=for apidoc Amnh||MY_CXT_INIT
+
=item dMY_CXT
Use the dMY_CXT macro (a declaration) in all the functions that access
MY_CXT.
+=for apidoc Amnh||dMY_CXT
+
=item MY_CXT
Use the MY_CXT macro to access members of the C<my_cxt_t> struct. For
@@ -2014,6 +2025,14 @@ C<dMY_CXT> may be quite expensive to calculate, and to avoid the overhead
of invoking it in each function it is possible to pass the declaration
onto other functions using the C<aMY_CXT>/C<pMY_CXT> macros, eg
+=for apidoc Amnh||_aMY_CXT
+=for apidoc Amnh||aMY_CXT
+=for apidoc Amnh||aMY_CXT_
+=for apidoc Amnh||_pMY_CXT
+=for apidoc Amnh||pMY_CXT
+=for apidoc Amnh||pMY_CXT_
+=for apidoc Amnh||MY_CXT
+
void sub1() {
dMY_CXT;
MY_CXT.index = 1;
@@ -2036,6 +2055,8 @@ my_cxt_t structure. Calling C<MY_CXT_CLONE> (typically via the package's
C<CLONE()> function), causes a byte-for-byte copy of the structure to be
taken, and any future dMY_CXT will cause the copy to be accessed instead.
+=for apidoc Amnh||MY_CXT_CLONE
+
=item MY_CXT_INIT_INTERP(my_perl)
=item dMY_CXT_INTERP(my_perl)
@@ -2082,7 +2103,8 @@ File C<RPC.xs>: Interface to some ONC+ RPC bind library functions.
#include "perl.h"
#include "XSUB.h"
- #include <rpc/rpc.h>
+ /* Note: On glibc 2.13 and earlier, this needs be <rpc/rpc.h> */
+ #include <tirpc/rpc.h>
typedef struct netconfig Netconfig;
@@ -2142,6 +2164,8 @@ File C<rpctest.pl>: Perl test program for the RPC extension.
print "time = $a\n";
print "netconf = $netconf\n";
+In Makefile.PL add -ltirpc and -I/usr/include/tirpc.
+
=head1 CAVEATS
XS code has full access to system calls including C library functions.
@@ -2252,7 +2276,7 @@ per-thread locales. Perl makes this transparent to perl-space code. It
continues to use C<POSIX::setlocale()>, and the interpreter translates
that into the per-thread functions.
-All other locale-senstive functions automatically use the per-thread
+All other locale-sensitive functions automatically use the per-thread
locale, if that is turned on, and failing that, the global locale. Thus
calls to C<setlocale> are ineffective on POSIX systems for the current
thread if that thread is using a per-thread locale. If perl is compiled
diff --git a/lib/perlxstut.pod b/lib/perlxstut.pod
index ef154ad..fcafa58 100644
--- a/lib/perlxstut.pod
+++ b/lib/perlxstut.pod
@@ -115,14 +115,15 @@ Mytest directory.
The file Makefile.PL should look something like this:
use ExtUtils::MakeMaker;
+
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
- NAME => 'Mytest',
- VERSION_FROM => 'Mytest.pm', # finds $VERSION
- LIBS => [''], # e.g., '-lm'
- DEFINE => '', # e.g., '-DHAVE_SOMETHING'
- INC => '', # e.g., '-I/usr/include/other'
+ NAME => 'Mytest',
+ VERSION_FROM => 'Mytest.pm', # finds $VERSION
+ LIBS => [''], # e.g., '-lm'
+ DEFINE => '', # e.g., '-DHAVE_SOMETHING'
+ INC => '-I', # e.g., '-I. -I/usr/include/other'
);
The file Mytest.pm should start with something like this:
@@ -276,9 +277,9 @@ when the test is correct, "not ok" when it is not.
# so read its man page ( perldoc Test::More ) for help writing this
# test script.
- is(&Mytest::is_even(0), 1);
- is(&Mytest::is_even(1), 0);
- is(&Mytest::is_even(2), 1);
+ is( Mytest::is_even(0), 1 );
+ is( Mytest::is_even(1), 0 );
+ is( Mytest::is_even(2), 1 );
We will be calling the test script through the command "C<make test>". You
should see output that looks something like this:
@@ -390,16 +391,32 @@ Add the following to the end of Mytest.xs:
Edit the Makefile.PL file so that the corresponding line looks like this:
- 'LIBS' => ['-lm'], # e.g., '-lm'
+ LIBS => ['-lm'], # e.g., '-lm'
Generate the Makefile and run make. Change the test number in Mytest.t to
"9" and add the following tests:
- $i = -1.5; &Mytest::round($i); is( $i, -2.0 );
- $i = -1.1; &Mytest::round($i); is( $i, -1.0 );
- $i = 0.0; &Mytest::round($i); is( $i, 0.0 );
- $i = 0.5; &Mytest::round($i); is( $i, 1.0 );
- $i = 1.2; &Mytest::round($i); is( $i, 1.0 );
+ my $i;
+
+ $i = -1.5;
+ Mytest::round($i);
+ is( $i, -2.0, 'Rounding -1.5 to -2.0' );
+
+ $i = -1.1;
+ Mytest::round($i);
+ is( $i, -1.0, 'Rounding -1.1 to -1.0' );
+
+ $i = 0.0;
+ Mytest::round($i);
+ is( $i, 0.0, 'Rounding 0.0 to 0.0' );
+
+ $i = 0.5;
+ Mytest::round($i);
+ is( $i, 1.0, 'Rounding 0.5 to 1.0' );
+
+ $i = 1.2;
+ Mytest::round($i);
+ is( $i, 1.0, 'Rounding 1.2 to 1.0' );
Running "C<make test>" should now print out that all nine tests are okay.
@@ -407,7 +424,7 @@ Notice that in these new test cases, the argument passed to round was a
scalar variable. You might be wondering if you can round a constant or
literal. To see what happens, temporarily add the following line to Mytest.t:
- &Mytest::round(3);
+ Mytest::round(3);
Run "C<make test>" and notice that Perl dies with a fatal error. Perl won't
let you change the value of constants!
@@ -534,7 +551,7 @@ In the mylib directory, create a file mylib.h that looks like this:
Also create a file mylib.c that looks like this:
#include <stdlib.h>
- #include "./mylib.h"
+ #include "mylib.h"
double
foo(int a, long b, const char *c)
@@ -547,9 +564,9 @@ And finally create a file Makefile.PL that looks like this:
use ExtUtils::MakeMaker;
$Verbose = 1;
WriteMakefile(
- NAME => 'Mytest2::mylib',
- SKIP => [qw(all static static_lib dynamic dynamic_lib)],
- clean => {'FILES' => 'libmylib$(LIB_EXT)'},
+ NAME => 'Mytest2::mylib',
+ SKIP => [qw(all static static_lib dynamic dynamic_lib)],
+ clean => {'FILES' => 'libmylib$(LIB_EXT)'},
);
@@ -576,7 +593,7 @@ on Win32 systems.
We will now create the main top-level Mytest2 files. Change to the directory
above Mytest2 and run the following command:
- % h2xs -O -n Mytest2 ./Mytest2/mylib/mylib.h
+ % h2xs -O -n Mytest2 Mytest2/mylib/mylib.h
This will print out a warning about overwriting Mytest2, but that's okay.
Our files are stored in Mytest2/mylib, and will be untouched.
@@ -587,12 +604,12 @@ will be generating a library in it. Let's add the argument MYEXTLIB to
the WriteMakefile call so that it looks like this:
WriteMakefile(
- 'NAME' => 'Mytest2',
- 'VERSION_FROM' => 'Mytest2.pm', # finds $VERSION
- 'LIBS' => [''], # e.g., '-lm'
- 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
- 'INC' => '', # e.g., '-I/usr/include/other'
- 'MYEXTLIB' => 'mylib/libmylib$(LIB_EXT)',
+ NAME => 'Mytest2',
+ VERSION_FROM => 'Mytest2.pm', # finds $VERSION
+ LIBS => [''], # e.g., '-lm'
+ DEFINE => '', # e.g., '-DHAVE_SOMETHING'
+ INC => '', # e.g., '-I/usr/include/other'
+ MYEXTLIB => 'mylib/libmylib$(LIB_EXT)',
);
and then at the end add a subroutine (which will override the pre-existing
@@ -606,9 +623,7 @@ with "cd"!
';
}
-Let's also fix the MANIFEST file so that it accurately reflects the contents
-of our extension. The single line that says "mylib" should be replaced by
-the following three lines:
+Let's also fix the MANIFEST file by appending the following three lines:
mylib/Makefile.PL
mylib/mylib.c
@@ -642,12 +657,12 @@ Now run perl on the top-level Makefile.PL. Notice that it also created a
Makefile in the mylib directory. Run make and watch that it does cd into
the mylib directory and run make in there as well.
-Now edit the Mytest2.t script and change the number of tests to "4",
+Now edit the Mytest2.t script and change the number of tests to "5",
and add the following lines to the end of the script:
- is( &Mytest2::foo(1, 2, "Hello, world!"), 7 );
- is( &Mytest2::foo(1, 2, "0.0"), 7 );
- ok( abs(&Mytest2::foo(0, 0, "-3.4") - 0.6) <= 0.01 );
+ is( Mytest2::foo( 1, 2, "Hello, world!" ), 7 );
+ is( Mytest2::foo( 1, 2, "0.0" ), 7 );
+ ok( abs( Mytest2::foo( 0, 0, "-3.4" ) - 0.6 ) <= 0.01 );
(When dealing with floating-point comparisons, it is best to not check for
equality, but rather that the difference between the expected and actual
@@ -707,7 +722,7 @@ commands to build it.
=head2 Anatomy of .xs file
-The .xs file of L<"EXAMPLE 4"> contained some new elements. To understand
+The .xs file of L</EXAMPLE 4> contained some new elements. To understand
the meaning of these elements, pay attention to the line which reads
MODULE = Mytest2 PACKAGE = Mytest2
@@ -737,7 +752,7 @@ somewhat of an exception rather than the rule.
=head2 Getting the fat out of XSUBs
-In L<"EXAMPLE 4"> the second part of .xs file contained the following
+In L</EXAMPLE 4> the second part of .xs file contained the following
description of an XSUB:
double
@@ -1017,9 +1032,12 @@ after the include of "XSUB.h":
Also add the following code segment to Mytest.t while incrementing the "9"
tests to "11":
- @a = &Mytest::statfs("/blech");
+ my @a;
+
+ @a = Mytest::statfs("/blech");
ok( scalar(@a) == 1 && $a[0] == 2 );
- @a = &Mytest::statfs("/");
+
+ @a = Mytest::statfs("/");
is( scalar(@a), 7 );
=head2 New Things in this Example
@@ -1125,7 +1143,8 @@ Mytest.xs:
for (n = 0; n <= numpaths; n++) {
HV * rh;
STRLEN l;
- char * fn = SvPV(*av_fetch((AV *)SvRV(paths), n, 0), l);
+ SV * path = *av_fetch((AV *)SvRV(paths), n, 0);
+ char * fn = SvPVbyte(path, l);
i = statfs(fn, &buf);
if (i != 0) {
@@ -1152,7 +1171,7 @@ Mytest.xs:
And add the following code to Mytest.t, while incrementing the "11"
tests to "13":
- $results = Mytest::multi_statfs([ '/', '/blech' ]);
+ my $results = Mytest::multi_statfs([ '/', '/blech' ]);
ok( ref $results->[0] );
ok( ! ref $results->[1] );
@@ -1246,21 +1265,24 @@ typeglobs and stuff. Well, it isn't.
Suppose that for some strange reason we need a wrapper around the
standard C library function C<fputs()>. This is all we need:
- #define PERLIO_NOT_STDIO 0
- #define PERL_NO_GET_CONTEXT
- #include "EXTERN.h"
- #include "perl.h"
- #include "XSUB.h"
+ #define PERLIO_NOT_STDIO 0 /* For co-existence with stdio only */
+ #define PERL_NO_GET_CONTEXT /* This is more efficient */
+ #include "EXTERN.h"
+ #include "perl.h"
+ #include "XSUB.h"
- #include <stdio.h>
+ #include <stdio.h>
- int
- fputs(s, stream)
- char * s
- FILE * stream
+ int
+ fputs(s, stream)
+ char * s
+ FILE * stream
The real work is done in the standard typemap.
+For more details, see
+L<perlapio/"Co-existence with stdio">.
+
B<But> you lose all the fine stuff done by the perlio layers. This
calls the stdio function C<fputs()>, which knows nothing about them.
@@ -1382,7 +1404,7 @@ Some systems may have installed Perl version 5 as "perl5".
=head1 See also
For more information, consult L<perlguts>, L<perlapi>, L<perlxs>, L<perlmod>,
-and L<perlpod>.
+L<perlapio>, and L<perlpod>
=head1 Author
@@ -1396,6 +1418,8 @@ by Nick Ing-Simmons.
Changes for h2xs as of Perl 5.8.x by Renee Baecker
+This document is now maintained as part of Perl itself.
+
=head2 Last Changed
-2012-01-20
+2020-10-05
diff --git a/t/001-basic.t b/t/001-basic.t
index 04ba981..6651809 100644
--- a/t/001-basic.t
+++ b/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);
@@ -15,13 +17,14 @@ push @INC, '.';
use Carp; $SIG{__WARN__} = \&Carp::cluck;
-# Some trickery for Android. If we leave @INC as-is, it'll have '.' in it.
-# Later on, the 'require XSTest' end up in DynaLoader looking for
-# ./PL_XSTest.so, but unless our current directory happens to be in
-# LD_LIBRARY_PATH, Android's linker will never find the file, and the test
-# will fail. Instead, if we have all absolute paths, it'll just work.
-@INC = map { File::Spec->rel2abs($_) } @INC
- if $^O =~ /android/;
+# The linker on some platforms doesn't like loading libraries using relative
+# paths. Android won't find relative paths, and system perl on macOS will
+# refuse to load relative paths. The path that DynaLoader uses to load the
+# .so or .bundle file is based on the @INC path that the library is loaded
+# from. The XSTest module we're using for testing is in the current directory,
+# so we need an absolute path in @INC rather than '.'. Just convert all of the
+# paths to absolute for simplicity.
+@INC = map { File::Spec->rel2abs($_) } @INC;
#########################
@@ -177,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/t/002-more.t b/t/002-more.t
index e982290..3ea89c2 100644
--- a/t/002-more.t
+++ b/t/002-more.t
@@ -22,8 +22,7 @@ push @INC, '.';
use Carp; $SIG{__WARN__} = \&Carp::cluck;
# See the comments about this in 001-basics.t
-@INC = map { File::Spec->rel2abs($_) } @INC
- if $^O =~ /android/;
+@INC = map { File::Spec->rel2abs($_) } @INC;
#########################
diff --git a/t/003-usage.t b/t/003-usage.t
index 00dfe0b..52b9903 100644
--- a/t/003-usage.t
+++ b/t/003-usage.t
@@ -23,8 +23,7 @@ push @INC, '.';
use Carp; $SIG{__WARN__} = \&Carp::cluck;
# See the comments about this in 001-basics.t
-@INC = map { File::Spec->rel2abs($_) } @INC
- if $^O =~ /android/;
+@INC = map { File::Spec->rel2abs($_) } @INC;
#########################
diff --git a/t/XSBroken.xs b/t/XSBroken.xs
new file mode 100644
index 0000000..7913838
--- /dev/null
+++ b/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
--
2.30.2

View File

@ -1,240 +1,23 @@
From c85261a4cef59150c379ff88a21d0f9ca6374dc2 Mon Sep 17 00:00:00 2001
From bd2b15a246ebcb8cee2c060b18f9157481a084f9 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Thu, 24 May 2018 09:57:37 +0200
Subject: [PATCH] Upgrade to 3.39
Date: Fri, 7 Jan 2022 11:03:48 +0100
Subject: [PATCH] Add perlxs* man pages
---
Changes | 6 +
lib/ExtUtils/ParseXS.pm | 14 +-
lib/ExtUtils/ParseXS/Constants.pm | 2 +-
lib/ExtUtils/ParseXS/CountLines.pm | 2 +-
lib/ExtUtils/ParseXS/Eval.pm | 6 +-
lib/ExtUtils/ParseXS/Utilities.pm | 2 +-
lib/ExtUtils/Typemaps.pm | 6 +-
lib/ExtUtils/Typemaps/Cmd.pm | 2 +-
lib/ExtUtils/Typemaps/InputMap.pm | 2 +-
lib/ExtUtils/Typemaps/OutputMap.pm | 2 +-
lib/ExtUtils/Typemaps/Type.pm | 2 +-
lib/perlxs.pod | 2354 ++++++++++++++++++++++++++++++++++++
lib/perlxstut.pod | 1401 +++++++++++++++++++++
lib/perlxstypemap.pod | 711 +++++++++++
t/XSTest.xs | 1 +
t/XSUsage.xs | 2 +
16 files changed, 4497 insertions(+), 18 deletions(-)
lib/perlxs.pod | 2378 +++++++++++++++++++++++++++++++++++++++++
lib/perlxstut.pod | 1425 ++++++++++++++++++++++++
lib/perlxstypemap.pod | 711 ++++++++++++
3 files changed, 4514 insertions(+)
create mode 100644 lib/perlxs.pod
create mode 100644 lib/perlxstut.pod
create mode 100644 lib/perlxstypemap.pod
diff --git a/Changes b/Changes
index 0181371..f9fb36e 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
Revision history for Perl extension ExtUtils::ParseXS.
+3.36
+ - Make generated code avoid warnings about the "items" variable
+ being unused
+ - Avoid some unused-variable warnings generated by XS code in the
+ test suite
+
3.35 - Mon Jul 31 17:50:00 CET 2017
- Fix ExtUtils-ParseXS/t/*.t that needed '.' in @INC (David Mitchell)
- Remove impediment to compiling under C++11 (Karl Williamson)
diff --git a/lib/ExtUtils/ParseXS.pm b/lib/ExtUtils/ParseXS.pm
index d629cf6..e1f0940 100644
--- a/lib/ExtUtils/ParseXS.pm
+++ b/lib/ExtUtils/ParseXS.pm
@@ -11,12 +11,12 @@ use Symbol;
our $VERSION;
BEGIN {
- $VERSION = '3.35';
+ $VERSION = '3.39';
+ require ExtUtils::ParseXS::Constants; ExtUtils::ParseXS::Constants->VERSION($VERSION);
+ require ExtUtils::ParseXS::CountLines; ExtUtils::ParseXS::CountLines->VERSION($VERSION);
+ require ExtUtils::ParseXS::Utilities; ExtUtils::ParseXS::Utilities->VERSION($VERSION);
+ require ExtUtils::ParseXS::Eval; ExtUtils::ParseXS::Eval->VERSION($VERSION);
}
-use ExtUtils::ParseXS::Constants $VERSION;
-use ExtUtils::ParseXS::CountLines $VERSION;
-use ExtUtils::ParseXS::Utilities $VERSION;
-use ExtUtils::ParseXS::Eval $VERSION;
$VERSION = eval $VERSION if $VERSION =~ /_/;
use ExtUtils::ParseXS::Utilities qw(
@@ -519,9 +519,10 @@ EOF
EOF
}
else {
- # cv likely to be unused
+ # cv and items likely to be unused
print Q(<<"EOF");
# PERL_UNUSED_VAR(cv); /* -W */
+# PERL_UNUSED_VAR(items); /* -W */
EOF
}
@@ -871,6 +872,7 @@ EOF
#XS_EUPXS(XS_$self->{Packid}_nil)
#{
# dXSARGS;
+# PERL_UNUSED_VAR(items);
# XSRETURN_EMPTY;
#}
#
diff --git a/lib/ExtUtils/ParseXS/Constants.pm b/lib/ExtUtils/ParseXS/Constants.pm
index 2150fb8..45b5674 100644
--- a/lib/ExtUtils/ParseXS/Constants.pm
+++ b/lib/ExtUtils/ParseXS/Constants.pm
@@ -3,7 +3,7 @@ use strict;
use warnings;
use Symbol;
-our $VERSION = '3.35';
+our $VERSION = '3.39';
=head1 NAME
diff --git a/lib/ExtUtils/ParseXS/CountLines.pm b/lib/ExtUtils/ParseXS/CountLines.pm
index ad86b57..5b48449 100644
--- a/lib/ExtUtils/ParseXS/CountLines.pm
+++ b/lib/ExtUtils/ParseXS/CountLines.pm
@@ -1,7 +1,7 @@
package ExtUtils::ParseXS::CountLines;
use strict;
-our $VERSION = '3.35';
+our $VERSION = '3.39';
our $SECTION_END_MARKER;
diff --git a/lib/ExtUtils/ParseXS/Eval.pm b/lib/ExtUtils/ParseXS/Eval.pm
index 6b06bf5..9eba5e5 100644
--- a/lib/ExtUtils/ParseXS/Eval.pm
+++ b/lib/ExtUtils/ParseXS/Eval.pm
@@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Eval;
use strict;
use warnings;
-our $VERSION = '3.35';
+our $VERSION = '3.39';
=head1 NAME
@@ -29,7 +29,7 @@ Warns the contents of C<$@> if any.
Not all these variables are necessarily considered "public" wrt. use in
typemaps, so beware. Variables set up from the ExtUtils::ParseXS object:
- $Package $Alias $func_name $Full_func_name $pname
+ $Package $ALIAS $func_name $Full_func_name $pname
Variables set up from C<$other_hashref>:
@@ -63,7 +63,7 @@ Warns the contents of C<$@> if any.
Not all these variables are necessarily considered "public" wrt. use in
typemaps, so beware. Variables set up from the ExtUtils::ParseXS object:
- $Package $Alias $func_name $Full_func_name $pname
+ $Package $ALIAS $func_name $Full_func_name $pname
Variables set up from C<$other_hashref>:
diff --git a/lib/ExtUtils/ParseXS/Utilities.pm b/lib/ExtUtils/ParseXS/Utilities.pm
index bc1e098..ae25b33 100644
--- a/lib/ExtUtils/ParseXS/Utilities.pm
+++ b/lib/ExtUtils/ParseXS/Utilities.pm
@@ -5,7 +5,7 @@ use Exporter;
use File::Spec;
use ExtUtils::ParseXS::Constants ();
-our $VERSION = '3.35';
+our $VERSION = '3.39';
our (@ISA, @EXPORT_OK);
@ISA = qw(Exporter);
diff --git a/lib/ExtUtils/Typemaps.pm b/lib/ExtUtils/Typemaps.pm
index 992d15b..a762322 100644
--- a/lib/ExtUtils/Typemaps.pm
+++ b/lib/ExtUtils/Typemaps.pm
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.35';
+our $VERSION = '3.38';
require ExtUtils::ParseXS;
require ExtUtils::ParseXS::Constants;
@@ -781,7 +781,9 @@ corresponding OUTPUT code:
$var.context.value().size());
',
'T_OUT' => ' {
- GV *gv = newGVgen("$Package");
+ GV *gv = (GV *)sv_newmortal();
+ gv_init_pvn(gv, gv_stashpvs("$Package",1),
+ "__ANONIO__",10,0);
if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) )
sv_setsv(
$arg,
diff --git a/lib/ExtUtils/Typemaps/Cmd.pm b/lib/ExtUtils/Typemaps/Cmd.pm
index 7ff0780..3c33f54 100644
--- a/lib/ExtUtils/Typemaps/Cmd.pm
+++ b/lib/ExtUtils/Typemaps/Cmd.pm
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::Cmd;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.35';
+our $VERSION = '3.38';
use ExtUtils::Typemaps;
diff --git a/lib/ExtUtils/Typemaps/InputMap.pm b/lib/ExtUtils/Typemaps/InputMap.pm
index b626973..bf19df1 100644
--- a/lib/ExtUtils/Typemaps/InputMap.pm
+++ b/lib/ExtUtils/Typemaps/InputMap.pm
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::InputMap;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.35';
+our $VERSION = '3.38';
=head1 NAME
diff --git a/lib/ExtUtils/Typemaps/OutputMap.pm b/lib/ExtUtils/Typemaps/OutputMap.pm
index 8c72e5b..90adb48 100644
--- a/lib/ExtUtils/Typemaps/OutputMap.pm
+++ b/lib/ExtUtils/Typemaps/OutputMap.pm
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::OutputMap;
use 5.006001;
use strict;
use warnings;
-our $VERSION = '3.35';
+our $VERSION = '3.38';
=head1 NAME
diff --git a/lib/ExtUtils/Typemaps/Type.pm b/lib/ExtUtils/Typemaps/Type.pm
index 7909bbe..01bd51d 100644
--- a/lib/ExtUtils/Typemaps/Type.pm
+++ b/lib/ExtUtils/Typemaps/Type.pm
@@ -4,7 +4,7 @@ use strict;
use warnings;
require ExtUtils::Typemaps;
-our $VERSION = '3.35';
+our $VERSION = '3.38';
=head1 NAME
diff --git a/lib/perlxs.pod b/lib/perlxs.pod
new file mode 100644
index 0000000..1419ee0
index 0000000..f1bd408
--- /dev/null
+++ b/lib/perlxs.pod
@@ -0,0 +1,2354 @@
@@ -0,0 +1,2378 @@
+=head1 NAME
+
+perlxs - XS language reference manual
@ -259,8 +42,8 @@ index 0000000..1419ee0
+calling conventions.
+
+The glue code pulls the arguments from the Perl stack, converts these
+Perl values to the formats expected by a C function, call this C function,
+transfers the return values of the C function back to Perl.
+Perl values to the formats expected by a C function, calls this C function,
+and then transfers the return values of the C function back to Perl.
+Return values here may be a conventional C return value or any C
+function arguments that may serve as output parameters. These return
+values may be passed back to Perl either by putting them on the
@ -316,6 +99,11 @@ index 0000000..1419ee0
+significantly more convenient mechanism for creating the extension
+glue code. See L<http://www.swig.org/> for more information.
+
+For simple bindings to C libraries as well as other machine code libraries,
+consider instead using the much simpler
+L<libffi|http://sourceware.org/libffi/> interface via CPAN modules like
+L<FFI::Platypus> or L<FFI::Raw>.
+
+=head2 On The Road
+
+Many of the examples which follow will concentrate on creating an interface
@ -431,7 +219,7 @@ index 0000000..1419ee0
+ bool make_char_uppercase(char *c);
+
+are used in absolutely incompatible manner. Parameters to these functions
+could be described B<xsubpp> like this:
+could be described to B<xsubpp> like this:
+
+ char * s
+ char &c
@ -835,7 +623,7 @@ index 0000000..1419ee0
+
+ bool_t
+ rpcb_gettime(host,timep)
+ char *host = (char *)SvPV_nolen($arg);
+ char *host = (char *)SvPVbyte_nolen($arg);
+ time_t &timep = 0;
+ OUTPUT:
+ timep
@ -862,7 +650,7 @@ index 0000000..1419ee0
+ bool_t
+ rpcb_gettime(host,timep)
+ time_t &timep; /* \$v{timep}=@{[$v{timep}=$arg]} */
+ char *host + SvOK($v{timep}) ? SvPV_nolen($arg) : NULL;
+ char *host + SvOK($v{timep}) ? SvPVbyte_nolen($arg) : NULL;
+ OUTPUT:
+ timep
+
@ -1225,7 +1013,7 @@ index 0000000..1419ee0
+ char *host = "localhost";
+ CODE:
+ if( items > 1 )
+ host = (char *)SvPV_nolen(ST(1));
+ host = (char *)SvPVbyte_nolen(ST(1));
+ RETVAL = rpcb_gettime( host, &timep );
+ OUTPUT:
+ timep
@ -1526,7 +1314,7 @@ index 0000000..1419ee0
+ char *host = "localhost";
+ CODE:
+ if( items > 1 )
+ host = (char *)SvPV_nolen(ST(1));
+ host = (char *)SvPVbyte_nolen(ST(1));
+ RETVAL = rpcb_gettime( host, &timep );
+ OUTPUT:
+ timep
@ -1980,8 +1768,8 @@ index 0000000..1419ee0
+ if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
+ $var = ($type)SvIV((SV*)SvRV( $arg ));
+ else{
+ warn("${Package}::$func_name() -- " .
+ "$var is not a blessed SV reference");
+ warn(\"${Package}::$func_name() -- \"
+ \"$var is not a blessed SV reference\");
+ XSRETURN_UNDEF;
+ }
+
@ -2217,6 +2005,8 @@ index 0000000..1419ee0
+Always place the START_MY_CXT macro directly after the declaration
+of C<my_cxt_t>.
+
+=for apidoc Amnh||START_MY_CXT
+
+=item MY_CXT_INIT
+
+The MY_CXT_INIT macro initializes storage for the C<my_cxt_t> struct.
@ -2226,11 +2016,15 @@ index 0000000..1419ee0
+interpreter instance, except for interpreters cloned from existing ones.
+(But see L</MY_CXT_CLONE> below.)
+
+=for apidoc Amnh||MY_CXT_INIT
+
+=item dMY_CXT
+
+Use the dMY_CXT macro (a declaration) in all the functions that access
+MY_CXT.
+
+=for apidoc Amnh||dMY_CXT
+
+=item MY_CXT
+
+Use the MY_CXT macro to access members of the C<my_cxt_t> struct. For
@ -2251,6 +2045,14 @@ index 0000000..1419ee0
+of invoking it in each function it is possible to pass the declaration
+onto other functions using the C<aMY_CXT>/C<pMY_CXT> macros, eg
+
+=for apidoc Amnh||_aMY_CXT
+=for apidoc Amnh||aMY_CXT
+=for apidoc Amnh||aMY_CXT_
+=for apidoc Amnh||_pMY_CXT
+=for apidoc Amnh||pMY_CXT
+=for apidoc Amnh||pMY_CXT_
+=for apidoc Amnh||MY_CXT
+
+ void sub1() {
+ dMY_CXT;
+ MY_CXT.index = 1;
@ -2273,6 +2075,8 @@ index 0000000..1419ee0
+C<CLONE()> function), causes a byte-for-byte copy of the structure to be
+taken, and any future dMY_CXT will cause the copy to be accessed instead.
+
+=for apidoc Amnh||MY_CXT_CLONE
+
+=item MY_CXT_INIT_INTERP(my_perl)
+
+=item dMY_CXT_INTERP(my_perl)
@ -2319,7 +2123,8 @@ index 0000000..1419ee0
+ #include "perl.h"
+ #include "XSUB.h"
+
+ #include <rpc/rpc.h>
+ /* Note: On glibc 2.13 and earlier, this needs be <rpc/rpc.h> */
+ #include <tirpc/rpc.h>
+
+ typedef struct netconfig Netconfig;
+
@ -2379,6 +2184,8 @@ index 0000000..1419ee0
+ print "time = $a\n";
+ print "netconf = $netconf\n";
+
+In Makefile.PL add -ltirpc and -I/usr/include/tirpc.
+
+=head1 CAVEATS
+
+XS code has full access to system calls including C library functions.
@ -2489,7 +2296,7 @@ index 0000000..1419ee0
+continues to use C<POSIX::setlocale()>, and the interpreter translates
+that into the per-thread functions.
+
+All other locale-senstive functions automatically use the per-thread
+All other locale-sensitive functions automatically use the per-thread
+locale, if that is turned on, and failing that, the global locale. Thus
+calls to C<setlocale> are ineffective on POSIX systems for the current
+thread if that thread is using a per-thread locale. If perl is compiled
@ -2588,13 +2395,13 @@ index 0000000..1419ee0
+
+Originally written by Dean Roehrich <F<roehrich@cray.com>>.
+
+Maintained since 1996 by The Perl Porters <F<perlbug@perl.org>>.
+Maintained since 1996 by The Perl Porters <F<perl5-porters@perl.org>>.
diff --git a/lib/perlxstut.pod b/lib/perlxstut.pod
new file mode 100644
index 0000000..ef154ad
index 0000000..fcafa58
--- /dev/null
+++ b/lib/perlxstut.pod
@@ -0,0 +1,1401 @@
@@ -0,0 +1,1425 @@
+=head1 NAME
+
+perlxstut - Tutorial for writing XSUBs
@ -2712,14 +2519,15 @@ index 0000000..ef154ad
+The file Makefile.PL should look something like this:
+
+ use ExtUtils::MakeMaker;
+
+ # See lib/ExtUtils/MakeMaker.pm for details of how to influence
+ # the contents of the Makefile that is written.
+ WriteMakefile(
+ NAME => 'Mytest',
+ VERSION_FROM => 'Mytest.pm', # finds $VERSION
+ LIBS => [''], # e.g., '-lm'
+ DEFINE => '', # e.g., '-DHAVE_SOMETHING'
+ INC => '', # e.g., '-I/usr/include/other'
+ NAME => 'Mytest',
+ VERSION_FROM => 'Mytest.pm', # finds $VERSION
+ LIBS => [''], # e.g., '-lm'
+ DEFINE => '', # e.g., '-DHAVE_SOMETHING'
+ INC => '-I', # e.g., '-I. -I/usr/include/other'
+ );
+
+The file Mytest.pm should start with something like this:
@ -2873,9 +2681,9 @@ index 0000000..ef154ad
+ # so read its man page ( perldoc Test::More ) for help writing this
+ # test script.
+
+ is(&Mytest::is_even(0), 1);
+ is(&Mytest::is_even(1), 0);
+ is(&Mytest::is_even(2), 1);
+ is( Mytest::is_even(0), 1 );
+ is( Mytest::is_even(1), 0 );
+ is( Mytest::is_even(2), 1 );
+
+We will be calling the test script through the command "C<make test>". You
+should see output that looks something like this:
@ -2987,16 +2795,32 @@ index 0000000..ef154ad
+
+Edit the Makefile.PL file so that the corresponding line looks like this:
+
+ 'LIBS' => ['-lm'], # e.g., '-lm'
+ LIBS => ['-lm'], # e.g., '-lm'
+
+Generate the Makefile and run make. Change the test number in Mytest.t to
+"9" and add the following tests:
+
+ $i = -1.5; &Mytest::round($i); is( $i, -2.0 );
+ $i = -1.1; &Mytest::round($i); is( $i, -1.0 );
+ $i = 0.0; &Mytest::round($i); is( $i, 0.0 );
+ $i = 0.5; &Mytest::round($i); is( $i, 1.0 );
+ $i = 1.2; &Mytest::round($i); is( $i, 1.0 );
+ my $i;
+
+ $i = -1.5;
+ Mytest::round($i);
+ is( $i, -2.0, 'Rounding -1.5 to -2.0' );
+
+ $i = -1.1;
+ Mytest::round($i);
+ is( $i, -1.0, 'Rounding -1.1 to -1.0' );
+
+ $i = 0.0;
+ Mytest::round($i);
+ is( $i, 0.0, 'Rounding 0.0 to 0.0' );
+
+ $i = 0.5;
+ Mytest::round($i);
+ is( $i, 1.0, 'Rounding 0.5 to 1.0' );
+
+ $i = 1.2;
+ Mytest::round($i);
+ is( $i, 1.0, 'Rounding 1.2 to 1.0' );
+
+Running "C<make test>" should now print out that all nine tests are okay.
+
@ -3004,7 +2828,7 @@ index 0000000..ef154ad
+scalar variable. You might be wondering if you can round a constant or
+literal. To see what happens, temporarily add the following line to Mytest.t:
+
+ &Mytest::round(3);
+ Mytest::round(3);
+
+Run "C<make test>" and notice that Perl dies with a fatal error. Perl won't
+let you change the value of constants!
@ -3131,7 +2955,7 @@ index 0000000..ef154ad
+Also create a file mylib.c that looks like this:
+
+ #include <stdlib.h>
+ #include "./mylib.h"
+ #include "mylib.h"
+
+ double
+ foo(int a, long b, const char *c)
@ -3144,9 +2968,9 @@ index 0000000..ef154ad
+ use ExtUtils::MakeMaker;
+ $Verbose = 1;
+ WriteMakefile(
+ NAME => 'Mytest2::mylib',
+ SKIP => [qw(all static static_lib dynamic dynamic_lib)],
+ clean => {'FILES' => 'libmylib$(LIB_EXT)'},
+ NAME => 'Mytest2::mylib',
+ SKIP => [qw(all static static_lib dynamic dynamic_lib)],
+ clean => {'FILES' => 'libmylib$(LIB_EXT)'},
+ );
+
+
@ -3173,7 +2997,7 @@ index 0000000..ef154ad
+We will now create the main top-level Mytest2 files. Change to the directory
+above Mytest2 and run the following command:
+
+ % h2xs -O -n Mytest2 ./Mytest2/mylib/mylib.h
+ % h2xs -O -n Mytest2 Mytest2/mylib/mylib.h
+
+This will print out a warning about overwriting Mytest2, but that's okay.
+Our files are stored in Mytest2/mylib, and will be untouched.
@ -3184,12 +3008,12 @@ index 0000000..ef154ad
+the WriteMakefile call so that it looks like this:
+
+ WriteMakefile(
+ 'NAME' => 'Mytest2',
+ 'VERSION_FROM' => 'Mytest2.pm', # finds $VERSION
+ 'LIBS' => [''], # e.g., '-lm'
+ 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
+ 'INC' => '', # e.g., '-I/usr/include/other'
+ 'MYEXTLIB' => 'mylib/libmylib$(LIB_EXT)',
+ NAME => 'Mytest2',
+ VERSION_FROM => 'Mytest2.pm', # finds $VERSION
+ LIBS => [''], # e.g., '-lm'
+ DEFINE => '', # e.g., '-DHAVE_SOMETHING'
+ INC => '', # e.g., '-I/usr/include/other'
+ MYEXTLIB => 'mylib/libmylib$(LIB_EXT)',
+ );
+
+and then at the end add a subroutine (which will override the pre-existing
@ -3203,9 +3027,7 @@ index 0000000..ef154ad
+ ';
+ }
+
+Let's also fix the MANIFEST file so that it accurately reflects the contents
+of our extension. The single line that says "mylib" should be replaced by
+the following three lines:
+Let's also fix the MANIFEST file by appending the following three lines:
+
+ mylib/Makefile.PL
+ mylib/mylib.c
@ -3239,12 +3061,12 @@ index 0000000..ef154ad
+Makefile in the mylib directory. Run make and watch that it does cd into
+the mylib directory and run make in there as well.
+
+Now edit the Mytest2.t script and change the number of tests to "4",
+Now edit the Mytest2.t script and change the number of tests to "5",
+and add the following lines to the end of the script:
+
+ is( &Mytest2::foo(1, 2, "Hello, world!"), 7 );
+ is( &Mytest2::foo(1, 2, "0.0"), 7 );
+ ok( abs(&Mytest2::foo(0, 0, "-3.4") - 0.6) <= 0.01 );
+ is( Mytest2::foo( 1, 2, "Hello, world!" ), 7 );
+ is( Mytest2::foo( 1, 2, "0.0" ), 7 );
+ ok( abs( Mytest2::foo( 0, 0, "-3.4" ) - 0.6 ) <= 0.01 );
+
+(When dealing with floating-point comparisons, it is best to not check for
+equality, but rather that the difference between the expected and actual
@ -3304,7 +3126,7 @@ index 0000000..ef154ad
+
+=head2 Anatomy of .xs file
+
+The .xs file of L<"EXAMPLE 4"> contained some new elements. To understand
+The .xs file of L</EXAMPLE 4> contained some new elements. To understand
+the meaning of these elements, pay attention to the line which reads
+
+ MODULE = Mytest2 PACKAGE = Mytest2
@ -3334,7 +3156,7 @@ index 0000000..ef154ad
+
+=head2 Getting the fat out of XSUBs
+
+In L<"EXAMPLE 4"> the second part of .xs file contained the following
+In L</EXAMPLE 4> the second part of .xs file contained the following
+description of an XSUB:
+
+ double
@ -3614,9 +3436,12 @@ index 0000000..ef154ad
+Also add the following code segment to Mytest.t while incrementing the "9"
+tests to "11":
+
+ @a = &Mytest::statfs("/blech");
+ my @a;
+
+ @a = Mytest::statfs("/blech");
+ ok( scalar(@a) == 1 && $a[0] == 2 );
+ @a = &Mytest::statfs("/");
+
+ @a = Mytest::statfs("/");
+ is( scalar(@a), 7 );
+
+=head2 New Things in this Example
@ -3722,7 +3547,8 @@ index 0000000..ef154ad
+ for (n = 0; n <= numpaths; n++) {
+ HV * rh;
+ STRLEN l;
+ char * fn = SvPV(*av_fetch((AV *)SvRV(paths), n, 0), l);
+ SV * path = *av_fetch((AV *)SvRV(paths), n, 0);
+ char * fn = SvPVbyte(path, l);
+
+ i = statfs(fn, &buf);
+ if (i != 0) {
@ -3749,7 +3575,7 @@ index 0000000..ef154ad
+And add the following code to Mytest.t, while incrementing the "11"
+tests to "13":
+
+ $results = Mytest::multi_statfs([ '/', '/blech' ]);
+ my $results = Mytest::multi_statfs([ '/', '/blech' ]);
+ ok( ref $results->[0] );
+ ok( ! ref $results->[1] );
+
@ -3843,21 +3669,24 @@ index 0000000..ef154ad
+Suppose that for some strange reason we need a wrapper around the
+standard C library function C<fputs()>. This is all we need:
+
+ #define PERLIO_NOT_STDIO 0
+ #define PERL_NO_GET_CONTEXT
+ #include "EXTERN.h"
+ #include "perl.h"
+ #include "XSUB.h"
+ #define PERLIO_NOT_STDIO 0 /* For co-existence with stdio only */
+ #define PERL_NO_GET_CONTEXT /* This is more efficient */
+ #include "EXTERN.h"
+ #include "perl.h"
+ #include "XSUB.h"
+
+ #include <stdio.h>
+ #include <stdio.h>
+
+ int
+ fputs(s, stream)
+ char * s
+ FILE * stream
+ int
+ fputs(s, stream)
+ char * s
+ FILE * stream
+
+The real work is done in the standard typemap.
+
+For more details, see
+L<perlapio/"Co-existence with stdio">.
+
+B<But> you lose all the fine stuff done by the perlio layers. This
+calls the stdio function C<fputs()>, which knows nothing about them.
+
@ -3979,7 +3808,7 @@ index 0000000..ef154ad
+=head1 See also
+
+For more information, consult L<perlguts>, L<perlapi>, L<perlxs>, L<perlmod>,
+and L<perlpod>.
+L<perlapio>, and L<perlpod>
+
+=head1 Author
+
@ -3993,9 +3822,11 @@ index 0000000..ef154ad
+
+Changes for h2xs as of Perl 5.8.x by Renee Baecker
+
+This document is now maintained as part of Perl itself.
+
+=head2 Last Changed
+
+2012-01-20
+2020-10-05
diff --git a/lib/perlxstypemap.pod b/lib/perlxstypemap.pod
new file mode 100644
index 0000000..7d1f73c
@ -4713,31 +4544,6 @@ index 0000000..7d1f73c
+
+=back
+
diff --git a/t/XSTest.xs b/t/XSTest.xs
index 89df22f..452d3db 100644
--- a/t/XSTest.xs
+++ b/t/XSTest.xs
@@ -76,6 +76,7 @@ bool
T_BOOL_2(in)
bool in
CODE:
+ PERL_UNUSED_VAR(RETVAL);
OUTPUT: in
void
diff --git a/t/XSUsage.xs b/t/XSUsage.xs
index 9a8d93d..ed3c8f8 100644
--- a/t/XSUsage.xs
+++ b/t/XSUsage.xs
@@ -35,6 +35,8 @@ xsusage_two()
ALIAS:
two_x = 1
FOO::two = 2
+ INIT:
+ PERL_UNUSED_VAR(ix);
int
interface_v_i()
--
2.14.3
2.31.1

View File

@ -1,21 +1,15 @@
%global base_version 3.35
%global base_version 3.44
Name: perl-ExtUtils-ParseXS
# Epoch to compete with perl.spec
Epoch: 1
Version: 3.43
Release: 478%{?dist}
Version: 3.44
Release: 1%{?dist}
Summary: Module and a script for converting Perl XS code into C code
License: GPL+ or Artistic
URL: https://metacpan.org/release/ExtUtils-ParseXS
Source0: https://cpan.metacpan.org/authors/id/S/SM/SMUELLER/ExtUtils-ParseXS-%{base_version}.tar.gz
# Unbundled from perl 5.28.0-RC1
Patch0: ExtUtils-ParseXS-3.35-Upgrade-to-3.39.patch
# Unbundled from perl 5.29.10
# Fix generating Perl prototypes for XS functions with OUTLIST parameters,
# RT#133654
Patch1: ExtUtils-ParseXS-3.39-Upgrade-to-3.40.patch
# Unbundled from perl 5.34.0
Patch2: ExtUtils-ParseXS-3.40-Upgrade-to-3.43.patch
Source0: https://cpan.metacpan.org/authors/id/X/XS/XSAWYERX/ExtUtils-ParseXS-%{base_version}.tar.gz
# Added man page perlxs* which are missing in tarball
Patch0: ExtUtils-ParseXS-3.44-Add-perlxs-man-pages.patch
BuildArch: noarch
BuildRequires: coreutils
BuildRequires: make
@ -58,8 +52,6 @@ the glue necessary to let Perl access those functions.
%prep
%setup -q -n ExtUtils-ParseXS-%{base_version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
@ -76,13 +68,16 @@ ln -s ../../../../bin/xsubpp $RPM_BUILD_ROOT%{perl_vendorlib}/ExtUtils/
make test
%files
%doc Changes README
%doc Changes
%{_bindir}/*
%{perl_vendorlib}/*
%{_mandir}/man1/*
%{_mandir}/man3/*
%changelog
* Fri Jan 07 2022 Jitka Plesnikova <jplesnik@redhat.com> - 1:3.44-1
- 3.44 bump
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.43-478
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (ExtUtils-ParseXS-3.35.tar.gz) = 90862ecb97f19066a4564be1788bd061c5835abb440fbea2cad43c903e912a7864453ef61c2c384566a4fe6536783f480938c4460b63879734a2d74372a956b8
SHA512 (ExtUtils-ParseXS-3.44.tar.gz) = 0a3c155bb5718814c97784c83b4a108fdd72153605f733fafb1a61c1e626f2454584f3baefc5d3a490280226e5a240e4cb95453bae3f609511d96750fcfc7389