summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-14 20:44:27 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-14 20:44:27 +0000
commit68da3b2f7c7c528e65bc6efc19ca01bacb8f7f98 (patch)
tree69e75b823ed74c9fcf43ef268af644b5559ec913
parent92c6daad83acab71abd7df8769e308064578da8e (diff)
downloadperl-68da3b2f7c7c528e65bc6efc19ca01bacb8f7f98.tar.gz
Change SAVECOPWARNINGS(c) to SAVECOMPILEWARNINGS() - it's only used to
save the warnings on PL_compiling, so constraining its use to what we can test seems to make sense. Particularly as testing Perl_ss_dup is tricky. p4raw-id: //depot/perl@27805
-rw-r--r--op.c2
-rw-r--r--pp_ctl.c4
-rw-r--r--scope.c13
-rw-r--r--scope.h11
-rw-r--r--sv.c18
5 files changed, 16 insertions, 32 deletions
diff --git a/op.c b/op.c
index 3bb789b517..593485d52b 100644
--- a/op.c
+++ b/op.c
@@ -1983,7 +1983,7 @@ Perl_block_start(pTHX_ int full)
pad_block_start(full);
SAVEHINTS();
PL_hints &= ~HINT_BLOCK_SCOPE;
- SAVECOPWARNINGS(&PL_compiling);
+ SAVECOMPILEWARNINGS();
PL_compiling.cop_warnings = DUP_WARNINGS(PL_compiling.cop_warnings);
SAVESPTR(PL_compiling.cop_io);
if (! specialCopIO(PL_compiling.cop_io)) {
diff --git a/pp_ctl.c b/pp_ctl.c
index 0307a2e854..7beea6abb3 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3364,7 +3364,7 @@ PP(pp_require)
PL_rsfp = tryrsfp;
SAVEHINTS();
PL_hints = 0;
- SAVECOPWARNINGS(&PL_compiling);
+ SAVECOMPILEWARNINGS();
if (PL_dowarn & G_WARN_ALL_ON)
PL_compiling.cop_warnings = pWARN_ALL ;
else if (PL_dowarn & G_WARN_ALL_OFF)
@@ -3464,7 +3464,7 @@ PP(pp_entereval)
PL_hints = PL_op->op_targ;
if (saved_hh)
GvHV(PL_hintgv) = saved_hh;
- SAVECOPWARNINGS(&PL_compiling);
+ SAVECOMPILEWARNINGS();
PL_compiling.cop_warnings = DUP_WARNINGS(PL_curcop->cop_warnings);
SAVESPTR(PL_compiling.cop_io);
if (specialCopIO(PL_curcop->cop_io))
diff --git a/scope.c b/scope.c
index 94f648af16..33763a77f1 100644
--- a/scope.c
+++ b/scope.c
@@ -984,16 +984,13 @@ Perl_leave_scope(pTHX_ I32 base)
i = SSPOPINT;
CopARYBASE_set((COP *)ptr, i);
break;
- case SAVEt_COP_WARNINGS:
- {
- COP *const cop = SSPOPPTR;
- ptr = SSPOPPTR;
+ case SAVEt_COMPILE_WARNINGS:
+ ptr = SSPOPPTR;
- if (!specialWARN(cop->cop_warnings))
- PerlMemShared_free(cop->cop_warnings);
+ if (!specialWARN(PL_compiling.cop_warnings))
+ PerlMemShared_free(PL_compiling.cop_warnings);
- cop->cop_warnings = ptr;
- }
+ PL_compiling.cop_warnings = ptr;
break;
case SAVEt_RE_STATE:
{
diff --git a/scope.h b/scope.h
index 580d10946b..1506e5e1e1 100644
--- a/scope.h
+++ b/scope.h
@@ -51,7 +51,7 @@
#define SAVEt_SAVESWITCHSTACK 40
#define SAVEt_COP_ARYBASE 41
#define SAVEt_RE_STATE 42
-#define SAVEt_COP_WARNINGS 43
+#define SAVEt_COMPILE_WARNINGS 43
#ifndef SCOPE_SAVES_SIGNAL_MASK
#define SCOPE_SAVES_SIGNAL_MASK 0
@@ -198,12 +198,11 @@ Closing bracket on a callback. See C<ENTER> and L<perlcall>.
could have done savefreesharedpvREF, but this way actually seems cleaner,
as it simplifies the code that does the saves, and reduces the load on the
save stack. */
-#define SAVECOPWARNINGS(c) \
+#define SAVECOMPILEWARNINGS() \
STMT_START { \
- SSCHECK(3); \
- SSPUSHPTR((c)->cop_warnings); \
- SSPUSHPTR(c); \
- SSPUSHINT(SAVEt_COP_WARNINGS); \
+ SSCHECK(2); \
+ SSPUSHPTR(PL_compiling.cop_warnings); \
+ SSPUSHINT(SAVEt_COMPILE_WARNINGS); \
} STMT_END
#ifdef USE_ITHREADS
diff --git a/sv.c b/sv.c
index a64b27298b..08d9b6a48c 100644
--- a/sv.c
+++ b/sv.c
@@ -10681,21 +10681,9 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
#endif
break;
}
- case SAVEt_COP_WARNINGS:
- {
- void *optr = POPPTR(ss,ix);
- TOPPTR(nss,ix) = ptr = any_dup(optr, proto_perl);
- if (ptr != optr) {
- /* We duped something in the interpreter structure. */
- ptr = POPPTR(ss,ix);
- TOPPTR(nss,ix) = DUP_WARNINGS((STRLEN*)ptr);
- } else {
- /* I don't think that this happens, but it would mean that
- we (didn't) dup something shared. */
- ptr = POPPTR(ss,ix);
- TOPPTR(nss,ix) = ptr;
- }
- }
+ case SAVEt_COMPILE_WARNINGS:
+ ptr = POPPTR(ss,ix);
+ TOPPTR(nss,ix) = DUP_WARNINGS((STRLEN*)ptr);
break;
default:
Perl_croak(aTHX_ "panic: ss_dup inconsistency (%"IVdf")", (IV) i);