summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embed.fnc4
-rw-r--r--pod/perldelta.pod9
-rw-r--r--pp_ctl.c14
-rw-r--r--proto.h9
-rw-r--r--regcomp.c2
5 files changed, 35 insertions, 3 deletions
diff --git a/embed.fnc b/embed.fnc
index 4c5f0ed1ec..edab49dc3a 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1174,7 +1174,9 @@ Apd |I32 |sv_cmp_locale_flags |NULLOK SV *const sv1 \
Amd |char* |sv_collxfrm |NN SV *const sv|NN STRLEN *const nxp
Apd |char* |sv_collxfrm_flags |NN SV *const sv|NN STRLEN *const nxp|I32 const flags
#endif
-Ap |OP* |sv_compile_2op |NN SV *sv|NN OP **startop \
+po |OP* |sv_compile_2op_is_broken|NN SV *sv|NN OP **startop \
+ |NN const char *code|NN PAD **padp
+ApD |OP* |sv_compile_2op |NN SV *sv|NN OP **startop \
|NN const char *code|NN PAD **padp
Apd |int |getcwd_sv |NN SV* sv
Apd |void |sv_dec |NULLOK SV *const sv
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index b1da9b8f03..624e4f5c63 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -53,6 +53,15 @@ listed as an updated module in the L</Modules and Pragmata> section.
[ List each deprecation as a =head2 entry ]
+=head2 C<sv_compile_2op> is now deprecated
+
+The C<sv_compile_2op> is now deprecated, and will be removed. Searches suggest
+that nothing on CPAN is using it, so this should have zero impact.
+
+It attempted to provide an API to compile code down to an optree, but failed
+to bind correctly to lexicals in the enclosing scope. It's not possible to
+fix this problem within the constraints of its parameters and return value.
+
=head1 Performance Enhancements
XXX Changes which enhance performance without changing behaviour go here. There
diff --git a/pp_ctl.c b/pp_ctl.c
index 3e6e46c389..54e7c256a7 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2982,6 +2982,8 @@ S_docatch(pTHX_ OP *o)
called more than once, and is only used by regcomp.c, for (?{}) blocks.
Currently it is not used outside the core code. Best if it stays that way.
+
+ Hence it's now deprecated, and will be removed.
*/
OP *
Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
@@ -2989,6 +2991,16 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
/* startop op_free() this to undo. */
/* code Short string id of the caller. */
{
+ PERL_ARGS_ASSERT_SV_COMPILE_2OP;
+ return Perl_sv_compile_2op_is_broken(aTHX_ sv, startop, code, padp);
+}
+
+/* Don't use this. It will go away without warning once the regexp engine is
+ refactored not to use it. */
+OP *
+Perl_sv_compile_2op_is_broken(pTHX_ SV *sv, OP **startop, const char *code,
+ PAD **padp)
+{
dVAR; dSP; /* Make POPBLOCK work. */
PERL_CONTEXT *cx;
SV **newsp;
@@ -3003,7 +3015,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
STRLEN len;
bool need_catch;
- PERL_ARGS_ASSERT_SV_COMPILE_2OP;
+ PERL_ARGS_ASSERT_SV_COMPILE_2OP_IS_BROKEN;
ENTER_with_name("eval");
lex_start(sv, NULL, 0);
diff --git a/proto.h b/proto.h
index 194d7abf42..6b3fe7739e 100644
--- a/proto.h
+++ b/proto.h
@@ -4020,6 +4020,7 @@ PERL_CALLCONV I32 Perl_sv_cmp_flags(pTHX_ SV *const sv1, SV *const sv2, const U3
PERL_CALLCONV I32 Perl_sv_cmp_locale(pTHX_ SV *const sv1, SV *const sv2);
PERL_CALLCONV I32 Perl_sv_cmp_locale_flags(pTHX_ SV *const sv1, SV *const sv2, const U32 flags);
PERL_CALLCONV OP* Perl_sv_compile_2op(pTHX_ SV *sv, OP **startop, const char *code, PAD **padp)
+ __attribute__deprecated__
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3)
@@ -4027,6 +4028,14 @@ PERL_CALLCONV OP* Perl_sv_compile_2op(pTHX_ SV *sv, OP **startop, const char *co
#define PERL_ARGS_ASSERT_SV_COMPILE_2OP \
assert(sv); assert(startop); assert(code); assert(padp)
+PERL_CALLCONV OP* Perl_sv_compile_2op_is_broken(pTHX_ SV *sv, OP **startop, const char *code, PAD **padp)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2)
+ __attribute__nonnull__(pTHX_3)
+ __attribute__nonnull__(pTHX_4);
+#define PERL_ARGS_ASSERT_SV_COMPILE_2OP_IS_BROKEN \
+ assert(sv); assert(startop); assert(code); assert(padp)
+
PERL_CALLCONV void Perl_sv_copypv(pTHX_ SV *const dsv, SV *const ssv)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
diff --git a/regcomp.c b/regcomp.c
index f01d54507d..07834a034e 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6074,7 +6074,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
ENTER;
Perl_save_re_context(aTHX);
- rop = sv_compile_2op(sv, &sop, "re", &pad);
+ rop = Perl_sv_compile_2op_is_broken(aTHX_ sv, &sop, "re", &pad);
sop->op_private |= OPpREFCOUNTED;
/* re_dup will OpREFCNT_inc */
OpREFCNT_set(sop, 1);