summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-11-15 15:41:02 +0000
committerNicholas Clark <nick@ccl4.org>2009-11-15 16:31:58 +0000
commit973a76153032581ad3a0224d9cb13b7191f46ee5 (patch)
treee30469d82e516bf06c22a0182d47672c25861214
parentf0e67a1d29102aa9905aecf2b0f98449697d5af3 (diff)
downloadperl-973a76153032581ad3a0224d9cb13b7191f46ee5.tar.gz
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.
-rw-r--r--perl.h4
-rw-r--r--pp_hot.c2
-rw-r--r--t/porting/diag.t1
3 files changed, 4 insertions, 3 deletions
diff --git a/perl.h b/perl.h
index fe6b7fcec0..1a63b7ceb6 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 a74be213fa..48b57d6f7d 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 cdb6dba915..66e5a21afa 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