From 86cd3a13b6713cc9d8406c9316fe126788e2497f Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 17 Apr 2015 15:15:57 +0100 Subject: op_sibling => op_sibparent under PERL_OP_PARENT On perls built under -DPERL_OP_PARENT, rename the op_sibling OP field to op_sibparent, since it can now contain either a pointer to the next sibling if not the last sibling, or back to the parent if it is. Code written to work under PERL_OP_PARENT should be using macros like OpSIBLING() rather than accessing op_sibling directly, so this should be a transparent change. It will also make code naughtily accessing this field directly give a compile error. --- op.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'op.h') diff --git a/op.h b/op.h index 9e6bb43e1d..4eede91f14 100644 --- a/op.h +++ b/op.h @@ -38,12 +38,21 @@ typedef PERL_BITFIELD16 Optype; +/* this field now either points to the next sibling or to the parent, + * depending on op_lastsib. So rename it from op_sibling to op_sibparent. + */ +#ifdef PERL_OP_PARENT +# define _OP_SIBPARENT_FIELDNAME op_sibparent +#else +# define _OP_SIBPARENT_FIELDNAME op_sibling +#endif + #ifdef BASEOP_DEFINITION #define BASEOP BASEOP_DEFINITION #else #define BASEOP \ OP* op_next; \ - OP* op_sibling; \ + OP* _OP_SIBPARENT_FIELDNAME;\ OP* (*op_ppaddr)(pTHX); \ PADOFFSET op_targ; \ PERL_BITFIELD16 op_type:9; \ @@ -973,8 +982,8 @@ Sets the sibling of o to sib #ifdef PERL_OP_PARENT # define OpHAS_SIBLING(o) (!cBOOL((o)->op_lastsib)) -# define OpSIBLING(o) (0 + (o)->op_lastsib ? NULL : (o)->op_sibling) -# define OpSIBLING_set(o, sib) ((o)->op_sibling = (sib)) +# define OpSIBLING(o) (0 + (o)->op_lastsib ? NULL : (o)->op_sibparent) +# define OpSIBLING_set(o, sib) ((o)->op_sibparent = (sib)) #else # define OpHAS_SIBLING(o) (cBOOL((o)->op_sibling)) # define OpSIBLING(o) (0 + (o)->op_sibling) -- cgit v1.2.1