Skip to content

Commit

Permalink
Revert "Deprecating the use of C<< \cI<X> >> to specify a printable c…
Browse files Browse the repository at this point in the history
…haracter."

This reverts commit bfdc8cd.
  • Loading branch information
xsawyerx committed Feb 12, 2017
1 parent 583bfb0 commit d4360ef
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 64 deletions.
8 changes: 4 additions & 4 deletions dquote.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ Perl_grok_bslash_c(pTHX_ const char source, const bool output_warning)
clearer[i++] = result;
clearer[i++] = '\0';

Perl_ck_warner_d(aTHX_ packWARN2(WARN_SYNTAX,WARN_DEPRECATED),
"\"\\c%c\" is more clearly written simply as \"%s\". "
"This will be a fatal error in Perl 5.28",
source, clearer);
Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),
"\"\\c%c\" is more clearly written simply as \"%s\"",
source,
clearer);
}

return result;
Expand Down
19 changes: 0 additions & 19 deletions pod/perldeprecation.pod
Original file line number Diff line number Diff line change
Expand Up @@ -340,25 +340,6 @@ C<use AutoLoader 'AUTOLOAD';>.
This feature was deprecated in Perl 5.004, and will be fatal in Perl 5.28.


=head3 Use of C<< \cI<X> >> to specify a printable character.

In a double quoted context, Perl has the C<< \c >> construct to write
control characters in a readable way. For instance, the tab character
can be written as C<< \cI >> (I<< control-I >>), and the escape
character can be written as C<< \c[ >>.

Due to implementation details, the C<< \c >> construct can be used
to create regular, printable, characters as well. For instance,
C<< \c >> maps a C<< , >> to C<< l >>; that is C<< \c, >> is an
obscure way of writing C<< l >>. And not only that, it's also not
portable between ASCII and EBCDIC platforms.

Using the C<< \c >> construct with an argument which maps to a
printable character was deprecated in Perl 5.14, and will be a fatal
error in Perl 5.28. You're recommended to just write the intended
character instead.


=head3 Use of code points over 0xFF in string bitwise operators

The string bitwise operators, C<&>, C<|>, C<^>, and C<~>, treat
Expand Down
22 changes: 10 additions & 12 deletions pod/perldiag.pod
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ Perhaps you need to copy the value to a temporary, and repeat that.

Note that ASCII characters that don't map to control characters are
discouraged, and will generate the warning (when enabled)
L</""\c%c" is more clearly written simply as "%s". This will be a fatal error in Perl 5.28">.
L</""\c%c" is more clearly written simply as "%s"">.

=item Character following \%c must be '{' or a single-character Unicode property name in regex; marked by <-- HERE in m/%s/

Expand Down Expand Up @@ -1653,15 +1653,13 @@ See L<charnames/CUSTOM ALIASES>.

(W unopened) You tried chdir() on a filehandle that was never opened.

=item "\c%c" is more clearly written simply as "%s". This will be a fatal error in Perl 5.28
=item "\c%c" is more clearly written simply as "%s"

(D deprecated, syntax) 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, perhaps preceded by
a backslash for non-word characters. Doing it the way you did is
not portable between ASCII and EBCDIC platforms.

This usage is going to result in a fatal error in Perl 5.28.
(W syntax) 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, perhaps preceded by a backslash
for non-word characters. Doing it the way you did is not portable
between ASCII and EBCDIC platforms.

=item Cloning substitution context is unimplemented

Expand Down Expand Up @@ -3140,13 +3138,13 @@ code.
In Perl 5.30, it will no longer be possible to use sysread(), recv(),
syswrite() or send() to read or send bytes from/to :utf8 handles.

=item "%s" is more clearly written simply as "%s" in regex. This will be a fatal error in Perl 5.28; marked by S<<-- HERE> in m/%s/
=item "%s" is more clearly written simply as "%s" in regex; marked by S<<-- HERE> in m/%s/

(W deprecated, regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)
(W regexp) (only under C<S<use re 'strict'>> or within C<(?[...])>)

You specified a character that has the given plainer way of writing it,
and which is also portable to platforms running with different character
sets. This usage is deprecated, and will be a fatal error in Perl 5.28.
sets.

=item $* is no longer supported. Its use will be fatal in Perl 5.30

Expand Down
21 changes: 6 additions & 15 deletions regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,13 +818,6 @@ static const scan_data_t zero_scan_data =
REPORT_LOCATION_ARGS(loc)); \
} STMT_END

#define vWARN4dep(loc, m, a1, a2, a3) STMT_START { \
__ASSERT_(PASS2) Perl_warner(aTHX_ packWARN2(WARN_REGEXP,WARN_DEPRECATED), \
m REPORT_LOCATION, \
a1, a2, a3, \
REPORT_LOCATION_ARGS(loc)); \
} STMT_END

#define ckWARN4reg(loc, m, a1, a2, a3) STMT_START { \
__ASSERT_(PASS2) Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP), \
m REPORT_LOCATION, \
Expand Down Expand Up @@ -16933,22 +16926,20 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
literal[d++] = (char) value;
literal[d++] = '\0';

vWARN4dep(RExC_parse,
"\"%.*s\" is more clearly written simply as \"%s\". "
"This will be a fatal error in Perl 5.28",
vWARN4(RExC_parse,
"\"%.*s\" is more clearly written simply as \"%s\"",
(int) (RExC_parse - rangebegin),
rangebegin,
literal
);
);
}
else if isMNEMONIC_CNTRL(value) {
vWARN4dep(RExC_parse,
"\"%.*s\" is more clearly written simply as \"%s\". "
"This will be a fatal error in Perl 5.28",
vWARN4(RExC_parse,
"\"%.*s\" is more clearly written simply as \"%s\"",
(int) (RExC_parse - rangebegin),
rangebegin,
cntrl_to_mnemonic((U8) value)
);
);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions t/lib/warnings/regcomp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ BEGIN {
use warnings;
$a = qr/\c,/;
$a = qr/[\c,]/;
no warnings 'syntax', 'deprecated';
no warnings 'syntax';
$a = qr/\c,/;
$a = qr/[\c,]/;
EXPECT
"\c," is more clearly written simply as "l". This will be a fatal error in Perl 5.28 at - line 9.
"\c," is more clearly written simply as "l". This will be a fatal error in Perl 5.28 at - line 10.
"\c," is more clearly written simply as "l" at - line 9.
"\c," is more clearly written simply as "l" at - line 10.
########
# This is because currently a different error is output under
# use re 'strict', so can't go in reg_mesg.t
Expand Down
6 changes: 3 additions & 3 deletions t/lib/warnings/toke
Original file line number Diff line number Diff line change
Expand Up @@ -1385,12 +1385,12 @@ BEGIN {
use warnings;
$a = "\c,";
$a = "\c`";
no warnings 'syntax', 'deprecated';
no warnings 'syntax';
$a = "\c,";
$a = "\c`";
EXPECT
"\c," is more clearly written simply as "l". This will be a fatal error in Perl 5.28 at - line 9.
"\c`" is more clearly written simply as "\ ". This will be a fatal error in Perl 5.28 at - line 10.
"\c," is more clearly written simply as "l" at - line 9.
"\c`" is more clearly written simply as "\ " at - line 10.
########
# toke.c
BEGIN {
Expand Down
16 changes: 8 additions & 8 deletions t/re/reg_mesg.t
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,10 @@ my @warning = (
],
'/a{1,1}?\x{100}/' => 'Useless use of greediness modifier \'?\' {#} m/a{1,1}?{#}\x{100}/',
"/(?[ [ % - % ] ])/" => "",
"/(?[ [ : - \\x$colon_hex ] ])\\x{100}/" => "\": - \\x$colon_hex \" is more clearly written simply as \":\". This will be a fatal error in Perl 5.28 {#} m/(?[ [ : - \\x$colon_hex {#}] ])\\x{100}/",
"/(?[ [ \\x$colon_hex - : ] ])\\x{100}/" => "\"\\x$colon_hex\ - : \" is more clearly written simply as \":\". This will be a fatal error in Perl 5.28 {#} m/(?[ [ \\x$colon_hex - : {#}] ])\\x{100}/",
"/(?[ [ \\t - \\x$tab_hex ] ])\\x{100}/" => "\"\\t - \\x$tab_hex \" is more clearly written simply as \"\\t\". This will be a fatal error in Perl 5.28 {#} m/(?[ [ \\t - \\x$tab_hex {#}] ])\\x{100}/",
"/(?[ [ \\x$tab_hex - \\t ] ])\\x{100}/" => "\"\\x$tab_hex\ - \\t \" is more clearly written simply as \"\\t\". This will be a fatal error in Perl 5.28 {#} m/(?[ [ \\x$tab_hex - \\t {#}] ])\\x{100}/",
"/(?[ [ : - \\x$colon_hex ] ])\\x{100}/" => "\": - \\x$colon_hex \" is more clearly written simply as \":\" {#} m/(?[ [ : - \\x$colon_hex {#}] ])\\x{100}/",
"/(?[ [ \\x$colon_hex - : ] ])\\x{100}/" => "\"\\x$colon_hex\ - : \" is more clearly written simply as \":\" {#} m/(?[ [ \\x$colon_hex - : {#}] ])\\x{100}/",
"/(?[ [ \\t - \\x$tab_hex ] ])\\x{100}/" => "\"\\t - \\x$tab_hex \" is more clearly written simply as \"\\t\" {#} m/(?[ [ \\t - \\x$tab_hex {#}] ])\\x{100}/",
"/(?[ [ \\x$tab_hex - \\t ] ])\\x{100}/" => "\"\\x$tab_hex\ - \\t \" is more clearly written simply as \"\\t\" {#} m/(?[ [ \\x$tab_hex - \\t {#}] ])\\x{100}/",
"/(?[ [ $B_hex - C ] ])/" => "Ranges of ASCII printables should be some subset of \"0-9\", \"A-Z\", or \"a-z\" {#} m/(?[ [ $B_hex - C {#}] ])/",
"/(?[ [ A - $B_hex ] ])/" => "Ranges of ASCII printables should be some subset of \"0-9\", \"A-Z\", or \"a-z\" {#} m/(?[ [ A - $B_hex {#}] ])/",
"/(?[ [ $low_mixed_alpha - $high_mixed_alpha ] ])/" => "Ranges of ASCII printables should be some subset of \"0-9\", \"A-Z\", or \"a-z\" {#} m/(?[ [ $low_mixed_alpha - $high_mixed_alpha {#}] ])/",
Expand Down Expand Up @@ -611,10 +611,10 @@ my @warning_only_under_strict = (
'/[\N{U+FF}-\x{100}]/' => 'Both or neither range ends should be Unicode {#} m/[\N{U+FF}-\x{100}{#}]/',
'/[\N{U+100}-\x{101}]/' => "",
"/[%-%]/" => "",
"/[:-\\x$colon_hex]\\x{100}/" => "\":-\\x$colon_hex\" is more clearly written simply as \":\". This will be a fatal error in Perl 5.28 {#} m/[:-\\x$colon_hex\{#}]\\x{100}/",
"/[\\x$colon_hex-:]\\x{100}/" => "\"\\x$colon_hex-:\" is more clearly written simply as \":\". This will be a fatal error in Perl 5.28 {#} m/[\\x$colon_hex\-:{#}]\\x{100}/",
"/[\\t-\\x$tab_hex]\\x{100}/" => "\"\\t-\\x$tab_hex\" is more clearly written simply as \"\\t\". This will be a fatal error in Perl 5.28 {#} m/[\\t-\\x$tab_hex\{#}]\\x{100}/",
"/[\\x$tab_hex-\\t]\\x{100}/" => "\"\\x$tab_hex-\\t\" is more clearly written simply as \"\\t\". This will be a fatal error in Perl 5.28 {#} m/[\\x$tab_hex\-\\t{#}]\\x{100}/",
"/[:-\\x$colon_hex]\\x{100}/" => "\":-\\x$colon_hex\" is more clearly written simply as \":\" {#} m/[:-\\x$colon_hex\{#}]\\x{100}/",
"/[\\x$colon_hex-:]\\x{100}/" => "\"\\x$colon_hex-:\" is more clearly written simply as \":\" {#} m/[\\x$colon_hex\-:{#}]\\x{100}/",
"/[\\t-\\x$tab_hex]\\x{100}/" => "\"\\t-\\x$tab_hex\" is more clearly written simply as \"\\t\" {#} m/[\\t-\\x$tab_hex\{#}]\\x{100}/",
"/[\\x$tab_hex-\\t]\\x{100}/" => "\"\\x$tab_hex-\\t\" is more clearly written simply as \"\\t\" {#} m/[\\x$tab_hex\-\\t{#}]\\x{100}/",
"/[$B_hex-C]/" => "Ranges of ASCII printables should be some subset of \"0-9\", \"A-Z\", or \"a-z\" {#} m/[$B_hex-C{#}]/",
"/[A-$B_hex]/" => "Ranges of ASCII printables should be some subset of \"0-9\", \"A-Z\", or \"a-z\" {#} m/[A-$B_hex\{#}]/",
"/[$low_mixed_alpha-$high_mixed_alpha]/" => "Ranges of ASCII printables should be some subset of \"0-9\", \"A-Z\", or \"a-z\" {#} m/[$low_mixed_alpha-$high_mixed_alpha\{#}]/",
Expand Down

0 comments on commit d4360ef

Please sign in to comment.