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

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

Thread Next
January 25, 2018 00:15
Re: [perl #132761] [PATCH] Devel::PPPort for older Perl versions
Message ID:
On Wednesday 24 January 2018 15:55:04 Tony Cook via RT wrote:
> On Wed, 24 Jan 2018 12:07:17 -0800, 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.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About