From: Nicholas Clark Date: Sun, 15 Nov 2009 16:29:16 +0000 (+0000) Subject: Inline PL_no_symref_sv into its users. Deprecate the visible global variable. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=def89bff35e7f449eacdd8db98c267bd0fc7bce4;p=p5sagit%2Fp5-mst-13.2.git Inline PL_no_symref_sv into its users. Deprecate the visible global variable. As the core no longer needs this fixed string outside of pp.c, it seems daft to make it public just in case any module wants to use it. Modules that do should provide their own inline copy in future. Also restore the visible global PL_no_symref_sv back to the original format specificiation (of 5.10.0 and earlier). --- diff --git a/perl.h b/perl.h index 1a63b7c..38c9664 100644 --- a/perl.h +++ b/perl.h @@ -4218,10 +4218,12 @@ EXTCONST char PL_warn_nl[] INIT("Unsuccessful %s on filename containing newline"); EXTCONST char PL_no_wrongref[] INIT("Can't use %s ref as %s ref"); +/* The core no longer needs these here. If you require the string constant, + please inline a copy into your own code. */ EXTCONST char PL_no_symref[] __attribute__deprecated__ INIT("Can't use string (\"%.32s\") as %s ref while \"strict refs\" in use"); -EXTCONST char PL_no_symref_sv[] - INIT("Can't use string (\"%" SVf32 "\"%s) as %s ref while \"strict refs\" in use"); +EXTCONST char PL_no_symref_sv[] __attribute__deprecated__ + INIT("Can't use string (\"%" SVf32 "\") as %s ref while \"strict refs\" in use"); EXTCONST char PL_no_usym[] INIT("Can't use an undefined value as %s reference"); EXTCONST char PL_no_aelem[] diff --git a/pp.c b/pp.c index eaeb89f..b271e7b 100644 --- a/pp.c +++ b/pp.c @@ -130,6 +130,9 @@ PP(pp_padhv) /* Translations. */ +const char S_no_symref_sv[] = + "Can't use string (\"%" SVf32 "\"%s) as %s ref while \"strict refs\" in use"; + PP(pp_rv2gv) { dVAR; dSP; dTOPss; @@ -202,7 +205,7 @@ PP(pp_rv2gv) } else { if (PL_op->op_private & HINT_STRICT_REFS) - DIE(aTHX_ PL_no_symref_sv, sv, (SvCUR(sv)>32 ? "..." : ""), "a symbol"); + DIE(aTHX_ S_no_symref_sv, sv, (SvCUR(sv)>32 ? "..." : ""), "a symbol"); if ((PL_op->op_private & (OPpLVAL_INTRO|OPpDONT_INIT_GV)) == OPpDONT_INIT_GV) { /* We are the target of a coderef assignment. Return @@ -232,7 +235,7 @@ Perl_softref2xv(pTHX_ SV *const sv, const char *const what, if (PL_op->op_private & HINT_STRICT_REFS) { if (SvOK(sv)) - Perl_die(aTHX_ PL_no_symref_sv, sv, (SvCUR(sv)>32 ? "..." : ""), what); + Perl_die(aTHX_ S_no_symref_sv, sv, (SvCUR(sv)>32 ? "..." : ""), what); else Perl_die(aTHX_ PL_no_usym, what); }