summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-05-10 01:32:10 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-05-10 01:32:10 +0000
commit5f2d99664d8a6923d24892ffc0569f4e03e22edd (patch)
tree9d91bd681577184ff755bb9e9978f9a4bea8644d /op.c
parent262cbcdb563b9a037afe19e3ef94322ccc35436a (diff)
downloadperl-5f2d99664d8a6923d24892ffc0569f4e03e22edd.tar.gz
disable WARN and DIE hooks during constant folding
p4raw-id: //depot/perl@28148
Diffstat (limited to 'op.c')
-rw-r--r--op.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/op.c b/op.c
index 1421e05b72..f5e24fcdea 100644
--- a/op.c
+++ b/op.c
@@ -2135,6 +2135,8 @@ Perl_fold_constants(pTHX_ register OP *o)
int ret = 0;
I32 oldscope;
OP *old_next;
+ SV * const oldwarnhook = PL_warnhook;
+ SV * const olddiehook = PL_diehook;
dJMPENV;
if (PL_opargs[type] & OA_RETSCALAR)
@@ -2196,6 +2198,8 @@ Perl_fold_constants(pTHX_ register OP *o)
oldscope = PL_scopestack_ix;
create_eval_scope(G_FAKINGEVAL);
+ PL_warnhook = PERL_WARNHOOK_FATAL;
+ PL_diehook = NULL;
JMPENV_PUSH(ret);
switch (ret) {
@@ -2209,11 +2213,6 @@ Perl_fold_constants(pTHX_ register OP *o)
SvTEMP_off(sv);
}
break;
- case 2:
- /* my_exit() was called; propagate it */
- JMPENV_POP;
- JMPENV_JUMP(2);
- /* NOTREACHED */
case 3:
/* Something tried to die. Abandon constant folding. */
/* Pretend the error never happened. */
@@ -2222,11 +2221,16 @@ Perl_fold_constants(pTHX_ register OP *o)
break;
default:
JMPENV_POP;
- /* Don't expect 1 (setjmp failed) */
+ /* Don't expect 1 (setjmp failed) or 2 (something called my_exit) */
+ PL_warnhook = oldwarnhook;
+ PL_diehook = olddiehook;
+ /* XXX note that this croak may fail as we've already blown away
+ * the stack - eg any nested evals */
Perl_croak(aTHX_ "panic: fold_constants JMPENV_PUSH returned %d", ret);
}
-
JMPENV_POP;
+ PL_warnhook = oldwarnhook;
+ PL_diehook = olddiehook;
if (PL_scopestack_ix > oldscope)
delete_eval_scope();