summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-04-17 15:15:57 +0100
committerDavid Mitchell <davem@iabyn.com>2015-04-19 18:42:00 +0100
commit86cd3a13b6713cc9d8406c9316fe126788e2497f (patch)
treea6c38fd58677d1eba2a11198d15e39225df4eaee /op.h
parent93059c1aaf5fd5adc05efe29bdcc6c719aef3108 (diff)
downloadperl-86cd3a13b6713cc9d8406c9316fe126788e2497f.tar.gz
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.
Diffstat (limited to 'op.h')
-rw-r--r--op.h15
1 files changed, 12 insertions, 3 deletions
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)