summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2019-02-04 13:48:13 +0000
committerDavid Mitchell <davem@iabyn.com>2019-02-05 14:03:05 +0000
commit72876cce4ecc7d8756e00d284e32df0b943d0da9 (patch)
treeeb2fbf4d5389c41ab464221a1089a9eb00429389 /pp.h
parent35c1827fadfaf0a26b8d1373f06ee242ee79c111 (diff)
downloadperl-72876cce4ecc7d8756e00d284e32df0b943d0da9.tar.gz
Eliminate opASSIGN macro usage from core
This macro is defined as (PL_op->op_flags & OPf_STACKED) and indicates, for ops which support it, that the mutator-variant of the op is present (e.g. $x += 1). This macro was mainly used as an arg for the old-style overloading macros (tryAMAGICbin()) which were eliminated several years ago. This commit removes its vestigial usage, and instead tests OPf_STACKED directly at each location, along with adding a comment about the significance of the flag. This removes one item of obfuscation from the overloading code. There is one potentially functional change in this commit: Perl_try_amagic_bin() was sometimes testing for OPf_STACKED without first checking that it had been called with the AMGf_assign flag (which indicates that this op supports a mutator variant). With this commit, it now checks first, so this is theoretically a bug fix. In practice that section of code was never reached without AMGf_assign always being set anyway.
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/pp.h b/pp.h
index 55efa0ba4e..61e26c5dc8 100644
--- a/pp.h
+++ b/pp.h
@@ -553,7 +553,7 @@ Does not use C<TARG>. See also C<L</XPUSHu>>, C<L</mPUSHu>> and C<L</PUSHu>>.
#define AMGf_noright 1
#define AMGf_noleft 2
-#define AMGf_assign 4
+#define AMGf_assign 4 /* op supports mutator variant, e.g. $x += 1 */
#define AMGf_unary 8
#define AMGf_numeric 0x10 /* for Perl_try_amagic_bin */
#define AMGf_set 0x20 /* for Perl_try_amagic_bin */
@@ -608,7 +608,7 @@ Does not use C<TARG>. See also C<L</XPUSHu>>, C<L</mPUSHu>> and C<L</PUSHu>>.
else { /* AMGf_want_scalar */ \
dATARGET; /* just use the arg's location */ \
sv_setsv(TARG, tmpsv); \
- if (opASSIGN) \
+ if (PL_op->op_flags & OPf_STACKED) \
sp--; \
SETTARG; \
} \
@@ -634,6 +634,7 @@ Does not use C<TARG>. See also C<L</XPUSHu>>, C<L</mPUSHu>> and C<L</PUSHu>>.
} STMT_END
+/* 2019: no longer used in core */
#define opASSIGN (PL_op->op_flags & OPf_STACKED)
/*