From: Steffen Mueller Date: Sun, 18 Apr 2010 15:14:57 +0000 (+0200) Subject: Upgrade ExtUtils::ParseXS to 0.2205 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=387b6f8d0cc8df27b7a577cf8a47f25b089895e4;p=p5sagit%2Fp5-mst-13.2.git Upgrade ExtUtils::ParseXS to 0.2205 --- diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index ae6ef89..e900630 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -628,7 +628,7 @@ use File::Glob qw(:case); 'ExtUtils::ParseXS' => { 'MAINTAINER' => 'kwilliams', - 'DISTRIBUTION' => 'DAGOLDEN/ExtUtils-ParseXS-2.21.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/ExtUtils-ParseXS-2.2205.tar.gz', 'EXCLUDED' => [ qw{ t/bugs/RT48104.xs t/bugs/typemap diff --git a/cpan/ExtUtils-ParseXS/Changes b/cpan/ExtUtils-ParseXS/Changes index d11c870..b7e7b0b 100644 --- a/cpan/ExtUtils-ParseXS/Changes +++ b/cpan/ExtUtils-ParseXS/Changes @@ -1,5 +1,62 @@ Revision history for Perl extension ExtUtils::ParseXS. +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 +69,7 @@ Revision history for Perl extension ExtUtils::ParseXS. 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 +119,8 @@ Revision history for Perl extension ExtUtils::ParseXS. 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 --git a/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm b/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm index 05c3e69..4f9492a 100644 --- a/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm +++ b/cpan/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm @@ -18,7 +18,7 @@ my(@XSStack); # Stack of conditionals and INCLUDEs my($XSS_work_idx, $cpp_next_tmp); use vars qw($VERSION); -$VERSION = '2.21'; +$VERSION = '2.2205'; $VERSION = eval $VERSION if $VERSION =~ /_/; use vars qw(%input_expr %output_expr $ProtoUsed @InitFileCode $FH $proto_re $Overload $errors $Fallback @@ -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,22 @@ sub PROTOTYPES_handler () } +sub PushXSStack + { + # 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, + }) ; + + } + sub INCLUDE_handler () { # the rest of the current line should contain a valid filename @@ -1499,17 +1520,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(); @@ -1535,7 +1555,51 @@ EOF $lastline = $_ ; $lastline_no = $. ; + } + +sub INCLUDE_COMMAND_handler () + { + # the rest of the current line should contain a valid command + + TrimWhitespace($_) ; + + death("INCLUDE_COMMAND: command missing") + unless $_ ; + + death("INCLUDE_COMMAND: pipes are illegal") + if /^\s*\|/ or /\|\s*$/ ; + + PushXSStack(); + + $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 = "$dir/$filename"; + + # Prime the pump by reading the first + # non-blank line + # skip leading blank lines + while (<$FH>) { + last unless /^\s*$/ ; + } + + $lastline = $_ ; + $lastline_no = $. ; } sub PopFile() diff --git a/cpan/ExtUtils-ParseXS/t/XSMore.xs b/cpan/ExtUtils-ParseXS/t/XSMore.xs index 173460e..f2fe902 100644 --- a/cpan/ExtUtils-ParseXS/t/XSMore.xs +++ b/cpan/ExtUtils-ParseXS/t/XSMore.xs @@ -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 diff --git a/cpan/ExtUtils-ParseXS/t/lib/IncludeTester.pm b/cpan/ExtUtils-ParseXS/t/lib/IncludeTester.pm new file mode 100644 index 0000000..8d16254 --- /dev/null +++ b/cpan/ExtUtils-ParseXS/t/lib/IncludeTester.pm @@ -0,0 +1,20 @@ +package IncludeTester; +use strict; + +sub print_xs { + print <<'HERE'; + +int +sum(a, b) + int a + int b + CODE: + RETVAL = a + b; + OUTPUT: + RETVAL + +HERE +} + +1; + diff --git a/cpan/ExtUtils-ParseXS/t/more.t b/cpan/ExtUtils-ParseXS/t/more.t index 8a934c2..2e55976 100644 --- a/cpan/ExtUtils-ParseXS/t/more.t +++ b/cpan/ExtUtils-ParseXS/t/more.t @@ -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) {