In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/fb34c6aba9445af559a9ff53b28b5e1e10afa23d?hp=87b9e16005b9e39b8a24388159e899fe54b95979>
- Log ----------------------------------------------------------------- commit fb34c6aba9445af559a9ff53b28b5e1e10afa23d Author: Nicholas Clark <[email protected]> Date: Tue Sep 21 15:11:17 2010 +0100 ExtUtils::Constant::ProxySubs should use mro_method_changed_in() if available. M cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm commit ad39d6d2ab3fa902fe6e879c0ec6efa61f93ae55 Author: Nicholas Clark <[email protected]> Date: Tue Sep 21 14:55:52 2010 +0100 Add macro_to_ifndef to ExtUtils::Constant::Base, and use it in place of #else Previously the code was using the #ifdef generated by macro_to_ifdef(), and immediately following that with an #else. That was ugly. And longer. M cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Base.pm M cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm commit 575f055216d48b9f31b3f00143a8d474fcf7ad80 Author: Nicholas Clark <[email protected]> Date: Tue Sep 21 14:27:19 2010 +0100 Tweak ExtUtils::Constant::ProxySubs to use hv_exists_ent(). Previously it was using hv_exists(), requiring extra code to unpack the SV and convert it to the correct string form for the hash API. M cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm commit 8c5ae9a317f870fc7f907bff15be2ed3bcb7b7a4 Author: Nicholas Clark <[email protected]> Date: Tue Sep 21 14:07:00 2010 +0100 Remove boilerplate and (un)conditional code from Makefile.PLs in ext M ext/I18N-Langinfo/Makefile.PL M ext/XS-APItest/Makefile.PL commit e2f1cb345b8e60b81ce9f8a291b2fc77b7e21c85 Author: Nicholas Clark <[email protected]> Date: Tue Sep 21 13:34:12 2010 +0100 Tweak XS::APItest to automatically add all functions to @EXPORT. This saves manually maintaining the export list, which is makework given that the module is only used by its own tests. As the export now folds in symbols from subpackages, this will allow refactoring/reordering/rationalisation of the layout of testing routines in it. M ext/XS-APItest/APItest.pm M ext/XS-APItest/t/temp_lv_sub.t ----------------------------------------------------------------------- Summary of changes: .../lib/ExtUtils/Constant/Base.pm | 14 +++++- .../lib/ExtUtils/Constant/ProxySubs.pm | 23 ++++++--- ext/I18N-Langinfo/Makefile.PL | 14 +---- ext/XS-APItest/APItest.pm | 58 +++++++++++++------- ext/XS-APItest/Makefile.PL | 12 +---- ext/XS-APItest/t/temp_lv_sub.t | 2 +- 6 files changed, 72 insertions(+), 51 deletions(-) diff --git a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Base.pm b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Base.pm index b5b79af..ecf1bb3 100644 --- a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Base.pm +++ b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Base.pm @@ -5,7 +5,7 @@ use vars qw($VERSION); use Carp; use Text::Wrap; use ExtUtils::Constant::Utils qw(C_stringify perl_stringify); -$VERSION = '0.04'; +$VERSION = '0.05'; use constant is_perl56 => ($] < 5.007 && $] > 5.005_50); @@ -83,6 +83,18 @@ sub macro_to_ifdef { return ""; } +sub macro_to_ifndef { + my ($self, $macro) = @_; + if (ref $macro) { + # Can't invert these stylishly, so "bodge it" + return "$macro->[0]#else"; + } + if (defined $macro && $macro ne "" && $macro ne "1") { + return $macro ? "#ifndef $macro\n" : "#if 1\n"; + } + croak "Can't generate an ifndef for unconditional code"; +} + sub macro_to_endif { my ($self, $macro) = @_; diff --git a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm index c3fe8ed..0005f13 100644 --- a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm +++ b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm @@ -9,7 +9,7 @@ require ExtUtils::Constant::XS; use ExtUtils::Constant::Utils qw(C_stringify); use ExtUtils::Constant::XS qw(%XS_TypeSet); -$VERSION = '0.06'; +$VERSION = '0.07'; @ISA = 'ExtUtils::Constant::XS'; %type_to_struct = @@ -356,11 +356,12 @@ EOBOOT carp("Attempting to supply a default for '$name' which has no conditional macro"); next; } - print $xs_fh $ifdef; if ($item->{invert_macro}) { + print $xs_fh $self->macro_to_ifndef($macro); print $xs_fh - " /* This is the default value: */\n" if $type; - print $xs_fh "#else\n"; + " /* This is the default value: */\n" if $type; + } else { + print $xs_fh $ifdef; } print $xs_fh " { ", join (', ', "\"$name\"", $namelen, &$type_to_value($value)), " },\n", @@ -502,12 +503,21 @@ EOBOOT print $xs_fh $self->macro_to_endif($macro); } - print $xs_fh <<EOBOOT; + if ($] >= 5.009) { + print $xs_fh <<EOBOOT; + /* As we've been creating subroutines, we better invalidate any cached + methods */ + mro_method_changed_in(symbol_table); + } +EOBOOT + } else { + print $xs_fh <<EOBOOT; /* As we've been creating subroutines, we better invalidate any cached methods */ ++PL_sub_generation; } EOBOOT + } print $xs_fh $explosives ? <<"EXPLODE" : <<"DONT"; @@ -527,13 +537,12 @@ $xs_subname(sv) STRLEN len; INPUT: SV * sv; - const char * s = SvPV(sv, len); PPCODE: #ifdef SYMBIAN sv = newSVpvf("%"SVf" is not a valid $package_sprintf_safe macro", sv); #else HV *${c_subname}_missing = get_missing_hash(aTHX); - if (hv_exists(${c_subname}_missing, s, SvUTF8(sv) ? -(I32)len : (I32)len)) { + if (hv_exists_ent(${c_subname}_missing, sv, 0)) { sv = newSVpvf("Your vendor has not defined $package_sprintf_safe macro %" SVf ", used", sv); } else { diff --git a/ext/I18N-Langinfo/Makefile.PL b/ext/I18N-Langinfo/Makefile.PL index eace265..7573568 100644 --- a/ext/I18N-Langinfo/Makefile.PL +++ b/ext/I18N-Langinfo/Makefile.PL @@ -1,20 +1,10 @@ use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'I18N::Langinfo', 'VERSION_FROM' => 'Langinfo.pm', # finds $VERSION - 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'Langinfo.pm', # retrieve abstract from module - AUTHOR => 'Jarkko Hietaniemi <[email protected]>') : ()), - 'LIBS' => [''], # e.g., '-lm' - 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' - # Insert -I. if you add *.h files later: - 'INC' => '', # e.g., '-I/usr/include/other' + ABSTRACT_FROM => 'Langinfo.pm', # retrieve abstract from module + AUTHOR => 'Jarkko Hietaniemi <[email protected]>', realclean => {FILES=> 'const-c.inc const-xs.inc'}, - # Un-comment this if you add C files to link with later: - # 'OBJECT' => '$(O_FILES)', # link all the C files too ); if (eval {require ExtUtils::Constant; 1}) { # Some older versions of glibc use only enums, no defines, hence all this diff --git a/ext/XS-APItest/APItest.pm b/ext/XS-APItest/APItest.pm index 11011e0..ca121ad 100644 --- a/ext/XS-APItest/APItest.pm +++ b/ext/XS-APItest/APItest.pm @@ -5,29 +5,47 @@ use strict; use warnings; use Carp; -use base qw/ DynaLoader Exporter /; - -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. +use base 'DynaLoader'; # Export everything since these functions are only used by a test script -our @EXPORT = qw( print_double print_int print_long - print_float print_long_double have_long_double print_flush - mpushp mpushn mpushi mpushu - mxpushp mxpushn mxpushi mxpushu - call_sv call_pv call_method eval_sv eval_pv require_pv - G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS - G_KEEPERR G_NODEBUG G_METHOD G_WANT - apitest_exception mycroak strtab - my_cxt_getint my_cxt_getsv my_cxt_setint my_cxt_setsv - sv_setsv_cow_hashkey_core sv_setsv_cow_hashkey_notcore - rmagical_cast rmagical_flags - DPeek utf16_to_utf8 utf16_to_utf8_reversed my_exit - sv_count -); - -our $VERSION = '0.21'; +# Export subpackages too - in effect, export all their routines into us, then +# export everything from us. +sub import { + my $package = shift; + croak ("Can't export for '$package'") unless $package eq __PACKAGE__; + my $exports; + @{$export...@_} = () if @_; + + my $callpkg = caller; + + my @stashes = ('XS::APItest::', \%XS::APItest::); + while (my ($stash_name, $stash) = splice @stashes, 0, 2) { + while (my ($sym_name, $glob) = each %$stash) { + if ($sym_name =~ /::$/) { + # Skip any subpackages that are clearly OO + next if *{$glob}{HASH}{'new'}; + push @stashes, "$stash_name$sym_name", *{$glob}{HASH}; + } elsif (ref $glob eq 'SCALAR' || *{$glob}{CODE}) { + if ($exports) { + next if !exists $exports->{$sym_name}; + delete $exports->{$sym_name}; + } + no strict 'refs'; + *{"$callpkg\::$sym_name"} = \&{"$stash_name$sym_name"}; + } + } + } + if ($exports) { + my @carp = keys %$exports; + if (@carp) { + croak(join '', + (map "\"$_\" is not exported by the $package module\n", sort @carp), + "Can't continue after import errors"); + } + } +} + +our $VERSION = '0.22'; use vars '$WARNINGS_ON_BOOTSTRAP'; use vars map "\$${_}_called_PP", qw(BEGIN UNITCHECK CHECK INIT END); diff --git a/ext/XS-APItest/Makefile.PL b/ext/XS-APItest/Makefile.PL index 9b76a29..bccf38f 100644 --- a/ext/XS-APItest/Makefile.PL +++ b/ext/XS-APItest/Makefile.PL @@ -3,22 +3,14 @@ use ExtUtils::MakeMaker; use ExtUtils::Constant 0.11 'WriteConstants'; use Config; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'XS::APItest', 'VERSION_FROM' => 'APItest.pm', # finds $VERSION 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'APItest.pm', # retrieve abstract from module - AUTHOR => 'Tim Jenness <[email protected]>, Christian Soeller <[email protected]>, Hugo van der Sanden <[email protected]>') : ()), + ABSTRACT_FROM => 'APItest.pm', # retrieve abstract from module + AUTHOR => 'Tim Jenness <[email protected]>, Christian Soeller <[email protected]>, Hugo van der Sanden <[email protected]>', 'C' => ['exception.c', 'core.c', 'notcore.c'], 'OBJECT' => '$(BASEEXT)$(OBJ_EXT) $(O_FILES)', - 'LIBS' => [''], # e.g., '-lm' - 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' - 'INC' => '-I.', # e.g., '-I. -I/usr/include/other' - # Un-comment this if you add C files to link with later: - # 'OBJECT' => '$(O_FILES)', # link all the C files too realclean => {FILES => 'const-c.inc const-xs.inc'}, ($Config{gccversion} && $Config{d_attribute_deprecated} ? (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()), diff --git a/ext/XS-APItest/t/temp_lv_sub.t b/ext/XS-APItest/t/temp_lv_sub.t index b45e27b..938a5c2 100644 --- a/ext/XS-APItest/t/temp_lv_sub.t +++ b/ext/XS-APItest/t/temp_lv_sub.t @@ -4,7 +4,7 @@ use strict; use utf8; use Test::More tests => 5; -BEGIN {use_ok('XS::APItest')}; +require_ok('XS::APItest'); sub make_temp_mg_lv :lvalue { XS::APItest::TempLv::make_temp_mg_lv($_[0]); } -- Perl5 Master Repository
