In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/708f9ca6cd5d97c1d91a54a611d88de6e0986ed2?hp=673223b5b27396bd3627d91146cf8611c03c304d>

- Log -----------------------------------------------------------------
commit 708f9ca6cd5d97c1d91a54a611d88de6e0986ed2
Author: David Golden <[email protected]>
Date:   Sun Jun 28 04:17:54 2009 -0400

    Update ExtUtils::ParseXS to 2.19_03
    
    2.19_03 - Sat Jun 27 22:51:18 EDT 2009
    
     - Released to see updated results from smoke testers
    
     - Fix minor doc typo pulled from blead
    
    2.19_02 - Wed Aug  6 22:18:33 2008
    
     - Fix the usage reports to consistently report package name as well
       as sub name across ALIAS, INTERFACE and regular XSUBS. [Robert May]
    
     - Cleaned up a warning with -Wwrite-strings that gets passed into
       every parsed XS file. [Steve Peters]
    
     - Allow (pedantically correct) C pre-processor comments in the code
       snippets of typemap files. [Nicholas Clark]
    
    Signed-off-by: H.Merijn Brand <[email protected]>
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST                                         |    3 +
 Porting/Maintainers.pl                           |    4 +-
 lib/ExtUtils/ParseXS.pm                          |   66 +++++++++++++++++-----
 lib/ExtUtils/ParseXS/t/{XSTest.pm => XSUsage.pm} |    6 +-
 lib/ExtUtils/ParseXS/t/XSUsage.xs                |   37 ++++++++++++
 lib/ExtUtils/ParseXS/t/basic.t                   |   10 ++-
 lib/ExtUtils/ParseXS/t/{basic.t => usage.t}      |   65 +++++++++++++++------
 7 files changed, 149 insertions(+), 42 deletions(-)
 copy lib/ExtUtils/ParseXS/t/{XSTest.pm => XSUsage.pm} (60%)
 create mode 100644 lib/ExtUtils/ParseXS/t/XSUsage.xs
 copy lib/ExtUtils/ParseXS/t/{basic.t => usage.t} (60%)

diff --git a/MANIFEST b/MANIFEST
index 017b28b..9071bfc 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2176,8 +2176,11 @@ lib/ExtUtils/NOTES               Notes about MakeMaker 
internals
 lib/ExtUtils/Packlist.pm       Manipulates .packlist files
 lib/ExtUtils/ParseXS.pm                converts Perl XS code into C code
 lib/ExtUtils/ParseXS/t/basic.t See if ExtUtils::ParseXS works
+lib/ExtUtils/ParseXS/t/usage.t ExtUtils::ParseXS tests
 lib/ExtUtils/ParseXS/t/XSTest.pm       Test file for ExtUtils::ParseXS tests
 lib/ExtUtils/ParseXS/t/XSTest.xs       Test file for ExtUtils::ParseXS tests
+lib/ExtUtils/ParseXS/t/XSUsage.pm      ExtUtils::ParseXS tests
+lib/ExtUtils/ParseXS/t/XSUsage.xs      ExtUtils::ParseXS tests
 lib/ExtUtils/PATCHING          Suggestions for patching MakeMaker
 lib/ExtUtils/README            MakeMaker README
 lib/ExtUtils/t/00compile.t     See if MakeMaker modules compile
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 6d3c2bf..9c1780a 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -723,13 +723,13 @@ package Maintainers;
     'ExtUtils::ParseXS' =>
        {
        'MAINTAINER'    => 'kwilliams',
-       'DISTRIBUTION'  => 'KWILLIAMS/ExtUtils-ParseXS-2.19.tar.gz',
+       'DISTRIBUTION'  => 'DAGOLDEN/ExtUtils-ParseXS-2.19_03.tar.gz',
        'FILES'         => q[lib/ExtUtils/ParseXS.pm
                             lib/ExtUtils/ParseXS
                             lib/ExtUtils/xsubpp
                            ],
        'CPAN'          => 1,
-       'UPSTREAM'      => undef,
+       'UPSTREAM'      => 'cpan',
        },
 
     'faq' =>
diff --git a/lib/ExtUtils/ParseXS.pm b/lib/ExtUtils/ParseXS.pm
index b8ce4a0..bf567aa 100644
--- a/lib/ExtUtils/ParseXS.pm
+++ b/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.19_01';
+$VERSION = '2.19_03';
 
 use vars qw(%input_expr %output_expr $ProtoUsed @InitFileCode $FH $proto_re 
$Overload $errors $Fallback
            $cplusplus $hiertype $WantPrototypes $WantVersionChk $except 
$WantLineNumbers
@@ -305,13 +305,56 @@ EOM
     exit 0; # Not a fatal error for the caller process
   }
 
-    print <<"EOF";
+  print 'ExtUtils::ParseXS::CountLines'->end_marker, "\n" if $WantLineNumbers;
+
+  print <<"EOF";
 #ifndef PERL_UNUSED_VAR
 #  define PERL_UNUSED_VAR(var) if (0) var = var
 #endif
 
 EOF
 
+  print <<"EOF";
+#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
+#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
+
+/* prototype to pass -Wmissing-prototypes */
+STATIC void
+S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
+
+STATIC void
+S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
+{
+    const GV *const gv = CvGV(cv);
+
+    PERL_ARGS_ASSERT_CROAK_XS_USAGE;
+
+    if (gv) {
+        const char *const gvname = GvNAME(gv);
+        const HV *const stash = GvSTASH(gv);
+        const char *const hvname = stash ? HvNAME(stash) : NULL;
+
+        if (hvname)
+            Perl_croak(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params);
+        else
+            Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params);
+    } else {
+        /* Pants. I don't think that it should be possible to get here. */
+        Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
+    }
+}
+#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE
+
+#ifdef PERL_IMPLICIT_CONTEXT
+#define croak_xs_usage(a,b)    S_croak_xs_usage(aTHX_ a,b)
+#else
+#define croak_xs_usage         S_croak_xs_usage
+#endif
+
+#endif
+
+EOF
+
   print 'ExtUtils::ParseXS::CountLines'->end_marker, "\n" if $WantLineNumbers;
 
   $lastline    = $_;
@@ -597,22 +640,17 @@ EOF
 #    *errbuf = '\0';
 EOF
 
-    if ($ALIAS)
-      { print Q(<<"EOF") if $cond }
-#    if ($cond)
-#       Perl_croak(aTHX_ "Usage: %s(%s)", GvNAME(CvGV(cv)), "$report_args");
-EOF
-    else
-      { print Q(<<"EOF") if $cond }
+    if($cond) {
+    print Q(<<"EOF");
 #    if ($cond)
-#       Perl_croak(aTHX_ "Usage: %s(%s)", "$pname", "$report_args");
+#       croak_xs_usage(cv,  "$report_args");
 EOF
-    
-     # cv doesn't seem to be used, in most cases unless we go in 
-     # the if of this else
-     print Q(<<"EOF");
+    } else {
+    # cv likely to be unused
+    print Q(<<"EOF");
 #    PERL_UNUSED_VAR(cv); /* -W */
 EOF
+    }
 
     #gcc -Wall: if an xsub has PPCODE is used
     #it is possible none of ST, XSRETURN or XSprePUSH macros are used
diff --git a/lib/ExtUtils/ParseXS/t/XSTest.pm 
b/lib/ExtUtils/ParseXS/t/XSUsage.pm
similarity index 60%
copy from lib/ExtUtils/ParseXS/t/XSTest.pm
copy to lib/ExtUtils/ParseXS/t/XSUsage.pm
index 988ef47..a375428 100644
--- a/lib/ExtUtils/ParseXS/t/XSTest.pm
+++ b/lib/ExtUtils/ParseXS/t/XSUsage.pm
@@ -1,8 +1,6 @@
-package XSTest;
+package XSUsage;
 
 require DynaLoader;
 @ISA = qw(Exporter DynaLoader);
 $VERSION = '0.01';
-bootstrap XSTest $VERSION;
-
-1;
+bootstrap XSUsage $VERSION;
diff --git a/lib/ExtUtils/ParseXS/t/XSUsage.xs 
b/lib/ExtUtils/ParseXS/t/XSUsage.xs
new file mode 100644
index 0000000..964acd1
--- /dev/null
+++ b/lib/ExtUtils/ParseXS/t/XSUsage.xs
@@ -0,0 +1,37 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+int xsusage_one()   { return 1; } 
+int xsusage_two()   { return 2; }
+int xsusage_three() { return 3; }
+int xsusage_four()  { return 4; }
+int xsusage_five()  { return 5; }
+int xsusage_six()   { return 6; }
+
+MODULE = XSUsage         PACKAGE = XSUsage     PREFIX = xsusage_
+
+PROTOTYPES: DISABLE
+
+int
+xsusage_one()
+
+int
+xsusage_two()
+    ALIAS:
+        two_x = 1
+        FOO::two = 2
+
+int
+interface_v_i()
+    INTERFACE:
+        xsusage_three
+
+int
+xsusage_four(...)
+
+int
+xsusage_five(int i, ...)
+
+int
+xsusage_six(int i = 0)
diff --git a/lib/ExtUtils/ParseXS/t/basic.t b/lib/ExtUtils/ParseXS/t/basic.t
index 9b5319e..f772596 100644
--- a/lib/ExtUtils/ParseXS/t/basic.t
+++ b/lib/ExtUtils/ParseXS/t/basic.t
@@ -64,13 +64,17 @@ if ($b->have_compiler) {
       }
     }
   }
-  1 while unlink $obj_file;
-  1 while unlink $lib_file;
+  unless ($ENV{PERL_NO_CLEANUP}) {
+    1 while unlink $obj_file;
+    1 while unlink $lib_file;
+  }
 } else {
   skip "Skipped can't find a C compiler & linker", 1 for 1..7;
 }
 
-1 while unlink $source_file;
+unless ($ENV{PERL_NO_CLEANUP}) {
+  1 while unlink $source_file;
+}
 
 #####################################################################
 
diff --git a/lib/ExtUtils/ParseXS/t/basic.t b/lib/ExtUtils/ParseXS/t/usage.t
similarity index 60%
copy from lib/ExtUtils/ParseXS/t/basic.t
copy to lib/ExtUtils/ParseXS/t/usage.t
index 9b5319e..2d3bdc9 100644
--- a/lib/ExtUtils/ParseXS/t/basic.t
+++ b/lib/ExtUtils/ParseXS/t/usage.t
@@ -10,7 +10,7 @@ BEGIN {
 }
 use strict;
 use Test;
-BEGIN { plan tests => 10 };
+BEGIN { plan tests => 24 };
 use DynaLoader;
 use ExtUtils::ParseXS qw(process_file);
 use ExtUtils::CBuilder;
@@ -22,15 +22,10 @@ use Carp; $SIG{__WARN__} = \&Carp::cluck;
 
 #########################
 
-# Try sending to filehandle
-tie *FH, 'Foo';
-process_file( filename => 'XSTest.xs', output => \*FH, prototypes => 1 );
-ok tied(*FH)->content, '/is_even/', "Test that output contains some text";
-
-my $source_file = 'XSTest.c';
+my $source_file = 'XSUsage.c';
 
 # Try sending to file
-process_file(filename => 'XSTest.xs', output => $source_file, prototypes => 0);
+process_file(filename => 'XSUsage.xs', output => $source_file);
 ok -e $source_file, 1, "Create an output file";
 
 # TEST doesn't like extraneous output
@@ -39,7 +34,7 @@ my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
 # Try to compile the file!  Don't get too fancy, though.
 my $b = ExtUtils::CBuilder->new(quiet => $quiet);
 if ($b->have_compiler) {
-  my $module = 'XSTest';
+  my $module = 'XSUsage';
 
   my $obj_file = $b->compile( source => $source_file );
   ok $obj_file;
@@ -49,10 +44,48 @@ if ($b->have_compiler) {
   ok $lib_file;
   ok -e $lib_file, 1, "Make sure $lib_file exists";
 
-  eval {require XSTest};
+  eval {require XSUsage};
   ok $@, '';
-  ok  XSTest::is_even(8);
-  ok !XSTest::is_even(9);
+
+  # The real tests here - for each way of calling the functions, call with the
+  # wrong number of arguments and check the Usage line is what we expect
+
+  eval { XSUsage::one(1) };
+  ok $@;
+  ok $@ =~ /^Usage: XSUsage::one/;
+
+  eval { XSUsage::two(1) };
+  ok $@;
+  ok $@ =~ /^Usage: XSUsage::two/;
+
+  eval { XSUsage::two_x(1) };
+  ok $@;
+  ok $@ =~ /^Usage: XSUsage::two_x/;
+
+  eval { FOO::two(1) };
+  ok $@;
+  ok $@ =~ /^Usage: FOO::two/;
+
+  eval { XSUsage::three(1) };
+  ok $@;
+  ok $@ =~ /^Usage: XSUsage::three/;
+
+  eval { XSUsage::four(1) };
+  ok !$@;
+
+  eval { XSUsage::five() };
+  ok $@;
+  ok $@ =~ /^Usage: XSUsage::five/;
+
+  eval { XSUsage::six() };
+  ok !$@;
+
+  eval { XSUsage::six(1) };
+  ok !$@;
+
+  eval { XSUsage::six(1,2) };
+  ok $@;
+  ok $@ =~ /^Usage: XSUsage::six/;
 
   # 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!
@@ -67,13 +100,7 @@ if ($b->have_compiler) {
   1 while unlink $obj_file;
   1 while unlink $lib_file;
 } else {
-  skip "Skipped can't find a C compiler & linker", 1 for 1..7;
+  skip "Skipped can't find a C compiler & linker", 1 for 3 .. 24;
 }
 
 1 while unlink $source_file;
-
-#####################################################################
-
-sub Foo::TIEHANDLE { bless {}, 'Foo' }
-sub Foo::PRINT { shift->{buf} .= join '', @_ }
-sub Foo::content { shift->{buf} }

--
Perl5 Master Repository

Reply via email to