diff options
author | Karl Williamson <public@khwilliamson.com> | 2014-02-05 22:06:02 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2014-02-05 22:17:56 -0700 |
commit | 32d028130217347dcbe6859b420b505b89a30d9d (patch) | |
tree | 0e3af9e55a6d64bb1bff2b68416294160245f115 | |
parent | 9b8f4e9212208b42402a7e6c029025cc8a6ae4db (diff) | |
download | perl-32d028130217347dcbe6859b420b505b89a30d9d.tar.gz |
Make a literal "{" fatal after \b and \B in regexes
These have been deprecated since v5.14.
-rw-r--r-- | dquote_static.c | 2 | ||||
-rw-r--r-- | pod/perldiag.pod | 8 | ||||
-rw-r--r-- | regcomp.c | 6 | ||||
-rw-r--r-- | t/re/reg_mesg.t | 4 |
4 files changed, 11 insertions, 9 deletions
diff --git a/dquote_static.c b/dquote_static.c index 4eaa4b1089..bb1bd4a565 100644 --- a/dquote_static.c +++ b/dquote_static.c @@ -63,6 +63,8 @@ S_grok_bslash_c(pTHX_ const char source, const bool output_warning) } else if (source == '{') { assert(isPRINT_A(toCTRL('{'))); + + /* diag_listed_as: Use "%s" instead of "%s" */ Perl_croak(aTHX_ "Use \"%c\" instead of \"\\c{\"", toCTRL('{')); } diff --git a/pod/perldiag.pod b/pod/perldiag.pod index d913fa6d73..29f1703328 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -6162,12 +6162,10 @@ you can write it as C<push(@tied_array,())> to avoid this warning. (F) The "use" keyword is recognized and executed at compile time, and returns no useful value. See L<perlmod>. -=item Use "%c" instead of "\c{" +=item Use "%s" instead of "%s" -(F) The C<\cI<X>> construct is intended to be a way to specify -non-printable characters. You used it with a C<"{"> which evaluates to -C<";">, which is printable. On ASCII platforms, just use a semi-colon -or a backslash-semi-colon without the C<"\c">. +(F) The second listed construct is no longer legal. Use the first one +instead. =item Use of assignment to $[ is deprecated @@ -11277,7 +11277,8 @@ tryagain: FLAGS(ret) = get_regex_charset(RExC_flags); *flagp |= SIMPLE; if (! SIZE_ONLY && (U8) *(RExC_parse + 1) == '{') { - ckWARNdep(RExC_parse, "\"\\b{\" is deprecated; use \"\\b\\{\" or \"\\b[{]\" instead"); + /* diag_listed_as: Use "%s" instead of "%s" */ + vFAIL("Use \"\\b\\{\" instead of \"\\b{\""); } goto finish_meta_pat; case 'B': @@ -11291,7 +11292,8 @@ tryagain: FLAGS(ret) = get_regex_charset(RExC_flags); *flagp |= SIMPLE; if (! SIZE_ONLY && (U8) *(RExC_parse + 1) == '{') { - ckWARNdep(RExC_parse, "\"\\B{\" is deprecated; use \"\\B\\{\" or \"\\B[{]\" instead"); + /* diag_listed_as: Use "%s" instead of "%s" */ + vFAIL("Use \"\\B\\{\" instead of \"\\B{\""); } goto finish_meta_pat; diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t index bf4735f559..55eda189da 100644 --- a/t/re/reg_mesg.t +++ b/t/re/reg_mesg.t @@ -119,6 +119,8 @@ my @death = '/(?lil:foo)/' => 'Regexp modifier "l" may not appear twice {#} m/(?lil{#}:foo)/', '/(?aaia:foo)/' => 'Regexp modifier "a" may appear a maximum of twice {#} m/(?aaia{#}:foo)/', '/(?i-l:foo)/' => 'Regexp modifier "l" may not appear after the "-" {#} m/(?i-l{#}:foo)/', +'/a\b{cde/' => 'Use "\b\{" instead of "\b{" {#} m/a\{#}b{cde/', +'/a\B{cde/' => 'Use "\B\{" instead of "\B{" {#} m/a\{#}B{cde/', '/((x)/' => 'Unmatched ( {#} m/({#}(x)/', @@ -412,8 +414,6 @@ my @experimental_regex_sets = ( ); my @deprecated = ( - '/a\b{cde/' => '"\b{" is deprecated; use "\b\{" or "\b[{]" instead {#} m/a\{#}b{cde/', - '/a\B{cde/' => '"\B{" is deprecated; use "\B\{" or "\B[{]" instead {#} m/a\{#}B{cde/', "/(?x)latin1\\\x{85}\x{85}\\\x{85}/" => 'Escape literal pattern white space under /x {#} ' . "m/(?x)latin1\\\x{85}\x{85}{#}\\\x{85}/", 'use utf8; /(?x)utf8\
\
/' => 'Escape literal pattern white space under /x {#} ' . "m/(?x)utf8\\\N{NEXT LINE}\N{NEXT LINE}{#}\\\N{NEXT LINE}/", '/((?# This is a comment in the middle of a token)?:foo)/' => 'In \'(?...)\', splitting the initial \'(?\' is deprecated {#} m/((?# This is a comment in the middle of a token)?{#}:foo)/', |