summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-08-16 19:49:09 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-08-16 19:49:09 +0000
commit5779bbb1f597d1ebb4c7e5a72ad2a31cf4b91093 (patch)
tree2f4e2e4cbb1198159afa59bfc8d6529c21a44f1e
parentca24dfc6e670a1e3ff3c351be5646eb755ffa455 (diff)
parenta7c6d24429ab2b6db54575a3bdc62c7ed9f881cf (diff)
downloadperl-5779bbb1f597d1ebb4c7e5a72ad2a31cf4b91093.tar.gz
Integrate with Nick.
p4raw-id: //depot/cfgperl@3999
-rw-r--r--cop.h1
-rw-r--r--op.c2
-rw-r--r--perl.c10
-rwxr-xr-xt/op/eval.t7
-rw-r--r--t/pragma/warn/op16
-rw-r--r--util.c6
6 files changed, 22 insertions, 20 deletions
diff --git a/cop.h b/cop.h
index 84afd58967..f23251b543 100644
--- a/cop.h
+++ b/cop.h
@@ -297,6 +297,7 @@ struct context {
#define G_NOARGS 8 /* Don't construct a @_ array. */
#define G_KEEPERR 16 /* Append errors to $@, don't overwrite it */
#define G_NODEBUG 32 /* Disable debugging at toplevel. */
+#define G_NOCATCH 64 /* Don't do CATCH_SET() */
/* flag bits for PL_in_eval */
#define EVAL_NULL 0 /* not in an eval */
diff --git a/op.c b/op.c
index 9f92232912..7d8ee8b20d 100644
--- a/op.c
+++ b/op.c
@@ -5046,6 +5046,7 @@ Perl_ck_defined(pTHX_ OP *o) /* 19990527 MJD */
if ((o->op_flags & OPf_KIDS) && ckWARN(WARN_DEPRECATED)) {
switch (cUNOPo->op_first->op_type) {
case OP_RV2AV:
+ break; /* Globals via GV can be undef */
case OP_PADAV:
case OP_AASSIGN: /* Is this a good idea? */
Perl_warner(aTHX_ WARN_DEPRECATED,
@@ -5054,6 +5055,7 @@ Perl_ck_defined(pTHX_ OP *o) /* 19990527 MJD */
"(Maybe you should just omit the defined()?)\n");
break;
case OP_RV2HV:
+ break; /* Globals via GV can be undef */
case OP_PADHV:
Perl_warner(aTHX_ WARN_DEPRECATED,
"defined(%hash) is deprecated");
diff --git a/perl.c b/perl.c
index 9de87551d9..3c12ee718d 100644
--- a/perl.c
+++ b/perl.c
@@ -1225,10 +1225,16 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
PL_op->op_private |= OPpENTERSUB_DB;
if (!(flags & G_EVAL)) {
- CATCH_SET(TRUE);
+ /* G_NOCATCH is a hack for perl_vdie using this path to call
+ a __DIE__ handler */
+ if (!(flags & G_NOCATCH)) {
+ CATCH_SET(TRUE);
+ }
call_xbody((OP*)&myop, FALSE);
retval = PL_stack_sp - (PL_stack_base + oldmark);
- CATCH_SET(FALSE);
+ if (!(flags & G_NOCATCH)) {
+ CATCH_SET(FALSE);
+ }
}
else {
cLOGOP->op_other = PL_op;
diff --git a/t/op/eval.t b/t/op/eval.t
index dc163e9e8f..abcb3794b7 100755
--- a/t/op/eval.t
+++ b/t/op/eval.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..36\n";
+print "1..37\n";
eval 'print "ok 1\n";';
@@ -171,3 +171,8 @@ sub terminal { eval 'print $r' }
}
$x++;
+# Have we cured panic which occurred with require/eval in die handler ?
+$SIG{__DIE__} = sub { eval {1}; die shift };
+eval { die "ok ".$x++,"\n" };
+print $@;
+
diff --git a/t/pragma/warn/op b/t/pragma/warn/op
index 2377066622..b5d2e71ebe 100644
--- a/t/pragma/warn/op
+++ b/t/pragma/warn/op
@@ -89,13 +89,11 @@
defined(@array) is deprecated
(Maybe you should just omit the defined()?)
- defined @a ;
my @a ; defined @a ;
defined (@a = (1,2,3)) ;
defined(%hash) is deprecated
(Maybe you should just omit the defined()?)
- defined %h ;
my %h ; defined %h ;
Mandatory Warnings
@@ -739,13 +737,6 @@ Statement unlikely to be reached at - line 4.
########
# op.c
use warning 'deprecated' ;
-defined(@a);
-EXPECT
-defined(@array) is deprecated at - line 3.
-(Maybe you should just omit the defined()?)
-########
-# op.c
-use warning 'deprecated' ;
my @a; defined(@a);
EXPECT
defined(@array) is deprecated at - line 3.
@@ -760,13 +751,6 @@ defined(@array) is deprecated at - line 3.
########
# op.c
use warning 'deprecated' ;
-defined(%h);
-EXPECT
-defined(%hash) is deprecated at - line 3.
-(Maybe you should just omit the defined()?)
-########
-# op.c
-use warning 'deprecated' ;
my %h; defined(%h);
EXPECT
defined(%hash) is deprecated at - line 3.
diff --git a/util.c b/util.c
index 2c349e25b0..36c9186b94 100644
--- a/util.c
+++ b/util.c
@@ -1491,7 +1491,11 @@ Perl_vdie(pTHX_ const char* pat, va_list *args)
PUSHMARK(SP);
XPUSHs(msg);
PUTBACK;
- call_sv((SV*)cv, G_DISCARD);
+ /* HACK - REVISIT - avoid CATCH_SET(TRUE) in call_sv()
+ or we come back here due to a JMPENV_JMP() and do
+ a POPSTACK - but die_where() will have already done
+ one as it unwound - NI-S 1999/08/14 */
+ call_sv((SV*)cv, G_DISCARD|G_NOCATCH);
POPSTACK;
LEAVE;
}