From: Rafael Garcia-Suarez Date: Thu, 22 Apr 2010 16:12:44 +0000 (+0200) Subject: Consistently use OP_DESC instead of OP_NAME in error messages X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=94bbb3f46663f977c3c2dad2c182d4985f3ccc60;p=p5sagit%2Fp5-mst-13.2.git Consistently use OP_DESC instead of OP_NAME in error messages This solves bug: [perl #74572] chop dies with error about schop This is not backwards-compatible, as some error messages can change, as seen by the required change to t/op/sprintf2.t. --- diff --git a/sv.c b/sv.c index 21d0a8e..c29580f 100644 --- a/sv.c +++ b/sv.c @@ -1717,7 +1717,7 @@ Perl_sv_setnv(pTHX_ register SV *const sv, const NV num) case SVt_PVFM: case SVt_PVIO: Perl_croak(aTHX_ "Can't coerce %s to number in %s", sv_reftype(sv,0), - OP_NAME(PL_op)); + OP_DESC(PL_op)); default: NOOP; } SvNV_set(sv, num); @@ -3914,7 +3914,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV* sstr, const I32 flags) { const char * const type = sv_reftype(sstr,0); if (PL_op) - Perl_croak(aTHX_ "Bizarre copy of %s in %s", type, OP_NAME(PL_op)); + Perl_croak(aTHX_ "Bizarre copy of %s in %s", type, OP_DESC(PL_op)); else Perl_croak(aTHX_ "Bizarre copy of %s", type); } @@ -3974,7 +3974,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV* sstr, const I32 flags) } else if (dtype == SVt_PVAV || dtype == SVt_PVHV) { const char * const type = sv_reftype(dstr,0); if (PL_op) - Perl_croak(aTHX_ "Cannot copy to %s in %s", type, OP_NAME(PL_op)); + Perl_croak(aTHX_ "Cannot copy to %s in %s", type, OP_DESC(PL_op)); else Perl_croak(aTHX_ "Cannot copy to %s", type); } else if (sflags & SVf_ROK) { @@ -8435,14 +8435,14 @@ Perl_sv_pvn_force_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags) const char * const ref = sv_reftype(sv,0); if (PL_op) Perl_croak(aTHX_ "Can't coerce readonly %s to string in %s", - ref, OP_NAME(PL_op)); + ref, OP_DESC(PL_op)); else Perl_croak(aTHX_ "Can't coerce readonly %s to string", ref); } if ((SvTYPE(sv) > SVt_PVLV && SvTYPE(sv) != SVt_PVFM) || isGV_with_GP(sv)) Perl_croak(aTHX_ "Can't coerce %s to string in %s", sv_reftype(sv,0), - OP_NAME(PL_op)); + OP_DESC(PL_op)); s = sv_2pv_flags(sv, &len, flags); if (lp) *lp = len; @@ -9291,7 +9291,7 @@ S_expect_number(pTHX_ char **const pattern) while (isDIGIT(**pattern)) { const I32 tmp = var * 10 + (*(*pattern)++ - '0'); if (tmp < var) - Perl_croak(aTHX_ "Integer overflow in format string for %s", (PL_op ? OP_NAME(PL_op) : "sv_vcatpvfn")); + Perl_croak(aTHX_ "Integer overflow in format string for %s", (PL_op ? OP_DESC(PL_op) : "sv_vcatpvfn")); var = tmp; } } diff --git a/t/op/sprintf2.t b/t/op/sprintf2.t index e81b59e..87e5e50 100644 --- a/t/op/sprintf2.t +++ b/t/op/sprintf2.t @@ -53,7 +53,7 @@ for (int(~0/2+1), ~0, "9999999999999999999") { is(eval {sprintf "%${_}d", 0}, undef, "no sprintf result expected %${_}d"); like($@, qr/^Integer overflow in format string for sprintf /, "overflow in sprintf"); is(eval {printf "%${_}d\n", 0}, undef, "no printf result expected %${_}d"); - like($@, qr/^Integer overflow in format string for prtf /, "overflow in printf"); + like($@, qr/^Integer overflow in format string for printf /, "overflow in printf"); } # check %NNN$ for range bounds