Skip to content

Commit 9fb06c7

Browse files
committed
version: use PERL_VERSION compare macros
Use new core PERL_VERSION compare macros in vxs.inc When bumping version which this change we would need to make sure to use the last version of ppport.h
1 parent a123eb8 commit 9fb06c7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

vxs.inc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ typedef char HVNAME;
8989
# define HEKf "s"
9090
#endif
9191

92+
/* we should have some meta in Devel-PPPort to check IS_PERL_VERSION_X_Y */
93+
#ifndef IS_PERL_VERSION_5_5
94+
# define IS_PERL_VERSION_5_5 PERL_VERSION_GE(5,5,0) && PERL_VERSION_LT(5,6,0)
95+
#endif
96+
9297
VXS(universal_version)
9398
{
9499
dXSARGS;
@@ -133,7 +138,7 @@ VXS(universal_version)
133138
if (undef) {
134139
if (pkg) {
135140
const HVNAME* const name = HvNAME_HEK(pkg);
136-
#if PERL_VERSION == 5
141+
#if IS_PERL_VERSION_5_5
137142
Perl_croak(aTHX_ "%s version %s required--this is only version ",
138143
name, SvPVx_nolen_const(req));
139144
#else
@@ -144,7 +149,7 @@ VXS(universal_version)
144149
#endif
145150
}
146151
else {
147-
#if PERL_VERSION >= 8
152+
#if PERL_VERSION_GE(5,8,0)
148153
Perl_croak(aTHX_
149154
"%" SVf " defines neither package nor VERSION--"
150155
"version check failed",
@@ -206,7 +211,7 @@ VXS(version_new)
206211
SV * svarg2;
207212
vs = sv_newmortal();
208213
svarg2 = ST(2);
209-
#if PERL_VERSION == 5
214+
#if IS_PERL_VERSION_5_5
210215
sv_setpvf(vs,"v%s",SvPV_nolen_const(svarg2));
211216
#else
212217
Perl_sv_setpvf(aTHX_ vs,"v%s",SvPV_nolen_const(svarg2));
@@ -249,7 +254,7 @@ VXS(version_new)
249254
rv = NEW_VERSION(vs);
250255
if ( len != sizeof(VXS_CLASS)-1
251256
|| strcmp(classname,VXS_CLASS) != 0 ) /* inherited new() */
252-
#if PERL_VERSION == 5
257+
#if IS_PERL_VERSION_5_5
253258
sv_bless(rv, gv_stashpv((char *)classname, GV_ADD));
254259
#else
255260
sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags));
@@ -445,7 +450,7 @@ VXS(version_qv)
445450
}
446451
if ( items == 2 && (len != 7
447452
|| strcmp(classname,"version")) ) { /* inherited new() */
448-
#if PERL_VERSION == 5
453+
#if IS_PERL_VERSION_5_5
449454
sv_bless(rv, gv_stashpv((char *)classname, GV_ADD));
450455
#else
451456
sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags));

0 commit comments

Comments
 (0)