This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make "assertion" attribute code and test conditional
authorNicholas Clark <nick@ccl4.org>
Wed, 19 Jan 2005 21:22:30 +0000 (21:22 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 19 Jan 2005 21:22:30 +0000 (21:22 +0000)
p4raw-id: //depot/perl@23827

t/op/attrs.t
xsutils.c

index dc91438..2169e3c 100644 (file)
@@ -8,7 +8,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan tests => 95;
+plan 'no_plan';
 
 $SIG{__WARN__} = sub { die @_ };
 
@@ -147,7 +147,8 @@ eval 'my $$foo : bar = 1';
 like $@, qr/Can't declare scalar dereference in my/;
 
 
-my @code = qw(assertion lvalue locked method);
+my @code = qw(lvalue locked method);
+unshift @code, 'assertion' if $] >= 5.009;
 my @other = qw(shared unique);
 my %valid;
 $valid{CODE} = {map {$_ => 1} @code};
index 2dc0d7a..c09a376 100644 (file)
--- a/xsutils.c
+++ b/xsutils.c
@@ -71,6 +71,7 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs)
        switch (SvTYPE(sv)) {
        case SVt_PVCV:
            switch ((int)len) {
+#ifdef CVf_ASSERTION
            case 9:
                if (memEQ(name, "assertion", 9)) {
                    if (negated)
@@ -80,6 +81,7 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs)
                    continue;
                }
                break;
+#endif
            case 6:
                switch (name[3]) {
                case 'l':