summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-05-27 17:45:50 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-05-27 17:46:08 -0700
commit4587c5322c964beac01a38188957ca11026dc766 (patch)
tree8b4a16d53c35dd055d52433514ba82f9e52ec951 /cop.h
parent717a97bab95e1c5b372d6ecc681398092afcffd6 (diff)
downloadperl-4587c5322c964beac01a38188957ca11026dc766.tar.gz
[perl #117947] Verify lvalueness of XSUBs at run time
If the sub is not visible at compile time, the op tree is flagged such that pp_entersub will know whether to check the lvalueness of the called sub. That check has been in pp_entersub since da1dff9483c. When I moved it to pp_entersub in that commit, I only added it to the pure-Perl branch, not to the XS branch, allowing all XSUBs to be treated as lvalues if they are not visible at compile time.
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/cop.h b/cop.h
index a7367683fd..94a1267eba 100644
--- a/cop.h
+++ b/cop.h
@@ -596,16 +596,19 @@ struct block_format {
SAVEFREESV(cv); \
}
-
-#define PUSHSUB(cx) \
- { \
+#define PUSHSUB_GET_LVALUE_MASK(func) \
/* If the context is indeterminate, then only the lvalue */ \
/* flags that the caller also has are applicable. */ \
- U8 phlags = \
+ ( \
(PL_op->op_flags & OPf_WANT) \
? OPpENTERSUB_LVAL_MASK \
: !(PL_op->op_private & OPpENTERSUB_LVAL_MASK) \
- ? 0 : (U8)Perl_was_lvalue_sub(aTHX); \
+ ? 0 : (U8)func(aTHX) \
+ )
+
+#define PUSHSUB(cx) \
+ { \
+ U8 phlags = PUSHSUB_GET_LVALUE_MASK(Perl_was_lvalue_sub); \
PUSHSUB_BASE(cx) \
cx->blk_u16 = PL_op->op_private & \
(phlags|OPpDEREF); \