From: Nicholas Clark Date: Sun, 15 Nov 2009 15:41:02 +0000 (+0000) Subject: Inline PL_no_symref into pp_entersub. Deprecate the visible global variable. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=973a76153032581ad3a0224d9cb13b7191f46ee5;p=p5sagit%2Fp5-mst-13.2.git Inline PL_no_symref into pp_entersub. Deprecate the visible global variable. As the core no longer needs this fixed string in more than one place, it seems daft to go to the overhead (and cost) of making it public in case any module wants to use it. Modules that do want to use it should provide their own inline copy in future. Also restore the visible global PL_no_symref back to the original format specification (of 5.10.0 and earlier), as an extra %s has the potential to cause SEGVs or worse if not spotted at compile time. --- diff --git a/perl.h b/perl.h index fe6b7fc..1a63b7c 100644 --- a/perl.h +++ b/perl.h @@ -4218,8 +4218,8 @@ 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"); -EXTCONST char PL_no_symref[] - INIT("Can't use string (\"%.32s\"%s) as %s ref while \"strict refs\" in use"); +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_usym[] diff --git a/pp_hot.c b/pp_hot.c index a74be21..48b57d6 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2700,7 +2700,7 @@ PP(pp_entersub) if (!sym) DIE(aTHX_ PL_no_usym, "a subroutine"); if (PL_op->op_private & HINT_STRICT_REFS) - DIE(aTHX_ PL_no_symref, sym, len>32 ? "..." : "", "a subroutine"); + DIE(aTHX_ "Can't use string (\"%.32s\"%s) as a subroutine ref while \"strict refs\" in use", sym, len>32 ? "..." : ""); cv = get_cvn_flags(sym, len, GV_ADD|SvUTF8(sv)); break; } diff --git a/t/porting/diag.t b/t/porting/diag.t index cdb6dba..66e5a21 100644 --- a/t/porting/diag.t +++ b/t/porting/diag.t @@ -222,6 +222,7 @@ Can't %s %s%s%s Can't %s `%s' with ARGV[0] being `%s' (looking for executables only, not found) Can't take %s of %f Can't use '%c' after -mname +Can't use string ("%s"%s) as a subroutine ref while "strict refs" in use Can't use \\%c to mean $%c in expression Can't use when() outside a topicalizer \\%c better written as $%c