Change 27805 by [EMAIL PROTECTED] on 2006/04/14 20:44:27

        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.

Affected files ...

... //depot/perl/op.c#802 edit
... //depot/perl/pp_ctl.c#546 edit
... //depot/perl/scope.c#188 edit
... //depot/perl/scope.h#81 edit
... //depot/perl/sv.c#1243 edit

Differences ...

==== //depot/perl/op.c#802 (text) ====
Index: perl/op.c
--- perl/op.c#801~27779~        2006-04-12 15:45:12.000000000 -0700
+++ perl/op.c   2006-04-14 13:44:27.000000000 -0700
@@ -1983,7 +1983,7 @@
     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)) {

==== //depot/perl/pp_ctl.c#546 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#545~27802~    2006-04-14 09:18:30.000000000 -0700
+++ perl/pp_ctl.c       2006-04-14 13:44:27.000000000 -0700
@@ -3364,7 +3364,7 @@
     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 @@
     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))

==== //depot/perl/scope.c#188 (text) ====
Index: perl/scope.c
--- perl/scope.c#187~27792~     2006-04-13 09:14:23.000000000 -0700
+++ perl/scope.c        2006-04-14 13:44:27.000000000 -0700
@@ -984,16 +984,13 @@
            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:
            {

==== //depot/perl/scope.h#81 (text) ====
Index: perl/scope.h
--- perl/scope.h#80~27792~      2006-04-13 09:14:23.000000000 -0700
+++ perl/scope.h        2006-04-14 13:44:27.000000000 -0700
@@ -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 @@
    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

==== //depot/perl/sv.c#1243 (text) ====
Index: perl/sv.c
--- perl/sv.c#1242~27803~       2006-04-14 09:43:03.000000000 -0700
+++ perl/sv.c   2006-04-14 13:44:27.000000000 -0700
@@ -10681,21 +10681,9 @@
 #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);
End of Patch.

Reply via email to