In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/f4c617746504f38fcb281a2b1c1da9426d8eab01?hp=03fedefe18733baa9ed7c9c22bd816408d57de0d>

- Log -----------------------------------------------------------------
commit f4c617746504f38fcb281a2b1c1da9426d8eab01
Author: David Mitchell <[email protected]>
Date:   Mon Jan 23 13:37:21 2017 +0000

    mess_sv(): access only if PL_curcop is non-null
    
    RT #130621
    
    In Perl_mess_sv(), don't try to add an "at foo line NN" to the error
    message if PL_curcop is null.
    
    In the ticket above, the reason that PL_curcop is null is the less
    than optimal way that evals free their optree: ideally the optree should
    be attached to the eval CV and freed when the CV is; instead a separate
    SAVEFREEOP() is done. But that fix is for another time; regardless,
    mess_sv() should have a PL_curcop != NULL guard anyway.

M       util.c

commit b1a69a65ecd83426da7ca1af26b757fe0da58007
Author: David Mitchell <[email protected]>
Date:   Mon Jan 23 13:27:07 2017 +0000

    ckDEAD: PL_curcop->cop_warnings only if PL_curcop
    
    RT #130621
    
    In ckDEAD(), don't check the value of PL_curcop->cop_warnings unless
    PL_curcop is non-null.
    
    In the ticket above, the reason that PL_curcop is null is the less
    than optimal way that evals free their optree: ideally the optree should
    be attached to the eval CV and freed when the CV is; instead a separate
    SAVEFREEOP() is done. But that fix is for another time; regardless,
    ckDEAD() should have a PL_curcop != NULL guard anyway like isLEXWARN_on()
    etc already do.

M       regen/warnings.pl
M       warnings.h
-----------------------------------------------------------------------

Summary of changes:
 regen/warnings.pl |  3 ++-
 util.c            | 19 +++++++++++--------
 warnings.h        |  3 ++-
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/regen/warnings.pl b/regen/warnings.pl
index 83bf8bc3c4..5721c17b26 100644
--- a/regen/warnings.pl
+++ b/regen/warnings.pl
@@ -462,7 +462,8 @@ is by default enabled even if not within the scope of 
S<C<use warnings>>.
 #define unpackWARN4(x)         (((x) >>24) & 0xFF)
 
 #define ckDEAD(x)                                                      \
-          ( ! specialWARN(PL_curcop->cop_warnings) &&                  \
+          (PL_curcop &&                                                \
+            !specialWARN(PL_curcop->cop_warnings) &&                   \
            ( isWARNf_on(PL_curcop->cop_warnings, WARN_ALL) ||          \
              isWARNf_on(PL_curcop->cop_warnings, unpackWARN1(x)) ||    \
              isWARNf_on(PL_curcop->cop_warnings, unpackWARN2(x)) ||    \
diff --git a/util.c b/util.c
index a542f5eeb5..53b410971a 100644
--- a/util.c
+++ b/util.c
@@ -1518,14 +1518,17 @@ Perl_mess_sv(pTHX_ SV *basemsg, bool consume)
         * from the sibling of PL_curcop.
         */
 
-       const COP *cop =
-           closest_cop(PL_curcop, OpSIBLING(PL_curcop), PL_op, FALSE);
-       if (!cop)
-           cop = PL_curcop;
-
-       if (CopLINE(cop))
-           Perl_sv_catpvf(aTHX_ sv, " at %s line %" IVdf,
-           OutCopFILE(cop), (IV)CopLINE(cop));
+        if (PL_curcop) {
+            const COP *cop =
+                closest_cop(PL_curcop, OpSIBLING(PL_curcop), PL_op, FALSE);
+            if (!cop)
+                cop = PL_curcop;
+
+            if (CopLINE(cop))
+                Perl_sv_catpvf(aTHX_ sv, " at %s line %" IVdf,
+                                OutCopFILE(cop), (IV)CopLINE(cop));
+        }
+
        /* Seems that GvIO() can be untrustworthy during global destruction. */
        if (GvIO(PL_last_in_gv) && (SvTYPE(GvIOp(PL_last_in_gv)) == SVt_PVIO)
                && IoLINES(GvIOp(PL_last_in_gv)))
diff --git a/warnings.h b/warnings.h
index 6d675209f8..01668377fc 100644
--- a/warnings.h
+++ b/warnings.h
@@ -221,7 +221,8 @@ is by default enabled even if not within the scope of 
S<C<use warnings>>.
 #define unpackWARN4(x)         (((x) >>24) & 0xFF)
 
 #define ckDEAD(x)                                                      \
-          ( ! specialWARN(PL_curcop->cop_warnings) &&                  \
+          (PL_curcop &&                                                \
+            !specialWARN(PL_curcop->cop_warnings) &&                   \
            ( isWARNf_on(PL_curcop->cop_warnings, WARN_ALL) ||          \
              isWARNf_on(PL_curcop->cop_warnings, unpackWARN1(x)) ||    \
              isWARNf_on(PL_curcop->cop_warnings, unpackWARN2(x)) ||    \

--
Perl5 Master Repository

Reply via email to