perl/perl-ExtUtils-ParseXS-2.2206.patch
2011-01-26 16:21:17 -05:00

357 lines
11 KiB
Diff

diff -up perl-5.12.3/cpan/ExtUtils-ParseXS/Changes.22206 perl-5.12.3/cpan/ExtUtils-ParseXS/Changes
--- perl-5.12.3/cpan/ExtUtils-ParseXS/Changes.22206 2011-01-09 15:20:53.000000000 -0500
+++ perl-5.12.3/cpan/ExtUtils-ParseXS/Changes 2011-01-26 16:15:45.072549003 -0500
@@ -1,5 +1,73 @@
Revision history for Perl extension ExtUtils::ParseXS.
+2.2206 - Sun Jul 4 15:43:21 EDT 2010
+
+ Bug fixes:
+
+ - Make xsubpp accept the _ prototype (RT#57157) [Rafael Garcia-Suarez]
+
+ - INCLUDE_COMMAND portability fixes for VMS (RT#58181) [Craig Berry]
+
+ - INCLUDE_COMMAND fixes to detect non-zero exit codes (RT#52873)
+ [Steffen Mueller]
+
+2.2205 - Wed Mar 10 18:15:36 EST 2010
+
+ Other:
+
+ - No longer ships with Build.PL to avoid creating a circular dependency
+
+2.2204 - Wed Mar 10 14:23:52 EST 2010
+
+ Other:
+
+ - Downgraded warnings on using INCLUDE with a command from "deprecated"
+ to "discouraged" and limited it to the case where the command includes
+ "perl" [Steffen Mueller]
+
+2.2203 - Thu Feb 11 14:00:51 EST 2010
+
+ Bug fixes:
+
+ - Build.PL was not including ExtUtils/xsubpp for installation. Fixed
+ by subclassing M::B::find_pm_files to include it [David Golden]
+
+2.2202 - Wed Jan 27 15:04:59 EST 2010
+
+ Bug fixes:
+
+ - The fix to IN/OUT/OUTLIST was itself broken and is now fixed.
+ [Reported by Serdar Dalgic; fix suggested by Rafael Garcia-Suarez]
+
+ We apologize for the fault in the regex. Those responsible
+ have been sacked.
+
+2.2201 Mon Jan 25 16:12:05 EST 2010
+
+ Bug fixes:
+
+ - IN/OUT/OUTLIST, etc. were broken due to a bad regexp. [Simon Cozens]
+
+2.22 - Mon Jan 11 15:00:07 EST 2010
+
+ No changes from 2.21_02
+
+2.21_02 - Sat Dec 19 10:55:41 EST 2009
+
+ Bug fixes:
+
+ - fixed bugs and added tests for INCLUDE_COMMAND [Steffen Mueller]
+
+2.21_01 - Sat Dec 19 07:22:44 EST 2009
+
+ Enhancements:
+
+ - New 'INCLUDE_COMMAND' directive [Steffen Mueller]
+
+ Bug fixes:
+
+ - Workaround for empty newXS macro found in P5NCI [Goro Fuji]
+
2.21 - Mon Oct 5 11:17:53 EDT 2009
Bug fixes:
@@ -12,7 +80,7 @@ Revision history for Perl extension ExtU
Bug fixes:
- Use "char* file" for perl < 5.9, not "char[] file"; fixes mod_perl
- breakage due to prior attempts to fix RT#48104 [David Golden]
+ breakage due to prior attempts to fix RT#48104 [David Golden]
2.20_06 - Fri Oct 2 23:45:45 EDT 2009
@@ -62,8 +130,8 @@ Revision history for Perl extension ExtU
2.20_03 - Thu Jul 23 23:14:50 EDT 2009
Bug fixes:
- - Fixed "const char *" errors for 5.8.8 (and older) (RT#48104)
- [Vincent Pit]
+ - Fixed "const char *" errors for 5.8.8 (and older) (RT#48104)
+ [Vincent Pit]
- Added newline before a preprocessor directive (RT#30673)
[patch by hjp]
diff -up perl-5.12.3/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm.22206 perl-5.12.3/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
--- perl-5.12.3/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm.22206 2011-01-09 15:20:53.000000000 -0500
+++ perl-5.12.3/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm 2011-01-26 16:16:15.366548997 -0500
@@ -18,7 +18,7 @@ my(@XSStack); # Stack of conditionals an
my($XSS_work_idx, $cpp_next_tmp);
use vars qw($VERSION);
-$VERSION = '2.21';
+$VERSION = '2.2206';
$VERSION = eval $VERSION if $VERSION =~ /_/;
use vars qw(%input_expr %output_expr $ProtoUsed @InitFileCode $FH $proto_re $Overload $errors $Fallback
@@ -74,7 +74,7 @@ sub process_file {
($XSS_work_idx, $cpp_next_tmp) = (0, "XSubPPtmpAAAA");
@InitFileCode = ();
$FH = Symbol::gensym();
- $proto_re = "[" . quotemeta('\$%&*@;[]') . "]" ;
+ $proto_re = "[" . quotemeta('\$%&*@;[]_') . "]" ;
$Overload = 0;
$errors = 0;
$Fallback = '&PL_sv_undef';
@@ -230,9 +230,10 @@ sub process_file {
# Match an XS keyword
$BLOCK_re= '\s*(' . join('|', qw(
- REQUIRE BOOT CASE PREINIT INPUT INIT CODE PPCODE OUTPUT
- CLEANUP ALIAS ATTRS PROTOTYPES PROTOTYPE VERSIONCHECK INCLUDE
- SCOPE INTERFACE INTERFACE_MACRO C_ARGS POSTCALL OVERLOAD FALLBACK
+ REQUIRE BOOT CASE PREINIT INPUT INIT CODE PPCODE
+ OUTPUT CLEANUP ALIAS ATTRS PROTOTYPES PROTOTYPE
+ VERSIONCHECK INCLUDE INCLUDE_COMMAND SCOPE INTERFACE
+ INTERFACE_MACRO C_ARGS POSTCALL OVERLOAD FALLBACK
)) . "|$END)\\s*:";
@@ -448,7 +449,7 @@ EOF
$xsreturn = 0;
$_ = shift(@line);
- while (my $kwd = check_keyword("REQUIRE|PROTOTYPES|FALLBACK|VERSIONCHECK|INCLUDE|SCOPE")) {
+ while (my $kwd = check_keyword("REQUIRE|PROTOTYPES|FALLBACK|VERSIONCHECK|INCLUDE(?:_COMMAND)?|SCOPE")) {
&{"${kwd}_handler"}() ;
next PARAGRAPH unless @line ;
$_ = shift(@line);
@@ -520,11 +521,11 @@ EOF
next unless defined($pre) && length($pre);
my $out_type = '';
my $inout_var;
- if ($process_inout and s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\s+//) {
+ if ($process_inout and s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//) {
my $type = $1;
$out_type = $type if $type ne 'IN';
- $arg =~ s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\s+//;
- $pre =~ s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\s+//;
+ $arg =~ s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//;
+ $pre =~ s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//;
}
my $islength;
if ($name =~ /^length\( \s* (\w+) \s* \)\z/x) {
@@ -554,7 +555,7 @@ EOF
} else {
@args = split(/\s*,\s*/, $orig_args);
for (@args) {
- if ($process_inout and s/^(IN|IN_OUTLIST|OUTLIST|IN_OUT|OUT)\s+//) {
+ if ($process_inout and s/^(IN|IN_OUTLIST|OUTLIST|IN_OUT|OUT)\b\s*//) {
my $out_type = $1;
next if $out_type eq 'IN';
$only_C_inlist{$_} = 1 if $out_type eq "OUTLIST";
@@ -934,6 +935,10 @@ EOF
EOF
}
}
+ elsif($newXS eq 'newXS'){ # work around P5NCI's empty newXS macro
+ push(@InitFileCode,
+ " ${newXS}(\"$pname\", XS_$Full_func_name, file$proto);\n");
+ }
else {
push(@InitFileCode,
" (void)${newXS}(\"$pname\", XS_$Full_func_name, file$proto);\n");
@@ -1481,6 +1486,25 @@ sub PROTOTYPES_handler ()
}
+sub PushXSStack
+ {
+ my %args = @_;
+ # Save the current file context.
+ push(@XSStack, {
+ type => 'file',
+ LastLine => $lastline,
+ LastLineNo => $lastline_no,
+ Line => \@line,
+ LineNo => \@line_no,
+ Filename => $filename,
+ Filepathname => $filepathname,
+ Handle => $FH,
+ IsPipe => scalar($filename =~ /\|\s*$/),
+ %args,
+ }) ;
+
+ }
+
sub INCLUDE_handler ()
{
# the rest of the current line should contain a valid filename
@@ -1499,17 +1523,16 @@ sub INCLUDE_handler ()
++ $IncludedFiles{$_} unless /\|\s*$/ ;
- # Save the current file context.
- push(@XSStack, {
- type => 'file',
- LastLine => $lastline,
- LastLineNo => $lastline_no,
- Line => \@line,
- LineNo => \@line_no,
- Filename => $filename,
- Filepathname => $filepathname,
- Handle => $FH,
- }) ;
+ if (/\|\s*$/ && /^\s*perl\s/) {
+ Warn("The INCLUDE directive with a command is discouraged." .
+ " Use INCLUDE_COMMAND instead! In particular using 'perl'" .
+ " in an 'INCLUDE: ... |' directive is not guaranteed to pick" .
+ " up the correct perl. The INCLUDE_COMMAND directive allows" .
+ " the use of \$^X as the currently running perl, see" .
+ " 'perldoc perlxs' for details.");
+ }
+
+ PushXSStack();
$FH = Symbol::gensym();
@@ -1523,7 +1546,7 @@ sub INCLUDE_handler ()
EOF
$filename = $_ ;
- $filepathname = "$dir/$filename";
+ $filepathname = File::Spec->catfile($dir, $filename);
# Prime the pump by reading the first
# non-blank line
@@ -1535,7 +1558,64 @@ EOF
$lastline = $_ ;
$lastline_no = $. ;
+ }
+
+sub QuoteArgs {
+ my $cmd = shift;
+ my @args = split /\s+/, $cmd;
+ $cmd = shift @args;
+ for (@args) {
+ $_ = q(").$_.q(") if !/^\"/ && length($_) > 0;
+ }
+ return join (' ', ($cmd, @args));
+ }
+sub INCLUDE_COMMAND_handler ()
+ {
+ # the rest of the current line should contain a valid command
+
+ TrimWhitespace($_) ;
+
+ $_ = QuoteArgs($_) if $^O eq 'VMS';
+
+ death("INCLUDE_COMMAND: command missing")
+ unless $_ ;
+
+ death("INCLUDE_COMMAND: pipes are illegal")
+ if /^\s*\|/ or /\|\s*$/ ;
+
+ PushXSStack( IsPipe => 1 );
+
+ $FH = Symbol::gensym();
+
+ # If $^X is used in INCLUDE_COMMAND, we know it's supposed to be
+ # the same perl interpreter as we're currently running
+ s/^\s*\$\^X/$^X/;
+
+ # open the new file
+ open ($FH, "-|", "$_")
+ or death("Cannot run command '$_' to include its output: $!") ;
+
+ print Q(<<"EOF");
+#
+#/* INCLUDE_COMMAND: Including output of '$_' from '$filename' */
+#
+EOF
+
+ $filename = $_ ;
+ $filepathname = $filename;
+ $filepathname =~ s/\"/\\"/g;
+
+ # Prime the pump by reading the first
+ # non-blank line
+
+ # skip leading blank lines
+ while (<$FH>) {
+ last unless /^\s*$/ ;
+ }
+
+ $lastline = $_ ;
+ $lastline_no = $. ;
}
sub PopFile()
@@ -1544,7 +1624,7 @@ sub PopFile()
my $data = pop @XSStack ;
my $ThisFile = $filename ;
- my $isPipe = ($filename =~ /\|\s*$/) ;
+ my $isPipe = $data->{IsPipe};
-- $IncludedFiles{$filename}
unless $isPipe ;
diff -up perl-5.12.3/cpan/ExtUtils-ParseXS/lib/ExtUtils/xsubpp.22206 perl-5.12.3/cpan/ExtUtils-ParseXS/lib/ExtUtils/xsubpp
diff -up perl-5.12.3/cpan/ExtUtils-ParseXS/t/more.t.22206 perl-5.12.3/cpan/ExtUtils-ParseXS/t/more.t
--- perl-5.12.3/cpan/ExtUtils-ParseXS/t/more.t.22206 2011-01-09 15:20:53.000000000 -0500
+++ perl-5.12.3/cpan/ExtUtils-ParseXS/t/more.t 2011-01-26 16:17:03.000549001 -0500
@@ -8,7 +8,7 @@ use ExtUtils::CBuilder;
use attributes;
use overload;
-plan tests => 24;
+plan tests => 25;
my ($source_file, $obj_file, $lib_file);
@@ -42,7 +42,7 @@ SKIP: {
}
SKIP: {
- skip "no dynamic loading", 5
+ skip "no dynamic loading", 6
if !$b->have_compiler || !$Config{usedl};
my $module = 'XSMore';
$lib_file = $b->link( objects => $obj_file, module_name => $module );
@@ -88,6 +88,8 @@ SKIP: {
is XSMore::len("foo"), 3, 'the length keyword';
+ is XSMore::sum(5, 9), 14, 'the INCLUDE_COMMAND directive';
+
# Win32 needs to close the DLL before it can unlink it, but unfortunately
# dl_unload_file was missing on Win32 prior to perl change #24679!
if ($^O eq 'MSWin32' and defined &DynaLoader::dl_unload_file) {
diff -up perl-5.12.3/cpan/ExtUtils-ParseXS/t/XSMore.xs.22206 perl-5.12.3/cpan/ExtUtils-ParseXS/t/XSMore.xs
--- perl-5.12.3/cpan/ExtUtils-ParseXS/t/XSMore.xs.22206 2011-01-09 15:20:53.000000000 -0500
+++ perl-5.12.3/cpan/ExtUtils-ParseXS/t/XSMore.xs 2011-01-26 16:17:22.844549001 -0500
@@ -106,6 +106,8 @@ outlist(OUTLIST int a, OUTLIST int b)
int
len(char* s, int length(s))
+INCLUDE_COMMAND: $^X -Ilib -It/lib -MIncludeTester -e IncludeTester::print_xs
+
#if 1
INCLUDE: XSInclude.xsh