Re: Refactoring the core to use *_set macros

[email protected] (Nicholas Clark) Wed, 6 Apr 2005 20:10:48 +0100
Newsgroups perl.ponie.dev
Message-ID <[email protected]>
On Wed, Apr 06, 2005 at 12:46:28PM -0500, Steve Peters wrote:
> Since this task seem relatively easy for someone with C knowledge and 
> a light knowledge of the Perl core, I'll get started on this.  My hope
> is to provide patches for each *_set() as they are repleaced to this
> list and to the p5p list for inclusion into bleadperl.
> 
> For this list, can you all take the patches from a current blead or
> should I provide a patch against the ponie CVS.

I can get them from a current blead, which I believe reduces your admin faff
and gives you more time to hack.

Thanks for volunteering to attempt this.

I'm not sure how you were thinking of doing it, but the way I was going to
go about it was temporarily change the LVALUE macros such as SvNVX() to
not be - eg:

#define SvNVX(sv)  ((XPVNV*)SvANY(sv))->xnv_nv)

becomes

#define SvNVX(sv)  (0+((XPVNV*)SvANY(sv))->xnv_nv)

and the compiler then does all the finding:

`sh  cflags "optimize='-O2'" toke.o`  toke.c
          CCCMD =  ccache gcc -DPERL_CORE -c -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -O2  -Wall
toke.c: In function `S_force_version':
toke.c:1014: error: invalid lvalue in assignment
make: *** [toke.o] Error 1

:-)

The only niggly bit is that SvNV_set needs to be changed, as it's currently
expressed in terms of SvNVX(). Oops.

Nicholas Clark