Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #132761] [PATCH] Devel::PPPort for older Perl versions

4 views
Skip to first unread message

(via RT)

unread,
Jan 24, 2018, 3:15:03 PM1/24/18
to bugs-bi...@rt.perl.org
# New Ticket Created by
# Please include the string: [perl #132761]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=132761 >


After discussion on #p5p, I'm sending 3 patches for Devel::PPPort.
0001-Devel-PPPort-Do-not-mask-Perl_warn_nocontext-and-Per.patch
0002-Devel-PPPort-Do-not-define-PERL_MAGIC_qr-more-times.patch
0003-Devel-PPPort-Do-not-run-tests-which-use-N-U-XX-on-Pe.patch

Tony Cook via RT

unread,
Jan 24, 2018, 7:00:04 PM1/24/18
to perl5-...@perl.org
On Wed, 24 Jan 2018 12:07:17 -0800, pa...@cpan.org wrote:
> After discussion on #p5p, I'm sending 3 patches for Devel::PPPort.

In 5.8.9 (threaded)RealPPPort.xs: In function ‘XS_Devel__PPPort_croak_xs_usage’:
RealPPPort.xs:1553:20: warning: passing argument 1 of ‘DPPP_my_croak_xs_usage’ from incompatible pointer type [-Wincompatible-pointer-types]
croak_xs_usage(cv, params);
^~
In file included from /home/tony/perl/5.8.9-thr/lib/5.8.9/x86_64-linux-thread-multi/CORE/perl.h:38:0,
from RealPPPort.xs:31:
ppport.h:3659:26: note: expected ‘PerlInterpreter * {aka struct interpreter *}’ but argument is of type ‘CV * {aka struct cv *}’
# define DPPP_NAMESPACE DPPP_
^
/home/tony/perl/5.8.9-thr/lib/5.8.9/x86_64-linux-thread-multi/CORE/config.h:936:27: note: in definition of macro ‘PeRl_CaTiFy’
#define PeRl_CaTiFy(a, b) a ## b
^
ppport.h:3662:24: note: in expansion of macro ‘CAT2’
#define DPPP_CAT2(x,y) CAT2(x,y)
^~~~
ppport.h:3663:21: note: in expansion of macro ‘DPPP_CAT2’
#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
^~~~~~~~~
ppport.h:3663:31: note: in expansion of macro ‘DPPP_NAMESPACE’
#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
^~~~~~~~~~~~~~
ppport.h:5351:1: note: in expansion of macro ‘DPPP_’
DPPP_(my_croak_xs_usage)(pTHX_ const CV *const cv, const char *const params)
^~~~~
RealPPPort.xs:1553:24: warning: passing argument 2 of ‘DPPP_my_croak_xs_usage’ from incompatible pointer type [-Wincompatible-pointer-types]
croak_xs_usage(cv, params);
^~~~~~
In file included from /home/tony/perl/5.8.9-thr/lib/5.8.9/x86_64-linux-thread-multi/CORE/perl.h:38:0,
from RealPPPort.xs:31:
ppport.h:3659:26: note: expected ‘const CV * const {aka const struct cv * const’ but argument is of type ‘char *’
# define DPPP_NAMESPACE DPPP_
^
/home/tony/perl/5.8.9-thr/lib/5.8.9/x86_64-linux-thread-multi/CORE/config.h:936:27: note: in definition of macro ‘PeRl_CaTiFy’
#define PeRl_CaTiFy(a, b) a ## b
^
ppport.h:3662:24: note: in expansion of macro ‘CAT2’
#define DPPP_CAT2(x,y) CAT2(x,y)
^~~~
ppport.h:3663:21: note: in expansion of macro ‘DPPP_CAT2’
#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
^~~~~~~~~
ppport.h:3663:31: note: in expansion of macro ‘DPPP_NAMESPACE’
#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
^~~~~~~~~~~~~~
ppport.h:5351:1: note: in expansion of macro ‘DPPP_’
DPPP_(my_croak_xs_usage)(pTHX_ const CV *const cv, const char *const params)
^~~~~
ppport.h:3659:26: error: too few arguments to function ‘DPPP_my_croak_xs_usage’
# define DPPP_NAMESPACE DPPP_
^
/home/tony/perl/5.8.9-thr/lib/5.8.9/x86_64-linux-thread-multi/CORE/config.h:936:27: note: in definition of macro ‘PeRl_CaTiFy’
#define PeRl_CaTiFy(a, b) a ## b
^
ppport.h:3662:24: note: in expansion of macro ‘CAT2’
#define DPPP_CAT2(x,y) CAT2(x,y)
^~~~
ppport.h:3663:21: note: in expansion of macro ‘DPPP_CAT2’
#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
^~~~~~~~~
ppport.h:3663:31: note: in expansion of macro ‘DPPP_NAMESPACE’
#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
^~~~~~~~~~~~~~
ppport.h:5346:24: note: in expansion of macro ‘DPPP_’
#define croak_xs_usage DPPP_(my_croak_xs_usage)
^~~~~
RealPPPort.xs:1553:5: note: in expansion of macro ‘croak_xs_usage’
croak_xs_usage(cv, params);
^~~~~~~~~~~~~~
ppport.h:3659:26: note: declared here
# define DPPP_NAMESPACE DPPP_
^
/home/tony/perl/5.8.9-thr/lib/5.8.9/x86_64-linux-thread-multi/CORE/config.h:936:27: note: in definition of macro ‘PeRl_CaTiFy’
#define PeRl_CaTiFy(a, b) a ## b
^
ppport.h:3662:24: note: in expansion of macro ‘CAT2’
#define DPPP_CAT2(x,y) CAT2(x,y)
^~~~
ppport.h:3663:21: note: in expansion of macro ‘DPPP_CAT2’
#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
^~~~~~~~~
ppport.h:3663:31: note: in expansion of macro ‘DPPP_NAMESPACE’
#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
^~~~~~~~~~~~~~
ppport.h:5351:1: note: in expansion of macro ‘DPPP_’
DPPP_(my_croak_xs_usage)(pTHX_ const CV *const cv, const char *const params)
^~~~~

5.6.2 threaded fails similarly.

Tony

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

pa...@cpan.org

unread,
Jan 24, 2018, 7:30:02 PM1/24/18
to perlbug-...@perl.org
On Wednesday 24 January 2018 15:55:04 Tony Cook via RT wrote:
> On Wed, 24 Jan 2018 12:07:17 -0800, pa...@cpan.org wrote:
> > After discussion on #p5p, I'm sending 3 patches for Devel::PPPort.
>
> In 5.8.9 (threaded)RealPPPort.xs: In function ‘XS_Devel__PPPort_croak_xs_usage’:
> RealPPPort.xs:1553:20: warning: passing argument 1 of ‘DPPP_my_croak_xs_usage’ from incompatible pointer type [-Wincompatible-pointer-types]
> croak_xs_usage(cv, params);
> ^~
> In file included from /home/tony/perl/5.8.9-thr/lib/5.8.9/x86_64-linux-thread-multi/CORE/perl.h:38:0,
> from RealPPPort.xs:31:
> ppport.h:3659:26: note: expected ‘PerlInterpreter * {aka struct interpreter *}’ but argument is of type ‘CV * {aka struct cv *}’

#define croak_xs_usage DPPP_(my_croak_xs_usage)

Macro croak_xs_usage was incorrectly generated in ppport.h. There is
missing aTHX_.

Seems that generating script do not add aTHX_ when function has defined
'n' in embded.fnc file. Following patch seems to fixes it:

diff --git a/dist/Devel-PPPort/parts/embed.fnc b/dist/Devel-PPPort/parts/embed.fnc
index 1f347c2b83..a9e726f5f2 100644
--- a/dist/Devel-PPPort/parts/embed.fnc
+++ b/dist/Devel-PPPort/parts/embed.fnc
@@ -278,7 +278,7 @@ Aprd |void |croak_sv |NN SV *baseex
Afprd |void |croak |NULLOK const char* pat|...
Aprd |void |vcroak |NULLOK const char* pat|NULLOK va_list* args
Anprd |void |croak_no_modify
-Anprd |void |croak_xs_usage |NN const CV *const cv \
+Aprd |void |croak_xs_usage |NN const CV *const cv \
|NN const char *const params
npr |void |croak_no_mem
nprX |void |croak_popstack

But I have no idea if removing 'n' is a good idea. Or if there is a bug
in PPPort_pm.PL generator in sub make_embed.

Anyway, after applying above patch in ppport.h is:

#define croak_xs_usage(a,b) DPPP_(my_croak_xs_usage)(aTHX_ a,b)

which looks correct.

Tony Cook via RT

unread,
Jan 24, 2018, 10:45:02 PM1/24/18
to perl5-...@perl.org
No, it would be incompatible with the core croak_xs_usage().

With PERL_NO_GET_CONTEXT defined the core croak_xs_usage() can be called without a context in scope, eg:

static void foo(CV *cv) {
croak_xs_usage(cv, "param1, param2");
}

would work with the core croak_xs_usage() but not the ppport.h version.

The attached fixes it for me, tested on my random perl build collection.

Tony

---
via perlbug: queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=132761
0001-perl-132761-croak_xs_usage-shouldn-t-accept-a-THX-ar.patch

pa...@cpan.org

unread,
Jan 25, 2018, 3:45:02 AM1/25/18
to perlbug-...@perl.org
On Wednesday 24 January 2018 19:41:02 Tony Cook via RT wrote:
> From 0874dc6ed2d15e8e4ca523016101cb80c200a163 Mon Sep 17 00:00:00 2001
> From: Tony Cook <to...@develop-help.com>
> Date: Thu, 25 Jan 2018 14:39:54 +1100
> Subject: (perl #132761) croak_xs_usage() shouldn't accept a THX arguement
>
> ---
> dist/Devel-PPPort/parts/inc/mess | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dist/Devel-PPPort/parts/inc/mess b/dist/Devel-PPPort/parts/inc/mess
> index 9ef95cf889..e916ea7792 100644
> --- a/dist/Devel-PPPort/parts/inc/mess
> +++ b/dist/Devel-PPPort/parts/inc/mess
> @@ -206,7 +206,7 @@ mess_sv(pTHX_ SV *basemsg, bool consume)
> #ifndef croak_xs_usage
> #if { NEED croak_xs_usage }
> void
> -croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
> +croak_xs_usage(const CV *const cv, const char *const params)
> {
> const GV *const gv = CvGV(cv);

Does not CvGV need to declare dTHX; when pTHX_ is not supplied as
argument?

>
> --
> 2.11.0
>

pa...@cpan.org

unread,
Jan 26, 2018, 2:30:02 PM1/26/18
to perlbug-...@perl.org
Also croak() needs it. In attachment are another two patches which
should fix these problems.
0005-Devel-PPPort-Declare-dTHX-in-croak_xs_usage.patch
0006-Devel-PPPort-Use-croak_nocontext-intead-of-croak-whe.patch

pa...@cpan.org

unread,
Jan 26, 2018, 4:00:02 PM1/26/18
to perlbug-...@perl.org
I configured TravisCI and AppVeyor testing for Devel-PPPort from blead
with applied all 6 patches from this ticket and tests passed for all
configured Perl versions on Linux and Windows. See detailed results:

https://travis-ci.org/pali/Devel-PPPort
https://ci.appveyor.com/project/pali/Devel-PPPort

Therefore with these 6 patches Devel::PPPort should work fine on
Linux, Windows, 32bit Perl, 64bit Perl and older Perl versions...

Tony Cook via RT

unread,
Jan 30, 2018, 7:15:02 PM1/30/18
to perl5-...@perl.org
Thanks, applied as 11eb46e92e3b89398d0d9878da8a5b434aaf563a through 95afac5cb6951e84cb1a8c9a7af2f0eac829d512 and bumped the version in 0a6ff076732e9ade9613a8567e7089c0c8e7d750.
0 new messages