Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] Cleanup PERL_VERSION checks in .c files #15710

Closed
p5pRT opened this issue Nov 13, 2016 · 11 comments
Closed

[PATCH] Cleanup PERL_VERSION checks in .c files #15710

p5pRT opened this issue Nov 13, 2016 · 11 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 13, 2016

Migrated from rt.perl.org#130082 (status was 'resolved')

Searchable as RT130082$

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2016

From @atoomic

Created by @atoomic

This commit is removing code not exercised by blead
or any later versions using PERL_VERSION.
This is a noop, mainly cleaning code.

Perl Info

Flags:
    category=core
    severity=low
    Type=Patch
    PatchStatus=HasPatch

Site configuration information for perl 5.25.7:

Configured by root at Sun Nov 13 02:16:38 MST 2016.

Summary of my perl5 (revision 5 version 25 subversion 7) configuration:
  Commit id: eed29989b62f6275ceccf5d739ac3c29ac303eff
  Platform:
    osname=linux
    osvers=3.10.0-327.36.3.el7.x86_64
    archname=x86_64-linux
    uname='linux nico-c7.dev.cpanel.net 3.10.0-327.36.3.el7.x86_64 #1 smp
mon oct 24 16:09:20 utc 2016 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Dusedevel'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include'
    ccversion=''
    gccversion='4.8.5 20150623 (Red Hat 4.8.5-4)'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib
/lib64 /usr/lib64 /usr/local/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
-lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.17.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.17'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'



@INC for perl 5.25.7:
    lib
    /root/.dotfiles/perl-must-have/lib
    /root/perl5/lib/perl5/
    /usr/local/lib/perl5/site_perl/5.25.7/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.25.7
    /usr/local/lib/perl5/5.25.7/x86_64-linux
    /usr/local/lib/perl5/5.25.7


Environment for perl 5.25.7:
    HOME=/root
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

PATH=/usr/local/cpanel/3rdparty/perl/524/bin:/usr/local/cpanel/3rdparty/perl/522/bin:/usr/local/cpanel/3rdparty/perl/514/bin:/usr/local/cpanel/3rdparty/bin:/root/bin/:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/cpanel/composer/bin:/root/.dotfiles/bin:/root/perl5/bin:/root/.rvm/bin:/root/bin
    PERL5DB=use Devel::NYTProf
    PERL5LIB=/root/.dotfiles/perl-must-have/lib::/root/perl5/lib/perl5/
    PERL_BADLANG (unset)
    PERL_CPANM_OPT=--quiet
    SHELL=/bin/bash

--------------1.40.perlbug

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2016

From @atoomic

0001-Cleanup-PERL_VERSION-checks-in-.c-files.patch
From d60f4b9eba0447c686d0b9cc5ad93f74146d9833 Mon Sep 17 00:00:00 2001
From: Nicolas R <atoomic@cpan.org>
Date: Sun, 13 Nov 2016 02:16:23 -0700
Subject: [PATCH] Cleanup PERL_VERSION checks in .c files

This commit is removing code not exercised by blead
or any later versions using PERL_VERSION.
This is a noop, mainly cleaning code.
---
 regexec.c   |  7 -------
 universal.c |  5 -----
 vutil.c     | 28 ----------------------------
 3 files changed, 40 deletions(-)

diff --git a/regexec.c b/regexec.c
index 6c5ce9f..c54c159 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3694,9 +3694,6 @@ Perl_re_exec_indentf(pTHX_ const char *fmt, U32 depth, ...)
 STATIC regmatch_state *
 S_push_slab(pTHX)
 {
-#if PERL_VERSION < 9 && !defined(PERL_CORE)
-    dMY_CXT;
-#endif
     regmatch_slab *s = PL_regmatch_slab->next;
     if (!s) {
 	Newx(s, 1, regmatch_slab);
@@ -5328,10 +5325,6 @@ S_backup_one_WB(pTHX_ WB_enum * previous, const U8 * const strbeg, U8 ** curpos,
 STATIC SSize_t
 S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
 {
-
-#if PERL_VERSION < 9 && !defined(PERL_CORE)
-    dMY_CXT;
-#endif
     dVAR;
     const bool utf8_target = reginfo->is_utf8_target;
     const U32 uniflags = UTF8_ALLOW_DEFAULT;
diff --git a/universal.c b/universal.c
index b88d3e2..a9d7514 100644
--- a/universal.c
+++ b/universal.c
@@ -965,12 +965,7 @@ XS(XS_re_regexp_pattern)
         } else {
             /* Scalar, so use the string that Perl would return */
             /* return the pattern in (?msixn:..) format */
-#if PERL_VERSION >= 11
             pattern = sv_2mortal(newSVsv(MUTABLE_SV(re)));
-#else
-            pattern = newSVpvn_flags(RX_WRAPPED(re), RX_WRAPLEN(re),
-				     (RX_UTF8(re) ? SVf_UTF8 : 0) | SVs_TEMP);
-#endif
             PUSHs(pattern);
             XSRETURN(1);
         }
diff --git a/vutil.c b/vutil.c
index bd51707..32fa663 100644
--- a/vutil.c
+++ b/vutil.c
@@ -576,9 +576,6 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)
     const MAGIC *mg;
 #endif
 
-#if PERL_VERSION_LT(5,19,8) && defined(USE_ITHREADS)
-    ENTER;
-#endif
     PERL_ARGS_ASSERT_UPG_VERSION;
 
     if ( (SvUOK(ver) && SvUVX(ver) > VERSION_MAX)
@@ -593,17 +590,11 @@ Perl_upg_version(pTHX_ SV *ver, bool qv)
 		       "Integer overflow in version %d",VERSION_MAX);
     }
     else if ( SvUOK(ver) || SvIOK(ver))
-#if PERL_VERSION_LT(5,17,2)
-VER_IV:
-#endif
     {
 	version = savesvpv(ver);
 	SAVEFREEPV(version);
     }
     else if (SvNOK(ver) && !( SvPOK(ver) && SvCUR(ver) == 3 ) )
-#if PERL_VERSION_LT(5,17,2)
-VER_NV:
-#endif
     {
 	STRLEN len;
 
@@ -612,12 +603,10 @@ VER_NV:
 	SV *sv = SvNVX(ver) > 10e50 ? newSV(64) : 0;
 	char *buf;
 
-#if PERL_VERSION_GE(5,19,0)
 	if (SvPOK(ver)) {
 	    /* dualvar? */
 	    goto VER_PV;
 	}
-#endif
 
 #ifdef USE_LOCALE_NUMERIC
 	{
@@ -686,7 +675,6 @@ VER_PV:
 	version = savepvn(SvPV(ver,len), SvCUR(ver));
 	SAVEFREEPV(version);
 #ifndef SvVOK
-#  if PERL_VERSION > 5
 	/* This will only be executed for 5.6.0 - 5.8.0 inclusive */
 	if ( len >= 3 && !instr(version,".") && !instr(version,"_")) {
 	    /* may be a v-string */
@@ -719,20 +707,8 @@ VER_PV:
 		}
 	    }
 	}
-#  endif
 #endif
     }
-#if PERL_VERSION_LT(5,17,2)
-    else if (SvIOKp(ver)) {
-	goto VER_IV;
-    }
-    else if (SvNOKp(ver)) {
-	goto VER_NV;
-    }
-    else if (SvPOKp(ver)) {
-	goto VER_PV;
-    }
-#endif
     else
     {
 	/* no idea what this is */
@@ -745,10 +721,6 @@ VER_PV:
 		       "Version string '%s' contains invalid data; "
 		       "ignoring: '%s'", version, s);
 
-#if PERL_VERSION_LT(5,19,8) && defined(USE_ITHREADS)
-    LEAVE;
-#endif
-
     return ver;
 }
 
-- 
2.10.2

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2016

From @tonycoz

On Sun, 13 Nov 2016 01​:42​:29 -0800, atoomic@​cpan.org wrote​:

This commit is removing code not exercised by blead
or any later versions using PERL_VERSION.
This is a noop, mainly cleaning code.

vutil.c (as it says at the top) is meant to match the vutil/vutil.c
included in the version distribution on CPAN, which does need to work
with older perls.

The other changes seem sane though.

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2016

From @atoomic

Sorry missed this I assume I do not need to provide an updated patch. As
you just need to reject one file.

On Mon, Nov 14, 2016 at 01​:38 Tony Cook via RT <perlbug-followup@​perl.org>
wrote​:

On Sun, 13 Nov 2016 01​:42​:29 -0800, atoomic@​cpan.org wrote​:

This commit is removing code not exercised by blead
or any later versions using PERL_VERSION.
This is a noop, mainly cleaning code.

vutil.c (as it says at the top) is meant to match the vutil/vutil.c
included in the version distribution on CPAN, which does need to work
with older perls.

The other changes seem sane though.

Tony

---
via perlbug​: queue​: perl5 status​: new
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=130082

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2016

From @atoomic

Updated patch without vutil.c changes

On Sun, 13 Nov 2016 16​:41​:24 -0800, atoomic@​cpan.org wrote​:

Sorry missed this I assume I do not need to provide an updated patch. As
you just need to reject one file.

On Mon, Nov 14, 2016 at 01​:38 Tony Cook via RT <perlbug-followup@​perl.org>
wrote​:

On Sun, 13 Nov 2016 01​:42​:29 -0800, atoomic@​cpan.org wrote​:

This commit is removing code not exercised by blead
or any later versions using PERL_VERSION.
This is a noop, mainly cleaning code.

vutil.c (as it says at the top) is meant to match the vutil/vutil.c
included in the version distribution on CPAN, which does need to work
with older perls.

The other changes seem sane though.

Tony

---
via perlbug​: queue​: perl5 status​: new
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=130082

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2016

From @atoomic

0001-Cleanup-PERL_VERSION-checks-in-.c-files.patch
From d058799276347ecf23ab4f86b7a3dfaa5e43699a Mon Sep 17 00:00:00 2001
From: Nicolas R <atoomic@cpan.org>
Date: Sun, 13 Nov 2016 02:16:23 -0700
Subject: [PATCH 1/1] Cleanup PERL_VERSION checks in .c files

This commit is removing code not exercised by blead
or any later versions using PERL_VERSION.
This is a noop, mainly cleaning code.
---
 regexec.c   | 7 -------
 universal.c | 5 -----
 2 files changed, 12 deletions(-)

diff --git a/regexec.c b/regexec.c
index 6c5ce9f..c54c159 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3694,9 +3694,6 @@ Perl_re_exec_indentf(pTHX_ const char *fmt, U32 depth, ...)
 STATIC regmatch_state *
 S_push_slab(pTHX)
 {
-#if PERL_VERSION < 9 && !defined(PERL_CORE)
-    dMY_CXT;
-#endif
     regmatch_slab *s = PL_regmatch_slab->next;
     if (!s) {
 	Newx(s, 1, regmatch_slab);
@@ -5328,10 +5325,6 @@ S_backup_one_WB(pTHX_ WB_enum * previous, const U8 * const strbeg, U8 ** curpos,
 STATIC SSize_t
 S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
 {
-
-#if PERL_VERSION < 9 && !defined(PERL_CORE)
-    dMY_CXT;
-#endif
     dVAR;
     const bool utf8_target = reginfo->is_utf8_target;
     const U32 uniflags = UTF8_ALLOW_DEFAULT;
diff --git a/universal.c b/universal.c
index b88d3e2..a9d7514 100644
--- a/universal.c
+++ b/universal.c
@@ -965,12 +965,7 @@ XS(XS_re_regexp_pattern)
         } else {
             /* Scalar, so use the string that Perl would return */
             /* return the pattern in (?msixn:..) format */
-#if PERL_VERSION >= 11
             pattern = sv_2mortal(newSVsv(MUTABLE_SV(re)));
-#else
-            pattern = newSVpvn_flags(RX_WRAPPED(re), RX_WRAPLEN(re),
-				     (RX_UTF8(re) ? SVf_UTF8 : 0) | SVs_TEMP);
-#endif
             PUSHs(pattern);
             XSRETURN(1);
         }
-- 
2.10.2

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2016

From @tonycoz

On Mon, 14 Nov 2016 02​:42​:52 -0800, atoomic wrote​:

Updated patch without vutil.c changes

Thanks, applied as 9f94e05.

Tony

@p5pRT
Copy link
Author

p5pRT commented Nov 15, 2016

@tonycoz - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release today of Perl 5.26.0, this and 210 other issues have been
resolved.

Perl 5.26.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.26.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT p5pRT closed this as completed May 30, 2017
@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant