On Sat, Jul 02, 2005 at 04:53:35PM +0100, Dave Mitchell wrote:
> On Sat, Jul 02, 2005 at 04:52:43PM +0100, [EMAIL PROTECTED] wrote:
> > If I remember right, a lot of code tests whether the warning is enabled
> > before testing whether the warning case applies, on the assumption that
> > the first check is quick. Many of those cases may want to be re-evaluated
> > in the light of this patch.
> 
> I was going to save that for another day :-)

That day has now arrived:

-- 
There's a traditional definition of a shyster: a lawyer who, when the law
is against him, pounds on the facts; when the facts are against him,
pounds on the law; and when both the facts and the law are against him,
pounds on the table.
    -- Eben Moglen referring to SCO


Change 25129 by [EMAIL PROTECTED] on 2005/07/13 00:21:13

        make the expensive ckWARN() be called as late as possible
        reorganise
            if (ckWARN(FOO) && should_not_happen_condition)
        to
            if (should_not_happen_condition && ckWARN(FOO))

Affected files ...

... //depot/perl/doio.c#274 edit
... //depot/perl/gv.c#258 edit
... //depot/perl/op.c#696 edit
... //depot/perl/pad.c#64 edit
... //depot/perl/perlio.c#279 edit
... //depot/perl/pp.c#473 edit
... //depot/perl/pp_hot.c#410 edit
... //depot/perl/pp_pack.c#104 edit
... //depot/perl/pp_sys.c#431 edit
... //depot/perl/regcomp.c#380 edit
... //depot/perl/regexec.c#357 edit
... //depot/perl/sv.c#955 edit
... //depot/perl/toke.c#580 edit

Differences ...

==== //depot/perl/doio.c#274 (text) ====

@@ -566,7 +566,9 @@
        }
     }
     if (!fp) {
-       if (ckWARN(WARN_NEWLINE) && IoTYPE(io) == IoTYPE_RDONLY && strchr(name, 
'\n'))
+       if (IoTYPE(io) == IoTYPE_RDONLY && strchr(name, '\n')
+           && ckWARN(WARN_NEWLINE)
+       )
            Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "open");
        goto say_false;
     }
@@ -1079,7 +1081,7 @@
 
     if (!io)
        return TRUE;
-    else if (ckWARN(WARN_IO) && (IoTYPE(io) == IoTYPE_WRONLY))
+    else if ((IoTYPE(io) == IoTYPE_WRONLY) && ckWARN(WARN_IO))
        report_evil_fh(gv, io, OP_phoney_OUTPUT_ONLY);
 
     while (IoIFP(io)) {
@@ -1392,7 +1394,7 @@
        s = SvPVX_const(PL_statname);           /* s now NUL-terminated */
        PL_laststype = OP_STAT;
        PL_laststatval = PerlLIO_stat(s, &PL_statcache);
-       if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(s, '\n'))
+       if (PL_laststatval < 0 && strchr(s, '\n') && ckWARN(WARN_NEWLINE))
            Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat");
        return PL_laststatval;
     }
@@ -1418,8 +1420,8 @@
            return (PL_laststatval = -1);
        }
     }
-    else if (ckWARN(WARN_IO) && PL_laststype != OP_LSTAT
-           && (PL_op->op_private & OPpFT_STACKED))
+    else if (PL_laststype != OP_LSTAT
+           && (PL_op->op_private & OPpFT_STACKED) && ckWARN(WARN_IO))
        Perl_croak(aTHX_ no_prev_lstat);
 
     PL_laststype = OP_LSTAT;

==== //depot/perl/gv.c#258 (text) ====

@@ -547,8 +547,9 @@
     /*
      * Inheriting AUTOLOAD for non-methods works ... for now.
      */
-    if (ckWARN2(WARN_DEPRECATED, WARN_SYNTAX) && !method &&
-       (GvCVGEN(gv) || GvSTASH(gv) != stash))
+    if (!method && (GvCVGEN(gv) || GvSTASH(gv) != stash)
+       && ckWARN2(WARN_DEPRECATED, WARN_SYNTAX)
+    )
        Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
          "Use of inherited AUTOLOAD for non-method %s::%.*s() is deprecated",
             packname, (int)len, name);

==== //depot/perl/op.c#696 (text) ====

@@ -1767,11 +1767,12 @@
     OP *o;
     bool ismatchop = 0;
 
-    if (ckWARN(WARN_MISC) &&
-      (left->op_type == OP_RV2AV ||
+    if ( (left->op_type == OP_RV2AV ||
        left->op_type == OP_RV2HV ||
        left->op_type == OP_PADAV ||
-       left->op_type == OP_PADHV)) {
+       left->op_type == OP_PADHV)
+       && ckWARN(WARN_MISC))
+    {
       const char *desc = PL_op_desc[(right->op_type == OP_SUBST ||
                             right->op_type == OP_TRANS)
                            ? right->op_type : OP_MATCH];
@@ -1960,8 +1961,8 @@
        ;
 #endif
     else {
-       if (ckWARN(WARN_PARENTHESIS)
-           && PL_bufptr > PL_oldbufptr && PL_bufptr[-1] == ',')
+       if ( PL_bufptr > PL_oldbufptr && PL_bufptr[-1] == ','
+           && ckWARN(WARN_PARENTHESIS))
        {
            char *s = PL_bufptr;
            bool sigil = FALSE;
@@ -3528,7 +3529,7 @@
     if (first->op_type == OP_CONST) {
        if (first->op_private & OPpCONST_STRICT)
            no_bareword_allowed(first);
-       else if (ckWARN(WARN_BAREWORD) && (first->op_private & OPpCONST_BARE))
+       else if ((first->op_private & OPpCONST_BARE) && ckWARN(WARN_BAREWORD))
                Perl_warner(aTHX_ packWARN(WARN_BAREWORD), "Bareword found in 
conditional");
        if ((type == OP_AND &&  SvTRUE(((SVOP*)first)->op_sv)) ||
            (type == OP_OR  && !SvTRUE(((SVOP*)first)->op_sv)) ||
@@ -3564,8 +3565,8 @@
            return first;
        }
     }
-    else if (ckWARN(WARN_MISC) && (first->op_flags & OPf_KIDS) &&
-             type != OP_DOR) /* [#24076] Don't warn for <FH> err FOO. */
+    else if ((first->op_flags & OPf_KIDS) && type != OP_DOR
+       && ckWARN(WARN_MISC)) /* [#24076] Don't warn for <FH> err FOO. */
     {
        const OP *k1 = ((UNOP*)first)->op_first;
        const OP *k2 = k1->op_sibling;
@@ -6188,7 +6189,7 @@
     kid->op_type = OP_PUSHRE;
     kid->op_ppaddr = PL_ppaddr[OP_PUSHRE];
     scalar(kid);
-    if (ckWARN(WARN_REGEXP) && ((PMOP *)kid)->op_pmflags & PMf_GLOBAL) {
+    if (((PMOP *)kid)->op_pmflags & PMf_GLOBAL && ckWARN(WARN_REGEXP)) {
       Perl_warner(aTHX_ packWARN(WARN_REGEXP),
                   "Use of /g modifier is meaningless in split");
     }
@@ -6214,9 +6215,9 @@
 OP *
 Perl_ck_join(pTHX_ OP *o)
 {
-    if (ckWARN(WARN_SYNTAX)) {
-       const OP *kid = cLISTOPo->op_first->op_sibling;
-       if (kid && kid->op_type == OP_MATCH) {
+    const OP *kid = cLISTOPo->op_first->op_sibling;
+    if (kid && kid->op_type == OP_MATCH) {
+       if (ckWARN(WARN_SYNTAX)) {
             const REGEXP *re = PM_GETRE(kPMOP);
            const char *pmstr = re ? re->precomp : "STRING";
            Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
@@ -6267,7 +6268,7 @@
                    }
                    else {
                        delete_op = 1;
-                       if (ckWARN(WARN_ASSERTIONS) && !(PL_hints & 
HINT_ASSERTIONSSEEN)) {
+                       if (!(PL_hints & HINT_ASSERTIONSSEEN) && 
ckWARN(WARN_ASSERTIONS)) {
                            Perl_warner(aTHX_ packWARN(WARN_ASSERTIONS),
                                        "Impossible to activate assertion 
call");
                        }
@@ -6739,8 +6740,9 @@
 
        case OP_EXEC:
            o->op_opt = 1;
-           if (ckWARN(WARN_SYNTAX) && o->op_next
-               && o->op_next->op_type == OP_NEXTSTATE) {
+           if (o->op_next && o->op_next->op_type == OP_NEXTSTATE
+               && ckWARN(WARN_SYNTAX))
+           {
                if (o->op_next->op_sibling &&
                        o->op_next->op_sibling->op_type != OP_EXIT &&
                        o->op_next->op_sibling->op_type != OP_WARN &&

==== //depot/perl/pad.c#64 (text) ====

@@ -501,7 +501,7 @@
     PADOFFSET  top, off;
 
     ASSERT_CURPAD_ACTIVE("pad_check_dup");
-    if (!ckWARN(WARN_MISC) || AvFILLp(PL_comppad_name) < 0)
+    if (AvFILLp(PL_comppad_name) < 0 || !ckWARN(WARN_MISC))
        return; /* nothing to check */
 
     svp = AvARRAY(PL_comppad_name);

==== //depot/perl/perlio.c#279 (text) ====

@@ -979,7 +979,6 @@
                    }
                }
                if (e > s) {
-                   const bool warn_layer = ckWARN(WARN_LAYER);
                    PerlIO_funcs *layer =
                        PerlIO_find_layer(aTHX_ s, llen, 1);
                    if (layer) {
@@ -989,7 +988,7 @@
                                         &PL_sv_undef);
                    }
                    else {
-                       if (warn_layer)
+                       if (ckWARN(WARN_LAYER))
                            Perl_warner(aTHX_ packWARN(WARN_LAYER), "Unknown 
PerlIO layer \"%.*s\"",
                                  (int) llen, s);
                        return -1;

==== //depot/perl/pp.c#473 (text) ====

@@ -531,7 +531,7 @@
        if (ssv && !SvGMAGICAL(ssv) && !SvAMAGIC(ssv) && SvROK(ssv))
            Perl_croak(aTHX_ "Attempt to bless into a reference");
        ptr = SvPV_const(ssv,len);
-       if (ckWARN(WARN_MISC) && len == 0)
+       if (len == 0 && ckWARN(WARN_MISC))
            Perl_warner(aTHX_ packWARN(WARN_MISC),
                   "Explicit blessing to '' (assuming package main)");
        stash = gv_stashpvn(ptr, len, TRUE);
@@ -789,7 +789,7 @@
        hv_undef((HV*)sv);
        break;
     case SVt_PVCV:
-       if (ckWARN(WARN_MISC) && cv_const_sv((CV*)sv))
+       if (cv_const_sv((CV*)sv) && ckWARN(WARN_MISC))
            Perl_warner(aTHX_ packWARN(WARN_MISC), "Constant subroutine %s 
undefined",
                 CvANON((CV*)sv) ? "(anonymous)" : GvENAME(CvGV((CV*)sv)));
        /* FALL THROUGH */

==== //depot/perl/pp_hot.c#410 (text) ====

@@ -1494,8 +1494,9 @@
        }
     }
     if (!fp) {
-       if (ckWARN2(WARN_GLOB, WARN_CLOSED)
-               && (!io || !(IoFLAGS(io) & IOf_START))) {
+       if ((!io || !(IoFLAGS(io) & IOf_START))
+           && ckWARN2(WARN_GLOB, WARN_CLOSED))
+       {
            if (type == OP_GLOB)
                Perl_warner(aTHX_ packWARN(WARN_GLOB),
                            "glob failed (can't start child: %s)",
@@ -1610,8 +1611,8 @@
             const STRLEN len = SvCUR(sv) - offset;
             const U8 *f;
             
-            if (ckWARN(WARN_UTF8) &&
-                !Perl_is_utf8_string_loc(aTHX_ s, len, &f))
+            if (!Perl_is_utf8_string_loc(aTHX_ s, len, &f)
+               && ckWARN(WARN_UTF8))
                  /* Emulate :encoding(utf8) warning in the same case. */
                  Perl_warner(aTHX_ packWARN(WARN_UTF8),
                              "utf8 \"\\x%02X\" does not map to Unicode",

==== //depot/perl/pp_pack.c#104 (text) ====

@@ -1024,8 +1024,7 @@
           Perl_croak(aTHX_ "Can't use '%c' in a group with different 
byte-order in %s",
                      *patptr, _action( symptr ) );
 
-        if (ckWARN(WARN_UNPACK)) {
-          if (code & modifier)
+        if ((code & modifier) && ckWARN(WARN_UNPACK)) {
            Perl_warner(aTHX_ packWARN(WARN_UNPACK),
                         "Duplicate modifier '%c' after '%c' in %s",
                         *patptr, (int) TYPE_NO_MODIFIERS(code),
@@ -2518,6 +2517,7 @@
     I32 items  = endlist - beglist;
     bool found = next_symbol(symptr);
     bool utf8 = (symptr->flags & FLAG_PARSE_UTF8) ? 1 : 0;
+    bool warn_utf8 = ckWARN(WARN_UTF8);
 
     if (symptr->level == 0 && found && symptr->code == 'U') {
        marked_upgrade(aTHX_ cat, symptr);
@@ -2843,7 +2843,7 @@
            end = str + fromlen;
            if (DO_UTF8(fromstr)) {
                utf8_source = TRUE;
-               utf8_flags  = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
+               utf8_flags  = warn_utf8 ? 0 : UTF8_ALLOW_ANY;
            } else {
                utf8_source = FALSE;
                utf8_flags  = 0; /* Unused, but keep compilers happy */
@@ -2912,7 +2912,7 @@
            end = str + fromlen;
            if (DO_UTF8(fromstr)) {
                utf8_source = TRUE;
-               utf8_flags  = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
+               utf8_flags  = warn_utf8 ? 0 : UTF8_ALLOW_ANY;
            } else {
                utf8_source = FALSE;
                utf8_flags  = 0; /* Unused, but keep compilers happy */
@@ -3025,7 +3025,7 @@
                    }
                    cur = (char *) uvuni_to_utf8_flags((U8 *) cur,
                                                       NATIVE_TO_UNI(auv),
-                                                      ckWARN(WARN_UTF8) ?
+                                                      warn_utf8 ?
                                                       0 : UNICODE_ALLOW_ANY);
                } else {
                    if (auv >= 0x100) {
@@ -3079,7 +3079,7 @@
                if (utf8) {
                    U8 buffer[UTF8_MAXLEN], *endb;
                    endb = uvuni_to_utf8_flags(buffer, auv,
-                                              ckWARN(WARN_UTF8) ?
+                                              warn_utf8 ?
                                               0 : UNICODE_ALLOW_ANY);
                    if (cur+(endb-buffer)*UTF8_EXPAND >= end) {
                        *cur = '\0';
@@ -3097,7 +3097,7 @@
                        end = start+SvLEN(cat)-UTF8_MAXLEN;
                    }
                    cur = (char *) uvuni_to_utf8_flags((U8 *) cur, auv,
-                                                      ckWARN(WARN_UTF8) ?
+                                                      warn_utf8 ?
                                                       0 : UNICODE_ALLOW_ANY);
                }
            }
@@ -3524,9 +3524,8 @@
                     * of pack() (and all copies of the result) are
                     * gone.
                     */
-                   if (ckWARN(WARN_PACK) &&
-                       (SvTEMP(fromstr) || (SvPADTMP(fromstr) &&
-                                            !SvREADONLY(fromstr)))) {
+                   if ((SvTEMP(fromstr) || (SvPADTMP(fromstr) &&
+                            !SvREADONLY(fromstr))) && ckWARN(WARN_PACK)) {
                        Perl_warner(aTHX_ packWARN(WARN_PACK),
                                    "Attempt to pack pointer to temporary 
value");
                    }

==== //depot/perl/pp_sys.c#431 (text) ====

@@ -907,8 +907,7 @@
               LEAVE;
               SPAGAIN;
             }
-           else if (ckWARN(WARN_UNTIE)) {
-              if (mg && SvREFCNT(obj) > 1)
+           else if (mg && SvREFCNT(obj) > 1 && ckWARN(WARN_UNTIE)) {
                  Perl_warner(aTHX_ packWARN(WARN_UNTIE),
                      "untie attempted while %"UVuf" inner references still 
exist",
                       (UV)SvREFCNT(obj) - 1 ) ;
@@ -1232,8 +1231,8 @@
        RETURN;
     }
     if (!gv || do_eof(gv)) { /* make sure we have fp with something */
-       if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)
-               && (!io || (!IoIFP(io) && IoTYPE(io) != IoTYPE_WRONLY)))
+       if ((!io || (!IoIFP(io) && IoTYPE(io) != IoTYPE_WRONLY))
+         && ckWARN2(WARN_UNOPENED,WARN_CLOSED))
            report_evil_fh(gv, io, PL_op->op_type);
        SETERRNO(EBADF,RMS_IFI);
        RETPUSHUNDEF;

==== //depot/perl/regcomp.c#380 (text) ====

@@ -2202,12 +2202,12 @@
                }
                if (!scan)              /* It was not CURLYX, but CURLY. */
                    scan = next;
-               if (ckWARN(WARN_REGEXP)
-                      /* ? quantifier ok, except for (?{ ... }) */
-                   && (next_is_eval || !(mincount == 0 && maxcount == 1))
+               if ( /* ? quantifier ok, except for (?{ ... }) */
+                   (next_is_eval || !(mincount == 0 && maxcount == 1))
                    && (minnext == 0) && (deltanext == 0)
                    && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))
-                   && maxcount <= REG_INFTY/3) /* Complement check for big 
count */
+                   && maxcount <= REG_INFTY/3 /* Complement check for big 
count */
+                   && ckWARN(WARN_REGEXP))
                {
                    vWARN(RExC_parse,
                          "Quantifier unexpected on zero-length expression");
@@ -3838,7 +3838,7 @@
        goto do_curly;
     }
   nest_check:
-    if (ckWARN(WARN_REGEXP) && !SIZE_ONLY && !(flags&HASWIDTH) && max > 
REG_INFTY/3) {
+    if (!SIZE_ONLY && !(flags&HASWIDTH) && max > REG_INFTY/3 && 
ckWARN(WARN_REGEXP)) {
        vWARN3(RExC_parse,
               "%.*s matches null string many times",
               RExC_parse - origparse,
@@ -4275,7 +4275,7 @@
                            FAIL("Trailing \\");
                        /* FALL THROUGH */
                    default:
-                       if (!SIZE_ONLY && ckWARN(WARN_REGEXP) && isALPHA(*p))
+                       if (!SIZE_ONLY&& isALPHA(*p) && ckWARN(WARN_REGEXP))
                            vWARN2(p + 1, "Unrecognized escape \\%c passed 
through", UCHARAT(p));
                        goto normal_default;
                    }
@@ -4818,7 +4818,7 @@
                break;
             }
            default:
-               if (!SIZE_ONLY && ckWARN(WARN_REGEXP) && isALPHA(value))
+               if (!SIZE_ONLY && isALPHA(value) && ckWARN(WARN_REGEXP))
                    vWARN2(RExC_parse,
                           "Unrecognized escape \\%c in character class passed 
through",
                           (int)value);

==== //depot/perl/regexec.c#357 (text) ====

@@ -1039,14 +1039,15 @@
                U8 *sm = (U8 *) m;
                U8 tmpbuf1[UTF8_MAXBYTES_CASE+1];
                U8 tmpbuf2[UTF8_MAXBYTES_CASE+1];
+               const U32 uniflags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
 
                to_utf8_lower((U8*)m, tmpbuf1, &ulen1);
                to_utf8_upper((U8*)m, tmpbuf2, &ulen2);
 
                c1 = utf8n_to_uvchr(tmpbuf1, UTF8_MAXBYTES_CASE, 
-                                   0, ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
+                                   0, uniflags);
                c2 = utf8n_to_uvchr(tmpbuf2, UTF8_MAXBYTES_CASE,
-                                   0, ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
+                                   0, uniflags);
                lnc = 0;
                while (sm < ((U8 *) m + ln)) {
                    lnc++;
@@ -1085,14 +1086,13 @@
                UV c, f;
                U8 tmpbuf [UTF8_MAXBYTES+1];
                STRLEN len, foldlen;
-               
+               const U32 uniflags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
                if (c1 == c2) {
                    /* Upper and lower of 1st char are equal -
                     * probably not a "letter". */
                    while (s <= e) {
                        c = utf8n_to_uvchr((U8*)s, UTF8_MAXBYTES, &len,
-                                          ckWARN(WARN_UTF8) ?
-                                          0 : UTF8_ALLOW_ANY);
+                                          uniflags);
                        if ( c == c1
                             && (ln == len ||
                                 ibcmp_utf8(s, (char **)0, 0,  do_utf8,
@@ -1119,8 +1119,7 @@
                else {
                    while (s <= e) {
                      c = utf8n_to_uvchr((U8*)s, UTF8_MAXBYTES, &len,
-                                          ckWARN(WARN_UTF8) ?
-                                          0 : UTF8_ALLOW_ANY);
+                                          uniflags);
 
                        /* Handle some of the three Greek sigmas cases.
                         * Note that not all the possible combinations
@@ -2416,6 +2415,7 @@
 
     SV *re_debug_flags = NULL;
 #endif
+    U32 uniflags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
 
     GET_RE_DEBUG_FLAGS;
 
@@ -2583,8 +2583,6 @@
        case TRIEF:
        case TRIEFL:
            {
-
-               const U32 uniflags = ckWARN( WARN_UTF8 ) ? 0 : UTF8_ALLOW_ANY;
                U8 *uc = ( U8* )locinput;
                U32 state = 1;
                U16 charid = 0;
@@ -2652,7 +2650,6 @@
               from previous if blocks */
        case TRIE:
            {
-               const U32 uniflags = ckWARN( WARN_UTF8 ) ? 0 : UTF8_ALLOW_ANY;
                U8 *uc = (U8*)locinput;
                U32 state = 1;
                U16 charid = 0;
@@ -2808,8 +2805,7 @@
                             sayNO;
                        if (NATIVE_TO_UNI(*(U8*)s) !=
                            utf8n_to_uvuni((U8*)l, UTF8_MAXBYTES, &ulen,
-                                          ckWARN(WARN_UTF8) ?
-                                          0 : UTF8_ALLOW_ANY))
+                                           uniflags))
                             sayNO;
                        l += ulen;
                        s ++;
@@ -2823,8 +2819,7 @@
                            sayNO;
                        if (NATIVE_TO_UNI(*((U8*)l)) !=
                            utf8n_to_uvuni((U8*)s, UTF8_MAXBYTES, &ulen,
-                                          ckWARN(WARN_UTF8) ?
-                                          0 : UTF8_ALLOW_ANY))
+                                          uniflags))
                            sayNO;
                        s += ulen;
                        l ++;
@@ -3941,16 +3936,13 @@
                             to_utf8_upper((U8*)s, tmpbuf2, &ulen2);
 
                             c1 = utf8n_to_uvuni(tmpbuf1, UTF8_MAXBYTES, 0,
-                                                ckWARN(WARN_UTF8) ?
-                                                0 : UTF8_ALLOW_ANY);
+                                                uniflags);
                             c2 = utf8n_to_uvuni(tmpbuf2, UTF8_MAXBYTES, 0,
-                                                ckWARN(WARN_UTF8) ?
-                                                0 : UTF8_ALLOW_ANY);
+                                                uniflags);
                        }
                        else {
                            c2 = c1 = utf8n_to_uvchr(s, UTF8_MAXBYTES, 0,
-                                                    ckWARN(WARN_UTF8) ?
-                                                    0 : UTF8_ALLOW_ANY);
+                                                    uniflags);
                        }
                    }
                }
@@ -4011,8 +4003,7 @@
                                while (locinput <= e &&
                                       utf8n_to_uvchr((U8*)locinput,
                                                      UTF8_MAXBYTES, &len,
-                                                     ckWARN(WARN_UTF8) ?
-                                                     0 : UTF8_ALLOW_ANY) != 
(UV)c1) {
+                                                     uniflags) != (UV)c1) {
                                    locinput += len;
                                    count++;
                                }
@@ -4023,8 +4014,7 @@
                                while (locinput <= e) {
                                    UV c = utf8n_to_uvchr((U8*)locinput,
                                                          UTF8_MAXBYTES, &len,
-                                                         ckWARN(WARN_UTF8) ?
-                                                         0 : UTF8_ALLOW_ANY);
+                                                         uniflags);
                                    if (c == (UV)c1 || c == (UV)c2)
                                        break;
                                    locinput += len;
@@ -4060,8 +4050,7 @@
                        if (do_utf8)
                            c = utf8n_to_uvchr((U8*)PL_reginput,
                                               UTF8_MAXBYTES, 0,
-                                              ckWARN(WARN_UTF8) ?
-                                              0 : UTF8_ALLOW_ANY);
+                                              uniflags);
                        else
                            c = UCHARAT(PL_reginput);
                        /* If it could work, try it. */
@@ -4110,8 +4099,7 @@
                            if (do_utf8)
                                c = utf8n_to_uvchr((U8*)PL_reginput,
                                                   UTF8_MAXBYTES, 0,
-                                                  ckWARN(WARN_UTF8) ?
-                                                  0 : UTF8_ALLOW_ANY);
+                                                  uniflags);
                            else
                                c = UCHARAT(PL_reginput);
                        }
@@ -4133,8 +4121,7 @@
                            if (do_utf8)
                                c = utf8n_to_uvchr((U8*)PL_reginput,
                                                   UTF8_MAXBYTES, 0,
-                                                  ckWARN(WARN_UTF8) ?
-                                                  0 : UTF8_ALLOW_ANY);
+                                                  uniflags);
                            else
                                c = UCHARAT(PL_reginput);
                        }

==== //depot/perl/sv.c#955 (text) ====

@@ -2113,7 +2113,7 @@
            return asIV(sv);
        if (!SvROK(sv)) {
            if (!(SvFLAGS(sv) & SVs_PADTMP)) {
-               if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
+               if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
                    report_uninit(sv);
            }
            return 0;
@@ -2373,7 +2373,7 @@
 #endif /* NV_PRESERVES_UV */
        }
     } else  {
-       if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing && !(SvFLAGS(sv) & 
SVs_PADTMP))
+       if (!PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP) && 
ckWARN(WARN_UNINITIALIZED))
            report_uninit(sv);
        if (SvTYPE(sv) < SVt_IV)
            /* Typically the caller expects that sv_any is not NULL now.  */
@@ -2421,7 +2421,7 @@
            return asUV(sv);
        if (!SvROK(sv)) {
            if (!(SvFLAGS(sv) & SVs_PADTMP)) {
-               if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
+               if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
                    report_uninit(sv);
            }
            return 0;
@@ -2662,7 +2662,7 @@
     }
     else  {
        if (!(SvFLAGS(sv) & SVs_PADTMP)) {
-           if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
+           if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
                report_uninit(sv);
        }
        if (SvTYPE(sv) < SVt_IV)
@@ -2696,7 +2696,7 @@
        if (SvNOKp(sv))
            return SvNVX(sv);
        if (SvPOKp(sv) && SvLEN(sv)) {
-           if (ckWARN(WARN_NUMERIC) && !SvIOKp(sv) &&
+           if (!SvIOKp(sv) && ckWARN(WARN_NUMERIC) &&
                !grok_number(SvPVX_const(sv), SvCUR(sv), NULL))
                not_a_number(sv);
            return Atof(SvPVX_const(sv));
@@ -2709,7 +2709,7 @@
        }       
         if (!SvROK(sv)) {
            if (!(SvFLAGS(sv) & SVs_PADTMP)) {
-               if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
+               if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
                    report_uninit(sv);
            }
             return (NV)0;
@@ -2776,7 +2776,7 @@
     else if (SvPOKp(sv) && SvLEN(sv)) {
        UV value;
        const int numtype = grok_number(SvPVX_const(sv), SvCUR(sv), &value);
-       if (ckWARN(WARN_NUMERIC) && !SvIOKp(sv) && !numtype)
+       if (!SvIOKp(sv) && !numtype && ckWARN(WARN_NUMERIC))
            not_a_number(sv);
 #ifdef NV_PRESERVES_UV
        if ((numtype & (IS_NUMBER_IN_UV | IS_NUMBER_NOT_INT))
@@ -2858,7 +2858,7 @@
 #endif /* NV_PRESERVES_UV */
     }
     else  {
-       if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing && !(SvFLAGS(sv) & 
SVs_PADTMP))
+       if (!PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP) && 
ckWARN(WARN_UNINITIALIZED))
            report_uninit(sv);
        if (SvTYPE(sv) < SVt_NV)
            /* Typically the caller expects that sv_any is not NULL now.  */
@@ -3043,7 +3043,7 @@
        }
         if (!SvROK(sv)) {
            if (!(SvFLAGS(sv) & SVs_PADTMP)) {
-               if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
+               if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
                    report_uninit(sv);
            }
            if (lp)
@@ -3268,8 +3268,7 @@
 #endif
     }
     else {
-       if (ckWARN(WARN_UNINITIALIZED)
-           && !PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP))
+       if (!PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP) && 
ckWARN(WARN_UNINITIALIZED))
            report_uninit(sv);
        if (lp)
        *lp = 0;
@@ -9690,8 +9689,10 @@
 
        default:
       unknown:
-           if (!args && ckWARN(WARN_PRINTF) &&
-                 (PL_op->op_type == OP_PRTF || PL_op->op_type == OP_SPRINTF)) {
+           if (!args
+               && (PL_op->op_type == OP_PRTF || PL_op->op_type == OP_SPRINTF)
+               && ckWARN(WARN_PRINTF))
+           {
                SV *msg = sv_newmortal();
                Perl_sv_setpvf(aTHX_ msg, "Invalid conversion in %sprintf: ",
                          (PL_op->op_type == OP_PRTF) ? "" : "s");

==== //depot/perl/toke.c#580 (text) ====

@@ -1555,9 +1555,9 @@
                /* FALL THROUGH */
            default:
                {
-                   if (ckWARN(WARN_MISC) &&
-                       isALNUM(*s) &&
-                       *s != '_')
+                   if (isALNUM(*s) &&
+                       *s != '_' &&
+                       ckWARN(WARN_MISC))
                        Perl_warner(aTHX_ packWARN(WARN_MISC),
                               "Unrecognized escape \\%c passed through",
                               *s);
@@ -3479,8 +3479,8 @@
            AOPERATOR(ANDAND);
        s--;
        if (PL_expect == XOPERATOR) {
-           if (ckWARN(WARN_SEMICOLON)
-               && isIDFIRST_lazy_if(s,UTF) && PL_bufptr == PL_linestart)
+           if (PL_bufptr == PL_linestart && ckWARN(WARN_SEMICOLON)
+               && isIDFIRST_lazy_if(s,UTF))
            {
                CopLINE_dec(PL_curcop);
                Perl_warner(aTHX_ packWARN(WARN_SEMICOLON), PL_warn_nosemi);
@@ -3515,7 +3515,7 @@
            OPERATOR(',');
        if (tmp == '~')
            PMop(OP_MATCH);
-       if (ckWARN(WARN_SYNTAX) && tmp && isSPACE(*s) && 
strchr("+-*/%.^&|<",tmp))
+       if (tmp && isSPACE(*s) && strchr("+-*/%.^&|<",tmp) && 
ckWARN(WARN_SYNTAX))
            Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "Reversed %c= 
operator",(int)tmp);
        s--;
        if (PL_expect == XSTATE && isALPHA(tmp) &&
@@ -3685,8 +3685,8 @@
            else if (*s == '{') {
                char *t;
                PL_tokenbuf[0] = '%';
-               if (ckWARN(WARN_SYNTAX) && strEQ(PL_tokenbuf+1, "SIG") &&
-                   (t = strchr(s, '}')) && (t = strchr(t, '=')))
+               if (strEQ(PL_tokenbuf+1, "SIG") && (t = strchr(s, '}'))
+                   && (t = strchr(t, '=')) && ckWARN(WARN_SYNTAX))
                {
                    char tmpbuf[sizeof PL_tokenbuf];
                    for (t++; isSPACE(*t); t++) ;
@@ -3766,8 +3766,8 @@
                PL_tokenbuf[0] = '%';
 
            /* Warn about @ where they meant $. */
-           if (ckWARN(WARN_SYNTAX)) {
-               if (*s == '[' || *s == '{') {
+           if (*s == '[' || *s == '{') {
+               if (ckWARN(WARN_SYNTAX)) {
                    const char *t = s + 1;
                    while (*t && (isALNUM_lazy_if(t,UTF) || strchr(" 
\t$#+-'\"", *t)))
                        t++;
@@ -3920,7 +3920,7 @@
 
     case '\\':
        s++;
-       if (ckWARN(WARN_SYNTAX) && PL_lex_inwhat && isDIGIT(*s))
+       if (PL_lex_inwhat && isDIGIT(*s) && ckWARN(WARN_SYNTAX))
            Perl_warner(aTHX_ packWARN(WARN_SYNTAX),"Can't use \\%c to mean $%c 
in expression",
                        *s, *s);
        if (PL_expect == XOPERATOR)
@@ -4081,8 +4081,8 @@
                }
                gv = Nullgv;
                gvp = 0;
-               if (ckWARN(WARN_AMBIGUOUS) && hgv
-                   && tmp != KEY_x && tmp != KEY_CORE) /* never ambiguous */
+               if (hgv && tmp != KEY_x && tmp != KEY_CORE
+                       && ckWARN(WARN_AMBIGUOUS))      /* never ambiguous */
                    Perl_warner(aTHX_ packWARN(WARN_AMBIGUOUS),
                        "Ambiguous call resolved as CORE::%s(), %s",
                         GvENAME(hgv), "qualify as such or use &");
@@ -4300,8 +4300,8 @@
                    yylval.opval->op_private |= OPpCONST_STRICT;
                else {
                bareword:
-                   if (ckWARN(WARN_RESERVED)) {
-                       if (lastchar != '-') {
+                   if (lastchar != '-') {
+                       if (ckWARN(WARN_RESERVED)) {
                            for (d = PL_tokenbuf; *d && isLOWER(*d); d++) ;
                            if (!*d && !gv_stashpv(PL_tokenbuf,FALSE))
                                Perl_warner(aTHX_ packWARN(WARN_RESERVED), 
PL_warn_reserved,
@@ -9281,8 +9281,8 @@
            pmflag(&pm->op_pmflags,*s++);
     }
     /* issue a warning if /c is specified,but /g is not */
-    if (ckWARN(WARN_REGEXP) &&
-        (pm->op_pmflags & PMf_CONTINUE) && !(pm->op_pmflags & PMf_GLOBAL))
+    if ((pm->op_pmflags & PMf_CONTINUE) && !(pm->op_pmflags & PMf_GLOBAL)
+           && ckWARN(WARN_REGEXP))
     {
         Perl_warner(aTHX_ packWARN(WARN_REGEXP), c_without_g);
     }
@@ -9337,7 +9337,7 @@
     }
 
     /* /c is not meaningful with s/// */
-    if (ckWARN(WARN_REGEXP) && (pm->op_pmflags & PMf_CONTINUE))
+    if ((pm->op_pmflags & PMf_CONTINUE) && ckWARN(WARN_REGEXP))
     {
         Perl_warner(aTHX_ packWARN(WARN_REGEXP), c_in_subst);
     }
@@ -10223,7 +10223,7 @@
 
                /* _ are ignored -- but warned about if consecutive */
                case '_':
-                   if (ckWARN(WARN_SYNTAX) && lastub && s == lastub + 1)
+                   if (lastub && s == lastub + 1 && ckWARN(WARN_SYNTAX))
                        Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
                                    "Misplaced _ in number");
                    lastub = s++;
@@ -10303,7 +10303,7 @@
 
            sv = NEWSV(92,0);
            if (overflowed) {
-               if (ckWARN(WARN_PORTABLE) && n > 4294967295.0)
+               if (n > 4294967295.0 && ckWARN(WARN_PORTABLE))
                    Perl_warner(aTHX_ packWARN(WARN_PORTABLE),
                                "%s number > %s non-portable",
                                Base, max);
@@ -10311,7 +10311,7 @@
            }
            else {
 #if UVSIZE > 4
-               if (ckWARN(WARN_PORTABLE) && u > 0xffffffff)
+               if (u > 0xffffffff && ckWARN(WARN_PORTABLE))
                    Perl_warner(aTHX_ packWARN(WARN_PORTABLE),
                                "%s number > %s non-portable",
                                Base, max);
@@ -10343,7 +10343,7 @@
               if -w is on
            */
            if (*s == '_') {
-               if (ckWARN(WARN_SYNTAX) && lastub && s == lastub + 1)
+               if (lastub && s == lastub + 1 && ckWARN(WARN_SYNTAX))
                    Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
                                "Misplaced _ in number");
                lastub = s++;
@@ -10385,7 +10385,7 @@
                if (d >= e)
                    Perl_croak(aTHX_ number_too_long);
                if (*s == '_') {
-                  if (ckWARN(WARN_SYNTAX) && lastub && s == lastub + 1)
+                  if (lastub && s == lastub + 1 && ckWARN(WARN_SYNTAX))
                       Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
                                   "Misplaced _ in number");
                   lastub = s;
@@ -10442,9 +10442,9 @@
                    *d++ = *s++;
                }
                else {
-                  if (ckWARN(WARN_SYNTAX) &&
-                      ((lastub && s == lastub + 1) ||
-                       (!isDIGIT(s[1]) && s[1] != '_')))
+                  if (((lastub && s == lastub + 1) ||
+                       (!isDIGIT(s[1]) && s[1] != '_'))
+                   && ckWARN(WARN_SYNTAX))
                       Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
                                   "Misplaced _ in number");
                   lastub = s++;

Reply via email to