warnings.pm - add deprecated::delimiter_will_be_paired category

Some delimiters are considered deprecated because in the future they
will be used as part of a paired delimiter. This adds a new category
for these cases.
This commit is contained in:
Yves Orton 2023-03-08 09:08:20 +01:00
parent 25676a7479
commit 71e49ade7b
5 changed files with 39 additions and 25 deletions

37
lib/warnings.pm generated
View File

@ -116,14 +116,17 @@ our %Offsets = (
'experimental::for_list' => 144,
'scalar' => 146,
# Warnings Categories added in Perl 5.03501
'deprecated::delimiter_will_be_paired'=> 148,
# Warnings Categories added in Perl 5.037
'experimental::class' => 148,
'experimental::class' => 150,
# Warnings Categories added in Perl 5.037009
'deprecated::apostrophe_as_package_separator'=> 150,
'deprecated::apostrophe_as_package_separator'=> 152,
# Warnings Categories added in Perl 5.03701
'deprecated::smartmatch' => 152,
'deprecated::smartmatch' => 154,
);
our %Bits = (
@ -133,18 +136,19 @@ our %Bits = (
'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1]
'debugging' => "\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22]
'deprecated' => "\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x10\x00\x00\x40\x01", # [2,48,62,75,76]
'deprecated::apostrophe_as_package_separator'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [75]
'deprecated' => "\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x10\x00\x00\x10\x05", # [2,48,62,74,76,77]
'deprecated::apostrophe_as_package_separator'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [76]
'deprecated::delimiter_will_be_paired'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [74]
'deprecated::dot_in_inc' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [62]
'deprecated::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [76]
'deprecated::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [77]
'deprecated::unicode_property_name' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00", # [48]
'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31]
'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x45\x05\x04\x55\x55\x11\x00", # [52,53,55..57,61,64..72,74]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x45\x05\x04\x55\x55\x41\x00", # [52,53,55..57,61,64..72,75]
'experimental::args_array_with_signatures'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00", # [68]
'experimental::builtin' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [69]
'experimental::class' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [74]
'experimental::class' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [75]
'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00", # [55]
'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [61]
'experimental::defer' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [70]
@ -213,18 +217,19 @@ our %DeadBits = (
'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1]
'debugging' => "\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22]
'deprecated' => "\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x20\x00\x00\x80\x02", # [2,48,62,75,76]
'deprecated::apostrophe_as_package_separator'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [75]
'deprecated' => "\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x20\x00\x00\x20\x0a", # [2,48,62,74,76,77]
'deprecated::apostrophe_as_package_separator'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [76]
'deprecated::delimiter_will_be_paired'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [74]
'deprecated::dot_in_inc' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [62]
'deprecated::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [76]
'deprecated::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [77]
'deprecated::unicode_property_name' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00", # [48]
'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31]
'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8a\x0a\x08\xaa\xaa\x22\x00", # [52,53,55..57,61,64..72,74]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8a\x0a\x08\xaa\xaa\x82\x00", # [52,53,55..57,61,64..72,75]
'experimental::args_array_with_signatures'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00", # [68]
'experimental::builtin' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [69]
'experimental::class' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [74]
'experimental::class' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [75]
'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00", # [55]
'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [61]
'experimental::defer' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [70]
@ -299,8 +304,8 @@ our %NoOp = (
# These are used by various things, including our own tests
our $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x15\x14\x55\x55\x51\x01"; # [2,4,22,23,25,48,55..58,61,62,64..72,74..76]
our $LAST_BIT = 154 ;
our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x15\x14\x55\x55\x51\x05"; # [2,4,22,23,25,48,55..58,61,62,64..72,74..77]
our $LAST_BIT = 156 ;
our $BYTES = 20 ;
sub Croaker
@ -905,6 +910,8 @@ The current hierarchy is:
| |
| +- deprecated::apostrophe_as_package_separator
| |
| +- deprecated::delimiter_will_be_paired
| |
| +- deprecated::dot_in_inc
| |
| +- deprecated::smartmatch

View File

@ -7618,12 +7618,13 @@ only C. This usually means there's a better way to do it in Perl.
=item Use of '%s' is deprecated as a string delimiter
(D deprecated) You used the given character as a starting delimiter of a
string outside the scope of S<C<use feature 'extra_paired_delimiters'>>.
This character is the mirror image of another Unicode character; within
the scope of that feature, the two are considered a pair for delimitting
strings. It is planned to make that feature the default, at which point
this usage would become illegal; hence this warning.
(D deprecated::delimiter_will_be_paired) You used the given character as
a starting delimiter of a string outside the scope of
S<C<use feature 'extra_paired_delimiters'>>. This character is the
mirror image of another Unicode character; within the scope of that
feature, the two are considered a pair for delimitting strings. It is
planned to make that feature the default, at which point this usage
would become illegal; hence this warning.
For now, you may live with this warning, or turn it off, but this code
will no longer compile in a future version of Perl. Or you can turn on

View File

@ -79,6 +79,7 @@ my $TREE = {
'deprecated::dot_in_inc' => [ 5.025011, DEFAULT_ON],
'deprecated::unicode_property_name' => [ 5.011003, DEFAULT_ON],
'deprecated::apostrophe_as_package_separator' => [ 5.037009, DEFAULT_ON],
'deprecated::delimiter_will_be_paired' => [ 5.035010, DEFAULT_ON],
}],
'void' => [ 5.008, DEFAULT_OFF],
'recursion' => [ 5.008, DEFAULT_OFF],

2
toke.c
View File

@ -11653,7 +11653,7 @@ Perl_scan_str(pTHX_ char *start, int keep_bracketed_quoted, int keep_delims, int
if (ninstr(deprecated_opening_delims, deprecated_delims_end,
open_delim_str, open_delim_str + delim_byte_len))
{
Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED__DELIMITER_WILL_BE_PAIRED),
"Use of '%" UTF8f "' is deprecated as a string delimiter",
UTF8fARG(UTF, delim_byte_len, open_delim_str));
}

11
warnings.h generated
View File

@ -139,17 +139,21 @@
#define WARN_EXPERIMENTAL__FOR_LIST 72
#define WARN_SCALAR 73
/* Warnings Categories added in Perl 5.03501 */
#define WARN_DEPRECATED__DELIMITER_WILL_BE_PAIRED 74
/* Warnings Categories added in Perl 5.037 */
#define WARN_EXPERIMENTAL__CLASS 74
#define WARN_EXPERIMENTAL__CLASS 75
/* Warnings Categories added in Perl 5.037009 */
#define WARN_DEPRECATED__APOSTROPHE_AS_PACKAGE_SEPARATOR 75
#define WARN_DEPRECATED__APOSTROPHE_AS_PACKAGE_SEPARATOR 76
/* Warnings Categories added in Perl 5.03701 */
#define WARN_DEPRECATED__SMARTMATCH 76
#define WARN_DEPRECATED__SMARTMATCH 77
#define WARNsize 20
#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125"
#define WARN_NONEstring "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@ -338,6 +342,7 @@ category parameters passed.
=for apidoc Amnh||WARN_EXPERIMENTAL__EXTRA_PAIRED_DELIMITERS
=for apidoc Amnh||WARN_EXPERIMENTAL__FOR_LIST
=for apidoc Amnh||WARN_SCALAR
=for apidoc Amnh||WARN_DEPRECATED__DELIMITER_WILL_BE_PAIRED
=for apidoc Amnh||WARN_EXPERIMENTAL__CLASS
=for apidoc Amnh||WARN_DEPRECATED__APOSTROPHE_AS_PACKAGE_SEPARATOR
=for apidoc Amnh||WARN_DEPRECATED__SMARTMATCH