From: Nicholas Clark Date: Sun, 8 May 2011 17:48:33 +0000 (+0200) Subject: Reinstate 5.005_xx "support". X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-Size.git;a=commitdiff_plain;h=177ebd37c766a3ff9b89f91a8215e91111c63c7b Reinstate 5.005_xx "support". i.e. it compiles and passes tests. --- diff --git a/CHANGES b/CHANGES index 6b47112..d620ce3 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ Revision history for Perl extension Devel::Size. * Magic vtables aren't freed when magic is freed, so don't count them. (They are static structures. Anything that assumes otherwise is buggy.) * Reinstate 5.6.x "support". (i.e. it compiles and passes tests.) + * Reinstate 5.005_xx "support". (i.e. it compiles and passes tests.) 0.75_51 2011-05-05 nicholas * Only use a static array of vtables on gcc. diff --git a/MANIFEST b/MANIFEST index 6328f74..15890f5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -16,3 +16,4 @@ t/pod_cov.t t/pvbm.t t/recurse.t t/warnings.t A rather exhaustive test for the non-exceptional warnings +typemap The typemap for UV, missing from 5.005_xx diff --git a/Makefile.PL b/Makefile.PL index 497c2db..73d3874 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -use 5.006; +use 5.005; use ExtUtils::MakeMaker; use strict; @@ -12,7 +12,7 @@ WriteMakefile( NAME => 'Devel::Size', VERSION_FROM => 'lib/Devel/Size.pm', DEFINE => "-DALIGN_BITS=$ptr_bits", - PREREQ_PM => { 'Test::More' => 0 }, - (eval $ExtUtils::MakeMaker::VERSION >= 6.47 ? (MIN_PERL_VERSION => '5.006') : ()), + PREREQ_PM => { 'Test::More' => 0, XSLoader => 0, }, + (eval $ExtUtils::MakeMaker::VERSION >= 6.47 ? (MIN_PERL_VERSION => '5.005') : ()), (eval $ExtUtils::MakeMaker::VERSION >= 6.31 ? (LICENSE => 'perl') : ()), ); diff --git a/Size.xs b/Size.xs index 6c13401..d538fdf 100644 --- a/Size.xs +++ b/Size.xs @@ -16,6 +16,11 @@ # define SvOOK_offset(sv, len) STMT_START { len = SvIVX(sv); } STMT_END #endif +#if PERL_VERSION < 6 +# define PL_opargs opargs +# define PL_op_name op_name +#endif + #ifdef _MSC_VER /* "structured exception" handling is a Microsoft extension to C and C++. It's *not* C++ exception handling - C++ exception handling can't capture @@ -191,6 +196,13 @@ typedef enum { OPc_PVOP, /* 9 */ OPc_LOOP, /* 10 */ OPc_COP /* 11 */ +#ifdef OA_CONDOP + , OPc_CONDOP /* 12 */ +#endif +#ifdef OA_GVOP + , OPc_GVOP /* 13 */ +#endif + } opclass; static opclass @@ -236,9 +248,17 @@ cc_opclass(const OP * const o) case OA_SVOP: TAG; return OPc_SVOP; +#ifdef OA_PADOP case OA_PADOP: TAG; return OPc_PADOP; +#endif + +#ifdef OA_GVOP + case OA_GVOP: TAG; + return OPc_GVOP; +#endif +#ifdef OA_PVOP_OR_SVOP case OA_PVOP_OR_SVOP: TAG; /* * Character translations (tr///) are usually a PVOP, keeping a @@ -249,6 +269,7 @@ cc_opclass(const OP * const o) */ return (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF)) ? OPc_SVOP : OPc_PVOP; +#endif case OA_LOOP: TAG; return OPc_LOOP; @@ -298,6 +319,11 @@ cc_opclass(const OP * const o) return OPc_BASEOP; else return OPc_PVOP; + +#ifdef OA_CONDOP + case OA_CONDOP: TAG; + return OPc_CONDOP; +#endif } warn("Devel::Size: Can't determine class of operator %s, assuming BASEOP\n", PL_op_name[o->op_type]); @@ -402,6 +428,14 @@ op_size(pTHX_ const OP * const baseop, struct state *st) op_size(aTHX_ ((BINOP *)baseop)->op_first, st); op_size(aTHX_ ((LOGOP *)baseop)->op_other, st); TAG;break; +#ifdef OA_CONDOP + case OPc_CONDOP: TAG; + st->total_size += sizeof(struct condop); + op_size(aTHX_ ((BINOP *)baseop)->op_first, st); + op_size(aTHX_ ((CONDOP *)baseop)->op_true, st); + op_size(aTHX_ ((CONDOP *)baseop)->op_false, st); + TAG;break; +#endif case OPc_LISTOP: TAG; st->total_size += sizeof(struct listop); op_size(aTHX_ ((LISTOP *)baseop)->op_first, st); @@ -431,9 +465,17 @@ op_size(pTHX_ const OP * const baseop, struct state *st) sv_size(aTHX_ st, ((SVOP *)baseop)->op_sv, SOME_RECURSION); } TAG;break; +#ifdef OA_PADOP case OPc_PADOP: TAG; st->total_size += sizeof(struct padop); TAG;break; +#endif +#ifdef OA_GVOP + case OPc_GVOP: TAG; + st->total_size += sizeof(struct gvop); + sv_size(aTHX_ st, ((GVOP *)baseop)->op_gv, SOME_RECURSION); + TAG;break; +#endif case OPc_PVOP: TAG; check_new_and_strlen(st, ((PVOP *)baseop)->op_pv); TAG;break; diff --git a/lib/Devel/Size.pm b/lib/Devel/Size.pm index 842f866..78e9378 100644 --- a/lib/Devel/Size.pm +++ b/lib/Devel/Size.pm @@ -3,7 +3,7 @@ package Devel::Size; use strict; use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS $warn $dangle); -require 5.006; +require 5.005; require Exporter; require XSLoader; diff --git a/typemap b/typemap new file mode 100644 index 0000000..8340322 --- /dev/null +++ b/typemap @@ -0,0 +1,5 @@ +UV T_UV + +OUTPUT +T_UV + sv_setuv($arg, (UV)$var);