Change 26111 by [EMAIL PROTECTED] on 2005/11/13 18:09:54
Integrate:
[ 25050]
replace ckWARN macros with functions
[ 25058]
Perl_ckwarn (added by change 25050) needs exporting on Win32
(At least PerlIO/via uses it, so it must be public)
[ 25061]
Here's the rest of change 25058 ;-)
[ 25129]
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))
[ 25159]
change #25129 was overzealous in delaying the call to ckWARN
Affected files ...
... //depot/maint-5.8/perl/doio.c#59 integrate
... //depot/maint-5.8/perl/embed.fnc#114 integrate
... //depot/maint-5.8/perl/embed.h#86 integrate
... //depot/maint-5.8/perl/global.sym#39 integrate
... //depot/maint-5.8/perl/gv.c#57 integrate
... //depot/maint-5.8/perl/op.c#112 integrate
... //depot/maint-5.8/perl/pad.c#44 integrate
... //depot/maint-5.8/perl/perlio.c#69 integrate
... //depot/maint-5.8/perl/pod/perlintern.pod#18 integrate
... //depot/maint-5.8/perl/pp.c#80 integrate
... //depot/maint-5.8/perl/pp_hot.c#87 integrate
... //depot/maint-5.8/perl/pp_sys.c#92 integrate
... //depot/maint-5.8/perl/proto.h#103 integrate
... //depot/maint-5.8/perl/regcomp.c#61 integrate
... //depot/maint-5.8/perl/regexec.c#54 integrate
... //depot/maint-5.8/perl/sv.c#193 integrate
... //depot/maint-5.8/perl/toke.c#100 integrate
... //depot/maint-5.8/perl/util.c#92 integrate
... //depot/maint-5.8/perl/warnings.h#5 integrate
... //depot/maint-5.8/perl/warnings.pl#14 integrate
Differences ...
==== //depot/maint-5.8/perl/doio.c#59 (text) ====
Index: perl/doio.c
--- perl/doio.c#58~26102~ Sat Nov 12 12:08:41 2005
+++ perl/doio.c Sun Nov 13 10:09:54 2005
@@ -565,7 +565,10 @@
}
}
if (!fp) {
- if (ckWARN(WARN_NEWLINE) && IoTYPE(io) == IoTYPE_RDONLY && strchr(name,
'\n'))
+ if (IoTYPE(io) == IoTYPE_RDONLY && ckWARN(WARN_NEWLINE)
+ && strchr(name, '\n')
+
+ )
Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "open");
goto say_false;
}
@@ -1078,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)) {
==== //depot/maint-5.8/perl/embed.fnc#114 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#113~25714~ Sat Oct 8 08:52:58 2005
+++ perl/embed.fnc Sun Nov 13 10:09:54 2005
@@ -1568,6 +1568,8 @@
#ifdef PERL_DONT_CREATE_GVSV
Ap |GV* |gv_SVadd |NN GV* gv
#endif
+Apo |bool |ckwarn |U32 w
+Apo |bool |ckwarn_d |U32 w
END_EXTERN_C
/*
==== //depot/maint-5.8/perl/global.sym#39 (text+w) ====
Index: perl/global.sym
--- perl/global.sym#38~25564~ Thu Sep 22 02:15:24 2005
+++ perl/global.sym Sun Nov 13 10:09:54 2005
@@ -716,4 +716,6 @@
Perl_newSVhek
Perl_stashpv_hvname_match
Perl_gv_SVadd
+Perl_ckwarn
+Perl_ckwarn_d
# ex: set ro:
==== //depot/maint-5.8/perl/gv.c#57 (text) ====
Index: perl/gv.c
--- perl/gv.c#56~26109~ Sun Nov 13 03:34:21 2005
+++ perl/gv.c Sun Nov 13 10:09:54 2005
@@ -548,8 +548,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/maint-5.8/perl/op.c#112 (text) ====
Index: perl/op.c
--- perl/op.c#111~26108~ Sun Nov 13 03:27:48 2005
+++ perl/op.c Sun Nov 13 10:09:54 2005
@@ -1801,11 +1801,12 @@
{
OP *o;
- 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];
@@ -1992,8 +1993,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;
@@ -3544,7 +3545,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))) {
op_free(first);
@@ -3561,7 +3562,7 @@
return first;
}
}
- else if (ckWARN(WARN_MISC) && (first->op_flags & OPf_KIDS)) {
+ else if ((first->op_flags & OPf_KIDS) && ckWARN(WARN_MISC)) {
const OP * const k1 = ((UNOP*)first)->op_first;
const OP * const k2 = k1->op_sibling;
OPCODE warnop = 0;
@@ -6177,7 +6178,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");
}
@@ -6203,9 +6204,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),
@@ -6697,8 +6698,9 @@
case OP_EXEC:
o->op_seq = PL_op_seqmax++;
- 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/maint-5.8/perl/pad.c#44 (text) ====
Index: perl/pad.c
--- perl/pad.c#43~26084~ Fri Nov 11 03:08:12 2005
+++ perl/pad.c Sun Nov 13 10:09:54 2005
@@ -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/maint-5.8/perl/perlio.c#69 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#68~25576~ Fri Sep 23 03:45:45 2005
+++ perl/perlio.c Sun Nov 13 10:09:54 2005
@@ -979,7 +979,6 @@
}
}
if (e > s) {
- const bool warn_layer = ckWARN(WARN_LAYER);
PerlIO_funcs * const 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/maint-5.8/perl/pp.c#80 (text) ====
Index: perl/pp.c
--- perl/pp.c#79~25673~ Fri Sep 30 10:13:04 2005
+++ perl/pp.c Sun Nov 13 10:09:54 2005
@@ -538,7 +538,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);
@@ -795,7 +795,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/maint-5.8/perl/pp_hot.c#87 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c#86~26109~ Sun Nov 13 03:34:21 2005
+++ perl/pp_hot.c Sun Nov 13 10:09:54 2005
@@ -1537,8 +1537,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)",
==== //depot/maint-5.8/perl/pp_sys.c#92 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c#91~26102~ Sat Nov 12 12:08:41 2005
+++ perl/pp_sys.c Sun Nov 13 10:09:54 2005
@@ -906,8 +906,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 ) ;
@@ -1228,8 +1227,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/maint-5.8/perl/proto.h#103 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#102~25714~ Sat Oct 8 08:52:58 2005
+++ perl/proto.h Sun Nov 13 10:09:54 2005
@@ -3901,6 +3901,8 @@
__attribute__nonnull__(pTHX_1);
#endif
+PERL_CALLCONV bool Perl_ckwarn(pTHX_ U32 w);
+PERL_CALLCONV bool Perl_ckwarn_d(pTHX_ U32 w);
END_EXTERN_C
/*
==== //depot/maint-5.8/perl/regcomp.c#61 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#60~25673~ Fri Sep 30 10:13:04 2005
+++ perl/regcomp.c Sun Nov 13 10:09:54 2005
@@ -1127,12 +1127,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");
@@ -2754,7 +2754,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,
@@ -3191,7 +3191,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;
}
@@ -3733,7 +3733,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/maint-5.8/perl/regexec.c#54 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#53~25673~ Fri Sep 30 10:13:04 2005
+++ perl/regexec.c Sun Nov 13 10:09:54 2005
@@ -1035,14 +1035,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++;
@@ -1081,14 +1082,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,
@@ -1115,8 +1115,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
@@ -2322,6 +2321,7 @@
SV *dsv1 = PERL_DEBUG_PAD_ZERO(1);
SV *dsv2 = PERL_DEBUG_PAD_ZERO(2);
#endif
+ U32 uniflags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
#ifdef DEBUGGING
PL_regindent++;
@@ -2475,7 +2475,6 @@
else
nextchr = UCHARAT(++locinput);
break;
-
case EXACT:
s = STRING(scan);
ln = STR_LEN(scan);
@@ -2492,8 +2491,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 ++;
@@ -2507,8 +2505,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 ++;
@@ -3625,16 +3622,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);
}
}
}
@@ -3695,8 +3689,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++;
}
@@ -3707,8 +3700,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;
@@ -3744,8 +3736,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. */
@@ -3794,8 +3785,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);
}
@@ -3817,8 +3807,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/maint-5.8/perl/sv.c#193 (text) ====
Index: perl/sv.c
--- perl/sv.c#192~26109~ Sun Nov 13 03:34:21 2005
+++ perl/sv.c Sun Nov 13 10:09:54 2005
@@ -2155,7 +2155,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();
}
return 0;
@@ -2415,7 +2415,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();
if (SvTYPE(sv) < SVt_IV)
/* Typically the caller expects that sv_any is not NULL now. */
@@ -2452,7 +2452,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();
}
return 0;
@@ -2693,7 +2693,7 @@
}
else {
if (!(SvFLAGS(sv) & SVs_PADTMP)) {
- if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
+ if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
report_uninit();
}
if (SvTYPE(sv) < SVt_IV)
@@ -2727,7 +2727,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));
@@ -2740,7 +2740,7 @@
}
if (!SvROK(sv)) {
if (!(SvFLAGS(sv) & SVs_PADTMP)) {
- if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
+ if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
report_uninit();
}
return (NV)0;
@@ -2807,7 +2807,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))
@@ -2889,7 +2889,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();
if (SvTYPE(sv) < SVt_NV)
/* Typically the caller expects that sv_any is not NULL now. */
@@ -3074,7 +3074,7 @@
}
if (!SvROK(sv)) {
if (!(SvFLAGS(sv) & SVs_PADTMP)) {
- if (ckWARN(WARN_UNINITIALIZED) && !PL_localizing)
+ if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
report_uninit();
}
if (lp)
@@ -3299,8 +3299,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();
if (lp)
*lp = 0;
@@ -9446,8 +9445,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/maint-5.8/perl/toke.c#100 (text) ====
Index: perl/toke.c
--- perl/toke.c#99~26109~ Sun Nov 13 03:34:21 2005
+++ perl/toke.c Sun Nov 13 10:09:54 2005
@@ -1549,9 +1549,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);
@@ -3482,8 +3482,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);
@@ -3518,7 +3518,7 @@
OPERATOR(',');
if (tmp == '~')
PMop(OP_MATCH);
- if (ckWARN(WARN_SYNTAX) && tmp && isSPACE(*s) &&
strchr("+-*/%.^&|<",tmp))
+ if (tmp && isSPACE(*s) && ckWARN(WARN_SYNTAX) &&
strchr("+-*/%.^&|<",tmp))
Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "Reversed %c=
operator",(int)tmp);
s--;
if (PL_expect == XSTATE && isALPHA(tmp) &&
@@ -3672,8 +3672,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") && ckWARN(WARN_SYNTAX)
+ && (t = strchr(s, '}')) && (t = strchr(t, '=')))
{
char tmpbuf[sizeof PL_tokenbuf];
for (t++; isSPACE(*t); t++) ;
@@ -3750,8 +3750,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++;
@@ -3886,7 +3886,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)
@@ -4035,8 +4035,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 &");
@@ -4254,8 +4254,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,
@@ -9231,8 +9231,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);
}
@@ -9286,7 +9286,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);
}
@@ -10170,7 +10170,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++;
@@ -10250,7 +10250,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);
@@ -10258,7 +10258,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);
@@ -10290,7 +10290,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++;
@@ -10332,7 +10332,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;
@@ -10389,9 +10389,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++;
==== //depot/maint-5.8/perl/util.c#92 (text) ====
Index: perl/util.c
--- perl/util.c#91~25692~ Wed Oct 5 07:20:45 2005
+++ perl/util.c Sun Nov 13 10:09:54 2005
@@ -1384,6 +1384,58 @@
}
}
+/* implements the ckWARN? macros */
+
+bool
+Perl_ckwarn(pTHX_ U32 w)
+{
+ return
+ (
+ isLEXWARN_on
+ && PL_curcop->cop_warnings != pWARN_NONE
+ && (
+ PL_curcop->cop_warnings == pWARN_ALL
+ || isWARN_on(PL_curcop->cop_warnings, unpackWARN1(w))
+ || (unpackWARN2(w) &&
+ isWARN_on(PL_curcop->cop_warnings, unpackWARN2(w)))
+ || (unpackWARN3(w) &&
+ isWARN_on(PL_curcop->cop_warnings, unpackWARN3(w)))
+ || (unpackWARN4(w) &&
+ isWARN_on(PL_curcop->cop_warnings, unpackWARN4(w)))
+ )
+ )
+ ||
+ (
+ isLEXWARN_off && PL_dowarn & G_WARN_ON
+ )
+ ;
+}
+
+/* implements the ckWARN?_d macro */
+
+bool
+Perl_ckwarn_d(pTHX_ U32 w)
+{
+ return
+ isLEXWARN_off
+ || PL_curcop->cop_warnings == pWARN_ALL
+ || (
+ PL_curcop->cop_warnings != pWARN_NONE
+ && (
+ isWARN_on(PL_curcop->cop_warnings, unpackWARN1(w))
+ || (unpackWARN2(w) &&
+ isWARN_on(PL_curcop->cop_warnings, unpackWARN2(w)))
+ || (unpackWARN3(w) &&
+ isWARN_on(PL_curcop->cop_warnings, unpackWARN3(w)))
+ || (unpackWARN4(w) &&
+ isWARN_on(PL_curcop->cop_warnings, unpackWARN4(w)))
+ )
+ )
+ ;
+}
+
+
+
/* since we've already done strlen() for both nam and val
* we can use that info to make things faster than
* sprintf(s, "%s=%s", nam, val)
==== //depot/maint-5.8/perl/warnings.h#5 (text+w) ====
Index: perl/warnings.h
--- perl/warnings.h#4~25551~ Wed Sep 21 11:21:10 2005
+++ perl/warnings.h Sun Nov 13 10:09:54 2005
@@ -85,61 +85,15 @@
#define isWARN_on(c,x) (IsSet(SvPVX_const(c), 2*(x)))
#define isWARNf_on(c,x) (IsSet(SvPVX_const(c), 2*(x)+1))
-#define ckWARN(x) \
- ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- isWARN_on(PL_curcop->cop_warnings, x) ) ) \
- || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN2(x,y) \
- ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) ) ) \
- || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN3(x,y,z) \
- ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) || \
- isWARN_on(PL_curcop->cop_warnings, z) ) ) \
- || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN4(x,y,z,t) \
- ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) || \
- isWARN_on(PL_curcop->cop_warnings, z) || \
- isWARN_on(PL_curcop->cop_warnings, t) ) ) \
- || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN_d(x) \
- (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- isWARN_on(PL_curcop->cop_warnings, x) ) )
-
-#define ckWARN2_d(x,y) \
- (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- (isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) ) ) )
-
-#define ckWARN3_d(x,y,z) \
- (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- (isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) || \
- isWARN_on(PL_curcop->cop_warnings, z) ) ) )
-
-#define ckWARN4_d(x,y,z,t) \
- (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- (isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) || \
- isWARN_on(PL_curcop->cop_warnings, z) || \
- isWARN_on(PL_curcop->cop_warnings, t) ) ) )
+#define ckWARN(w) Perl_ckwarn(aTHX_ packWARN(w))
+#define ckWARN2(w1,w2) Perl_ckwarn(aTHX_ packWARN2(w1,w2))
+#define ckWARN3(w1,w2,w3) Perl_ckwarn(aTHX_ packWARN3(w1,w2,w3))
+#define ckWARN4(w1,w2,w3,w4) Perl_ckwarn(aTHX_ packWARN4(w1,w2,w3,w4))
+
+#define ckWARN_d(w) Perl_ckwarn_d(aTHX_ packWARN(w))
+#define ckWARN2_d(w1,w2) Perl_ckwarn_d(aTHX_ packWARN2(w1,w2))
+#define ckWARN3_d(w1,w2,w3) Perl_ckwarn_d(aTHX_ packWARN3(w1,w2,w3))
+#define ckWARN4_d(w1,w2,w3,w4) Perl_ckwarn_d(aTHX_ packWARN4(w1,w2,w3,w4))
#define packWARN(a) (a )
#define packWARN2(a,b) ((a) | ((b)<<8) )
==== //depot/maint-5.8/perl/warnings.pl#14 (text) ====
Index: perl/warnings.pl
--- perl/warnings.pl#13~25551~ Wed Sep 21 11:21:10 2005
+++ perl/warnings.pl Sun Nov 13 10:09:54 2005
@@ -327,61 +327,15 @@
#define isWARN_on(c,x) (IsSet(SvPVX_const(c), 2*(x)))
#define isWARNf_on(c,x) (IsSet(SvPVX_const(c), 2*(x)+1))
-#define ckWARN(x) \
- ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- isWARN_on(PL_curcop->cop_warnings, x) ) ) \
- || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN2(x,y) \
- ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) ) ) \
- || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN3(x,y,z) \
- ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) || \
- isWARN_on(PL_curcop->cop_warnings, z) ) ) \
- || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN4(x,y,z,t) \
- ( (isLEXWARN_on && PL_curcop->cop_warnings != pWARN_NONE && \
- (PL_curcop->cop_warnings == pWARN_ALL || \
- isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) || \
- isWARN_on(PL_curcop->cop_warnings, z) || \
- isWARN_on(PL_curcop->cop_warnings, t) ) ) \
- || (isLEXWARN_off && PL_dowarn & G_WARN_ON) )
-
-#define ckWARN_d(x) \
- (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- isWARN_on(PL_curcop->cop_warnings, x) ) )
-
-#define ckWARN2_d(x,y) \
- (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- (isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) ) ) )
-
-#define ckWARN3_d(x,y,z) \
- (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- (isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) || \
- isWARN_on(PL_curcop->cop_warnings, z) ) ) )
-
-#define ckWARN4_d(x,y,z,t) \
- (isLEXWARN_off || PL_curcop->cop_warnings == pWARN_ALL || \
- (PL_curcop->cop_warnings != pWARN_NONE && \
- (isWARN_on(PL_curcop->cop_warnings, x) || \
- isWARN_on(PL_curcop->cop_warnings, y) || \
- isWARN_on(PL_curcop->cop_warnings, z) || \
- isWARN_on(PL_curcop->cop_warnings, t) ) ) )
+#define ckWARN(w) Perl_ckwarn(aTHX_ packWARN(w))
+#define ckWARN2(w1,w2) Perl_ckwarn(aTHX_ packWARN2(w1,w2))
+#define ckWARN3(w1,w2,w3) Perl_ckwarn(aTHX_ packWARN3(w1,w2,w3))
+#define ckWARN4(w1,w2,w3,w4) Perl_ckwarn(aTHX_ packWARN4(w1,w2,w3,w4))
+
+#define ckWARN_d(w) Perl_ckwarn_d(aTHX_ packWARN(w))
+#define ckWARN2_d(w1,w2) Perl_ckwarn_d(aTHX_ packWARN2(w1,w2))
+#define ckWARN3_d(w1,w2,w3) Perl_ckwarn_d(aTHX_ packWARN3(w1,w2,w3))
+#define ckWARN4_d(w1,w2,w3,w4) Perl_ckwarn_d(aTHX_ packWARN4(w1,w2,w3,w4))
#define packWARN(a) (a )
#define packWARN2(a,b) ((a) | ((b)<<8) )
End of Patch.