Fix for Perl 5.14

Started by Alex Hunsakerover 14 years ago5 messages
#1Alex Hunsaker
badalex@gmail.com
2 attachment(s)

Perl 5.14.0-RC1 came out a few days ago...

There is a minor compile time error due to the API changing a bit:
plperl.c:929:3: error: lvalue required as left operand of assignment

This is due to GvCV() no longer returning an lvalue, instead they want
us to use the new GvCV_set macro. (see
http://search.cpan.org/~jesse/perl-5.14.0-RC1/pod/perldelta.pod#GvCV()_and_GvGP()_are_no_longer_lvalues)

Unfortunately that macro is not available on older perls so the
attached provides our own macro when GvCV_set is not defined.

Tested with 5.14.0-rc1 and 5.12.3.

The -head patch applies with fuzz to 9.0. The 8.4 patch applies clean
to 8.4 and with fuzz to 8.3 and 8.2.

Attachments:

plperl_5.14_head.patchtext/x-patch; charset=US-ASCII; name=plperl_5.14_head.patchDownload
*** a/src/pl/plperl/plperl.c
--- b/src/pl/plperl/plperl.c
***************
*** 926,932 **** plperl_trusted_init(void)
  		if (!isGV_with_GP(sv) || !GvCV(sv))
  			continue;
  		SvREFCNT_dec(GvCV(sv)); /* free the CV */
! 		GvCV(sv) = NULL;		/* prevent call via GV */
  	}
  	hv_clear(stash);
  
--- 926,932 ----
  		if (!isGV_with_GP(sv) || !GvCV(sv))
  			continue;
  		SvREFCNT_dec(GvCV(sv)); /* free the CV */
! 		GvCV_set(sv, NULL);		/* prevent call via GV */
  	}
  	hv_clear(stash);
  
*** a/src/pl/plperl/plperl.h
--- b/src/pl/plperl/plperl.h
***************
*** 49,54 ****
--- 49,59 ----
  								(U32)HeKUTF8(he))
  #endif
  
+ /* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
+ #ifndef GvCV_set
+ #define GvCV_set(gv, cv)		(GvCV(gv) = cv)
+ #endif
+ 
  /* declare routines from plperl.c for access by .xs files */
  HV		   *plperl_spi_exec(char *, int);
  void		plperl_return_next(SV *);
plperl_5.14_8.4.patchtext/x-patch; charset=US-ASCII; name=plperl_5.14_8.4.patchDownload
*** a/src/pl/plperl/plperl.c
--- b/src/pl/plperl/plperl.c
***************
*** 700,706 **** plperl_trusted_init(void)
  		if (!isGV_with_GP(sv) || !GvCV(sv))
  			continue;
  		SvREFCNT_dec(GvCV(sv)); /* free the CV */
! 		GvCV(sv) = NULL;		/* prevent call via GV */
  	}
  	hv_clear(stash);
  	/* invalidate assorted caches */
--- 700,706 ----
  		if (!isGV_with_GP(sv) || !GvCV(sv))
  			continue;
  		SvREFCNT_dec(GvCV(sv)); /* free the CV */
! 		GvCV_set(sv, NULL);		/* prevent call via GV */
  	}
  	hv_clear(stash);
  	/* invalidate assorted caches */
*** a/src/pl/plperl/plperl.h
--- b/src/pl/plperl/plperl.h
***************
*** 43,48 ****
--- 43,53 ----
  #undef bool
  #endif
  
+ /* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
+ #ifndef GvCV_set
+ #define GvCV_set(gv, cv)		(GvCV(gv) = cv)
+ #endif
+ 
  /* routines from spi_internal.c */
  int			spi_DEBUG(void);
  int			spi_LOG(void);
#2Andrew Dunstan
andrew@dunslane.net
In reply to: Alex Hunsaker (#1)
Re: Fix for Perl 5.14

On 04/23/2011 03:02 AM, Alex Hunsaker wrote:

Perl 5.14.0-RC1 came out a few days ago...

There is a minor compile time error due to the API changing a bit:
plperl.c:929:3: error: lvalue required as left operand of assignment

This is due to GvCV() no longer returning an lvalue, instead they want
us to use the new GvCV_set macro. (see
http://search.cpan.org/~jesse/perl-5.14.0-RC1/pod/perldelta.pod#GvCV()_and_GvGP()_are_no_longer_lvalues)

Unfortunately that macro is not available on older perls so the
attached provides our own macro when GvCV_set is not defined.

Tested with 5.14.0-rc1 and 5.12.3.

The -head patch applies with fuzz to 9.0. The 8.4 patch applies clean
to 8.4 and with fuzz to 8.3 and 8.2.

How nice of them not to fix it in ppport.h. I thought this is exactly
the sort of thing it's for.

This looks OK, but I think we need to wait until they remove the RC tag.

cheers

andrew

#3Alex Hunsaker
badalex@gmail.com
In reply to: Andrew Dunstan (#2)
1 attachment(s)
Re: Fix for Perl 5.14

On Sat, Apr 23, 2011 at 07:00, Andrew Dunstan <andrew@dunslane.net> wrote:

On 04/23/2011 03:02 AM, Alex Hunsaker wrote:

...
There is a minor compile time error due to the API changing a bit:
plperl.c:929:3: error: lvalue required as left operand of assignment
...
Unfortunately  that macro is not available on older perls so the
attached provides our own macro when GvCV_set is not defined.

How nice of them not to fix it in ppport.h. I thought this is exactly the
sort of thing it's for.

Hrm, I have the latest released version of Devel::PPPort, 3.19. I went
poking around and found the have a newer "developer" release (3.19_03)
at http://search.cpan.org/~mhx/Devel-PPPort-3.19_03/ (released
2011-04-13). I see a few things for 5.14 but nothing about GvCV_set.
Maybe I'm doing something wrong? I'm just diffing its ppport.h with
ours. For the curious its attached.

This looks OK, but I think we need to wait until they remove the RC tag.

Makes sense, Ill repost once they do ;).

Attachments:

ppport.patch.gzapplication/x-gzip; name=ppport.patch.gzDownload
#4Reini Urban
rurban@x-ray.at
In reply to: Andrew Dunstan (#2)
Re: Fix for Perl 5.14

2011/4/23 Andrew Dunstan <andrew@dunslane.net>:

On 04/23/2011 03:02 AM, Alex Hunsaker wrote:

Perl 5.14.0-RC1 came out a few days ago...

There is a minor compile time error due to the API changing a bit:
plperl.c:929:3: error: lvalue required as left operand of assignment

This is due to GvCV() no longer returning an lvalue, instead they want
us to use the new GvCV_set macro. (see

http://search.cpan.org/~jesse/perl-5.14.0-RC1/pod/perldelta.pod#GvCV()_and_GvGP()_are_no_longer_lvalues)

Unfortunately  that macro is not available on older perls so the
attached provides our own macro when GvCV_set is not defined.

Tested with 5.14.0-rc1 and 5.12.3.

The -head patch applies with fuzz to 9.0. The 8.4 patch applies clean
to 8.4 and with fuzz to 8.3 and 8.2.

How nice of them not to fix it in ppport.h. I thought this is exactly the
sort of thing it's for.

It's not so easy to convert
foo = GvCV(bah);
to a
GvCV_set(foo, bar);
with a ppport.h macro automatically.

But yes, the backport GvCV_set => lvalue GvCV should be in ppport.h.
It is not yet
--
Reini Urban

#5Alex Hunsaker
badalex@gmail.com
In reply to: Andrew Dunstan (#2)
Re: Fix for Perl 5.14

On Sat, Apr 23, 2011 at 07:00, Andrew Dunstan <andrew@dunslane.net> wrote:

This looks OK, but I think we need to wait until they remove the RC tag.

5.14.0 is out now, Ive retested with 5.14.0 (x86-64), 5.12.3 (x86-64)
and 5.10.1 (i386). No changes are needed.

[ if you missed it ]
The Devel::PPPort guy said patches are welcome and he won't be able to
look into this until at least june.