In perl.git, the branch blead has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/1408fb84de0c28007d91730cde177d893e427181?hp=71648f9a69cff1f8ee90adfed51c64c3c2dfeaf1>
- Log -----------------------------------------------------------------
commit 1408fb84de0c28007d91730cde177d893e427181
Author: Karl Williamson <k...@khw-desktop.(none)>
Date: Sun May 30 13:05:48 2010 -0600
PATCH: [perl #75138] "\c`" -> " "
Attached is a patch for some of this issue. I took Nicholas' advice,
and if the result of \cX isn't a word character, the output message will
precede it with a backslash, so the message in the example would be
"\c`" more clearly written simply as "\ " at -e line 1.
I think that message is true.
I also added tests.
There is a test that guarantees that we won't ship 5.14 with things as
they are now in it. I added wording to the comments next to that test
to be sure to verify with this email thread if we should remove the
deprecation, and mentioned that in the explanatory wording in the pod.
I support removing the deprecation, but for now I'm not touching that,
to see what other issues may yet arise before 5.14.
-----------------------------------------------------------------------
Summary of changes:
pod/perldiag.pod | 5 +++--
t/op/qq.t | 12 +++++++-----
t/re/re_tests | 3 +++
util.c | 12 ++++++++++--
4 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index adeb5fb..8bb0f85 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -1423,11 +1423,12 @@ valid magic number.
you have also specified an explicit size for the string. See
L<perlfunc/pack>.
-=item "\c%c" more clearly written simply as "%c"
+=item "\c%c" more clearly written simply as "%s"
(D deprecated) The C<\cI<X>> construct is intended to be a way to specify
non-printable characters. You used it for a printable one, which is better
-written as simply itself.
+written as simply itself, perhaps preceded by a backslash for non-word
+characters. This message may not remain as Deprecated beyond 5.13.
=item Deep recursion on subroutine "%s"
diff --git a/t/op/qq.t b/t/op/qq.t
index b15ec52..3a3108e 100644
--- a/t/op/qq.t
+++ b/t/op/qq.t
@@ -63,18 +63,20 @@ is ("\x{1234}", chr 4660);
is ("\x{10FFFD}", chr 1114109);
# These kludged tests should change when we remove the temporary fatal error
-# in util.c for "\c{"
+# in util.c for "\c{". And, the warning there should probably not be
+# deprecated; See [perl #75138].
# BE SURE TO remove the message from the __DATA__ section of porting/diag.t,
-# and to verify the messages in util.c are adequately covered in perldiag.pod
+# and to verify the messages in util.c are adequately covered in
+# perldiag.pod, and to revise the explanatory wording that is there now.
my $value = eval '"\c{ACK}"';
if ($^V lt v5.13.0 || $^V ge v5.14.0) {
is ($@, "");
is ($value, ";ACK}");
}
-elsif ($@ ne "") { # 5.13 series, should fail
- is ("1", "1"); # This .t only has 'is' at its disposal
+elsif ($@ ne "") { # 5.13 series, expect the eval to fail, so pass it.
+ is ("1", "1"); # This .t only has 'is' at its disposal
is ("1", "1");
-}
+}
else { # Something wrong; someone has removed the failure in util.c
is ("Should fail for 5.13 until fix test", "0");
is ("1", "1");
diff --git a/t/re/re_tests b/t/re/re_tests
index ffa96a8..7cf5a80 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1450,5 +1450,8 @@ abc\N{def - c - \\N{NAME} must be
resolved by the lexer
# Verify works in single quotish context; regex compiler delivers slightly
different msg
# \N{U+BEEF.BEAD} succeeds here, because can't completely hide it from the
outside.
\N{U+0xBEEF} - c - Invalid hexadecimal number
+\c` - c - \"\\c`\" more clearly written simply as \"\\ \"
+\c1 - c - \"\\c1\" more clearly written simply as \"q\"
+\cA \001 y $& \1
# vim: set noexpandtab
diff --git a/util.c b/util.c
index 5e7a24e..75c4808 100644
--- a/util.c
+++ b/util.c
@@ -3855,10 +3855,18 @@ Perl_grok_bslash_c(pTHX_ const char source, const bool
output_warning)
Perl_croak(aTHX_ "It is proposed that \"\\c{\" no longer be valid.
It has historically evaluated to\n \";\". If you disagree with this proposal,
send email to [email protected]\notherwise, ... [87 chars truncated]
}
else if (output_warning) {
+ U8 clearer[3];
+ U8 i = 0;
+ if (! isALNUM(result)) {
+ clearer[i++] = '\\';
+ }
+ clearer[i++] = result;
+ clearer[i++] = '\0';
+
Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
- "\"\\c%c\" more clearly written simply as \"%c\"",
+ "\"\\c%c\" more clearly written simply as \"%s\"",
source,
- result);
+ clearer);
}
}
--
Perl5 Master Repository