}
}
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;
}
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)) {
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;
}
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;
/*
* 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);
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];
;
#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;
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)) ||
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;
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");
}
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),
}
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");
}
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 &&
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);
}
}
if (e > s) {
- const bool warn_layer = ckWARN(WARN_LAYER);
PerlIO_funcs *layer =
PerlIO_find_layer(aTHX_ s, llen, 1);
if (layer) {
&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;
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);
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 */
}
}
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)",
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",
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),
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);
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 */
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 */
}
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) {
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';
end = start+SvLEN(cat)-UTF8_MAXLEN;
}
cur = (char *) uvuni_to_utf8_flags((U8 *) cur, auv,
- ckWARN(WARN_UTF8) ?
+ warn_utf8 ?
0 : UNICODE_ALLOW_ANY);
}
}
* 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");
}
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 ) ;
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;
}
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");
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,
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;
}
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);
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++;
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,
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
SV *re_debug_flags = NULL;
#endif
+ U32 uniflags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
GET_RE_DEBUG_FLAGS;
case TRIEF:
case TRIEFL:
{
-
- const U32 uniflags = ckWARN( WARN_UTF8 ) ? 0 : UTF8_ALLOW_ANY;
U8 *uc = ( U8* )locinput;
U32 state = 1;
U16 charid = 0;
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;
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 ++;
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 ++;
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);
}
}
}
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++;
}
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;
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. */
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 (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);
}
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;
#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. */
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;
}
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)
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));
}
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;
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))
#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. */
}
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)
#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;
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");
/* 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);
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);
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) &&
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++) ;
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++;
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)
}
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 &");
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,
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);
}
}
/* /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);
}
/* _ 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++;
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);
}
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);
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++;
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;
*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++;