summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doio.c12
-rw-r--r--gv.c5
-rw-r--r--op.c32
-rw-r--r--pad.c2
-rw-r--r--perlio.c3
-rw-r--r--pp.c4
-rw-r--r--pp_hot.c9
-rw-r--r--pp_pack.c19
-rw-r--r--pp_sys.c7
-rw-r--r--regcomp.c14
-rw-r--r--regexec.c47
-rw-r--r--sv.c27
-rw-r--r--toke.c52
13 files changed, 112 insertions, 121 deletions
diff --git a/doio.c b/doio.c
index b105845e84..4d7d19b955 100644
--- a/doio.c
+++ b/doio.c
@@ -566,7 +566,9 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
}
}
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 @@ Perl_do_eof(pTHX_ GV *gv)
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 @@ Perl_my_stat(pTHX)
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 @@ Perl_my_lstat(pTHX)
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;
diff --git a/gv.c b/gv.c
index 823102c7b8..d307124907 100644
--- a/gv.c
+++ b/gv.c
@@ -547,8 +547,9 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method)
/*
* 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);
diff --git a/op.c b/op.c
index 1caca1425f..b7f560b435 100644
--- a/op.c
+++ b/op.c
@@ -1767,11 +1767,12 @@ Perl_bind_match(pTHX_ I32 type, OP *left, OP *right)
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 @@ Perl_localize(pTHX_ OP *o, I32 lex)
;
#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 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
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 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
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 @@ Perl_ck_split(pTHX_ OP *o)
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 @@ Perl_ck_split(pTHX_ OP *o)
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 @@ Perl_ck_subr(pTHX_ OP *o)
}
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 @@ Perl_peep(pTHX_ register OP *o)
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 &&
diff --git a/pad.c b/pad.c
index 5f04fd63b3..f60aeaf6dd 100644
--- a/pad.c
+++ b/pad.c
@@ -501,7 +501,7 @@ Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
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);
diff --git a/perlio.c b/perlio.c
index 2276f4c339..9cd24d2bf9 100644
--- a/perlio.c
+++ b/perlio.c
@@ -979,7 +979,6 @@ PerlIO_parse_layers(pTHX_ PerlIO_list_t *av, const char *names)
}
}
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 @@ PerlIO_parse_layers(pTHX_ PerlIO_list_t *av, const char *names)
&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;
diff --git a/pp.c b/pp.c
index 039aeba63b..cb48bb86a4 100644
--- a/pp.c
+++ b/pp.c
@@ -531,7 +531,7 @@ PP(pp_bless)
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 @@ PP(pp_undef)
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 */
diff --git a/pp_hot.c b/pp_hot.c
index b4b73ad566..07eb58553c 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1494,8 +1494,9 @@ Perl_do_readline(pTHX)
}
}
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 @@ Perl_do_readline(pTHX)
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",
diff --git a/pp_pack.c b/pp_pack.c
index 2bcb731f68..63a60f190e 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1024,8 +1024,7 @@ S_next_symbol(pTHX_ tempsym_t* symptr )
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 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
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 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
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 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
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 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
}
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 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
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 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
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 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
* 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");
}
diff --git a/pp_sys.c b/pp_sys.c
index b126647d8b..2d1752bf1b 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -907,8 +907,7 @@ PP(pp_untie)
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 @@ PP(pp_getc)
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;
diff --git a/regcomp.c b/regcomp.c
index eab68b337d..e38a5723c3 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2202,12 +2202,12 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg
}
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 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp)
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 @@ tryagain:
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 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
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);
diff --git a/regexec.c b/regexec.c
index 6a644d978a..c764c373c8 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1039,14 +1039,15 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, const char *strend, I32
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 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, const char *strend, I32
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 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, const char *strend, I32
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 @@ S_regmatch(pTHX_ regnode *prog)
SV *re_debug_flags = NULL;
#endif
+ U32 uniflags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
GET_RE_DEBUG_FLAGS;
@@ -2583,8 +2583,6 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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 @@ S_regmatch(pTHX_ regnode *prog)
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);
}
diff --git a/sv.c b/sv.c
index 4e25290153..fd77ada7c9 100644
--- a/sv.c
+++ b/sv.c
@@ -2113,7 +2113,7 @@ Perl_sv_2iv_flags(pTHX_ register SV *sv, I32 flags)
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 @@ Perl_sv_2iv_flags(pTHX_ register SV *sv, I32 flags)
#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 @@ Perl_sv_2uv_flags(pTHX_ register SV *sv, I32 flags)
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 @@ Perl_sv_2uv_flags(pTHX_ register SV *sv, I32 flags)
}
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 @@ Perl_sv_2nv(pTHX_ register SV *sv)
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 @@ Perl_sv_2nv(pTHX_ register SV *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 (NV)0;
@@ -2776,7 +2776,7 @@ Perl_sv_2nv(pTHX_ register SV *sv)
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 @@ Perl_sv_2nv(pTHX_ register SV *sv)
#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 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
}
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 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags)
#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 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
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");
diff --git a/toke.c b/toke.c
index 780855e049..33ec2c460e 100644
--- a/toke.c
+++ b/toke.c
@@ -1555,9 +1555,9 @@ S_scan_const(pTHX_ char *start)
/* 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 @@ Perl_yylex(pTHX)
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 @@ Perl_yylex(pTHX)
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 @@ Perl_yylex(pTHX)
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 @@ Perl_yylex(pTHX)
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 @@ Perl_yylex(pTHX)
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 @@ Perl_yylex(pTHX)
}
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 @@ Perl_yylex(pTHX)
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 @@ S_scan_pat(pTHX_ char *start, I32 type)
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 @@ S_scan_subst(pTHX_ char *start)
}
/* /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 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
/* _ 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 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
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 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
}
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 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
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 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
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 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
*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++;