develooper Front page | perl.perl5.porters | Postings from January 2018

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

Thread Previous | Thread Next
From:
Tony Cook via RT
Date:
January 25, 2018 03:41
Subject:
[perl #132761] [PATCH] Devel::PPPort for older Perl versions
Message ID:
rt-4.0.24-15905-1516851662-672.132761-15-0@perl.org
On Wed, 24 Jan 2018 16:15:38 -0800, pali@cpan.org wrote:
> On Wednesday 24 January 2018 15:55:04 Tony Cook via RT wrote:
> > On Wed, 24 Jan 2018 12:07:17 -0800, pali@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.

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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About