From 69cef1d6dac1338ad7523885858977af2f0c0a13 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Mon, 24 Oct 2022 00:05:16 +0200 Subject: [PATCH 1/5] Deprecate smartmatch Make the 'experimental::smartmatch' warning obsolete, and use 'deprecated' instead. --- lib/warnings.pm | 138 ++++++++++++++++++++++------------------------ regen/warnings.pl | 3 +- toke.c | 12 ++-- warnings.h | 42 +++++++------- 4 files changed, 95 insertions(+), 100 deletions(-) diff --git a/lib/warnings.pm b/lib/warnings.pm index b0dc1037ed4c..286e685c2d97 100644 --- a/lib/warnings.pm +++ b/lib/warnings.pm @@ -76,43 +76,42 @@ our %Offsets = ( # Warnings Categories added in Perl 5.017 'experimental' => 102, 'experimental::regex_sets' => 104, - 'experimental::smartmatch' => 106, # Warnings Categories added in Perl 5.019 - 'syscalls' => 108, + 'syscalls' => 106, # Warnings Categories added in Perl 5.021 - 'experimental::const_attr' => 110, - 'experimental::re_strict' => 112, - 'experimental::refaliasing' => 114, - 'locale' => 116, - 'missing' => 118, - 'redundant' => 120, + 'experimental::const_attr' => 108, + 'experimental::re_strict' => 110, + 'experimental::refaliasing' => 112, + 'locale' => 114, + 'missing' => 116, + 'redundant' => 118, # Warnings Categories added in Perl 5.025 - 'experimental::declared_refs' => 122, + 'experimental::declared_refs' => 120, # Warnings Categories added in Perl 5.027 - 'shadow' => 124, + 'shadow' => 122, # Warnings Categories added in Perl 5.029 - 'experimental::private_use' => 126, - 'experimental::uniprop_wildcards' => 128, - 'experimental::vlb' => 130, + 'experimental::private_use' => 124, + 'experimental::uniprop_wildcards' => 126, + 'experimental::vlb' => 128, # Warnings Categories added in Perl 5.033 - 'experimental::try' => 132, + 'experimental::try' => 130, # Warnings Categories added in Perl 5.035 - 'experimental::args_array_with_signatures'=> 134, - 'experimental::builtin' => 136, - 'experimental::defer' => 138, - 'experimental::extra_paired_delimiters'=> 140, - 'experimental::for_list' => 142, - 'scalar' => 144, + 'experimental::args_array_with_signatures'=> 132, + 'experimental::builtin' => 134, + 'experimental::defer' => 136, + 'experimental::extra_paired_delimiters'=> 138, + 'experimental::for_list' => 140, + 'scalar' => 142, # Warnings Categories added in Perl 5.037 - 'experimental::class' => 146, + 'experimental::class' => 144, ); our %Bits = ( @@ -126,34 +125,33 @@ our %Bits = ( 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\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", # [7] 'exiting' => "\x40\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\x40\x45\x05\x44\x55\x55\x04", # [51..53,55..57,61,63..71,73] - 'experimental::args_array_with_signatures'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [67] - 'experimental::builtin' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [68] - 'experimental::class' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [73] - 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\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", # [61] - 'experimental::defer' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [69] - 'experimental::extra_paired_delimiters'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [70] - 'experimental::for_list' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [71] - 'experimental::private_use' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [63] - 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [56] - 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [57] + 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x51\x01\x51\x55\x15\x01", # [51,52,54..56,60,62..70,72] + 'experimental::args_array_with_signatures'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [66] + 'experimental::builtin' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [67] + 'experimental::class' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [72] + 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [54] + 'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [60] + 'experimental::defer' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [68] + 'experimental::extra_paired_delimiters'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [69] + 'experimental::for_list' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [70] + 'experimental::private_use' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [62] + 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00", # [55] + 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [56] 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00", # [52] - 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [53] - 'experimental::try' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [66] - 'experimental::uniprop_wildcards' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00", # [64] - 'experimental::vlb' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [65] + 'experimental::try' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [65] + 'experimental::uniprop_wildcards' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [63] + 'experimental::vlb' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00", # [64] 'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [47] 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [46] 'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23] 'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24] - 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [5..11,54] + 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [5..11,53] 'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] - 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [58] + 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [57] 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] 'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] - 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00", # [59] + 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [58] 'newline' => "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00", # [48] 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [49] @@ -170,18 +168,18 @@ our %Bits = ( 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [36] 'recursion' => "\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] 'redefine' => "\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] - 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [60] + 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00", # [59] 'regexp' => "\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20] 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [37] - 'scalar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [72] + 'scalar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [71] 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [38] 'severe' => "\x00\x00\x00\x00\x00\x54\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25] - 'shadow' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [62] + 'shadow' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [61] 'signal' => "\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26] 'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27] 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00", # [50] 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [28..38,47] - 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [54] + 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [53] 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [39] 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [40] 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [41] @@ -203,34 +201,33 @@ our %DeadBits = ( 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\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", # [7] 'exiting' => "\x80\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\x80\x8a\x0a\x88\xaa\xaa\x08", # [51..53,55..57,61,63..71,73] - 'experimental::args_array_with_signatures'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [67] - 'experimental::builtin' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [68] - 'experimental::class' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [73] - 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\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", # [61] - 'experimental::defer' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [69] - 'experimental::extra_paired_delimiters'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [70] - 'experimental::for_list' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [71] - 'experimental::private_use' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [63] - 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [56] - 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [57] + 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xa2\x02\xa2\xaa\x2a\x02", # [51,52,54..56,60,62..70,72] + 'experimental::args_array_with_signatures'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [66] + 'experimental::builtin' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [67] + 'experimental::class' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [72] + 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [54] + 'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [60] + 'experimental::defer' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [68] + 'experimental::extra_paired_delimiters'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [69] + 'experimental::for_list' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [70] + 'experimental::private_use' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [62] + 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00", # [55] + 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [56] 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00", # [52] - 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [53] - 'experimental::try' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [66] - 'experimental::uniprop_wildcards' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00", # [64] - 'experimental::vlb' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [65] + 'experimental::try' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [65] + 'experimental::uniprop_wildcards' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [63] + 'experimental::vlb' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00", # [64] 'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [47] 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [46] 'inplace' => "\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23] 'internal' => "\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24] - 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [5..11,54] + 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [5..11,53] 'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] - 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [58] + 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [57] 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] 'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] - 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00", # [59] + 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [58] 'newline' => "\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00", # [48] 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00", # [49] @@ -247,18 +244,18 @@ our %DeadBits = ( 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [36] 'recursion' => "\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] 'redefine' => "\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] - 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [60] + 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00", # [59] 'regexp' => "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20] 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [37] - 'scalar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [72] + 'scalar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [71] 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [38] 'severe' => "\x00\x00\x00\x00\x00\xa8\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25] - 'shadow' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [62] + 'shadow' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [61] 'signal' => "\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26] 'substr' => "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27] 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00", # [50] 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [28..38,47] - 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [54] + 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [53] 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [39] 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [40] 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00", # [41] @@ -277,12 +274,13 @@ our %NoOp = ( 'experimental::postderef' => 1, 'experimental::script_run' => 1, 'experimental::signatures' => 1, + 'experimental::smartmatch' => 1, ); # 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"; -our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x44\x15\x44\x55\x55\x04"; # [2,4,22,23,25,53,55..58,61,63..71,73] -our $LAST_BIT = 148 ; +our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x50\x05\x51\x55\x15\x01"; # [2,4,22,23,25,54..57,60,62..70,72] +our $LAST_BIT = 146 ; our $BYTES = 19 ; sub Croaker @@ -913,8 +911,6 @@ The current hierarchy is: | | | +- experimental::regex_sets | | - | +- experimental::smartmatch - | | | +- experimental::try | | | +- experimental::uniprop_wildcards diff --git a/regen/warnings.pl b/regen/warnings.pl index 98e6b6cab999..6a868caf6cef 100644 --- a/regen/warnings.pl +++ b/regen/warnings.pl @@ -171,7 +171,7 @@ BEGIN my %NAME_TO_VALUE; # ('NAME' => index_number, ....); -# the experiments were successful, +# the experiments were successful (or abandonned), # so no warning bit is needed anymore my %NO_BIT_FOR = map { ( uc $_ => 1, $_ => 1 ) } qw( experimental::lexical_subs @@ -181,6 +181,7 @@ BEGIN experimental::alpha_assertions experimental::script_run experimental::isa + experimental::smartmatch ); ########################################################################### diff --git a/toke.c b/toke.c index a4454fe010c8..a992507f10a2 100644 --- a/toke.c +++ b/toke.c @@ -6637,8 +6637,8 @@ yyl_tilde(pTHX_ char *s) TOKEN(0); s += 2; Perl_ck_warner_d(aTHX_ - packWARN(WARN_EXPERIMENTAL__SMARTMATCH), - "Smartmatch is experimental"); + packWARN(WARN_DEPRECATED), + "Smartmatch is deprecated"); NCEop(OP_SMARTMATCH); } s++; @@ -8178,8 +8178,8 @@ yyl_word_or_keyword(pTHX_ char *s, STRLEN len, I32 key, I32 orig_keyword, struct case KEY_given: pl_yylval.ival = CopLINE(PL_curcop); - Perl_ck_warner_d(aTHX_ packWARN(WARN_EXPERIMENTAL__SMARTMATCH), - "given is experimental"); + Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), + "given is deprecated"); OPERATOR(KW_GIVEN); case KEY_glob: @@ -8701,8 +8701,8 @@ yyl_word_or_keyword(pTHX_ char *s, STRLEN len, I32 key, I32 orig_keyword, struct return REPORT(0); pl_yylval.ival = CopLINE(PL_curcop); Perl_ck_warner_d(aTHX_ - packWARN(WARN_EXPERIMENTAL__SMARTMATCH), - "when is experimental"); + packWARN(WARN_DEPRECATED), + "when is deprecated"); OPERATOR(KW_WHEN); case KEY_while: diff --git a/warnings.h b/warnings.h index 718112a65e69..613c8fb33f78 100644 --- a/warnings.h +++ b/warnings.h @@ -90,51 +90,50 @@ #define WARN_EXPERIMENTAL 51 #define WARN_EXPERIMENTAL__REGEX_SETS 52 -#define WARN_EXPERIMENTAL__SMARTMATCH 53 /* Warnings Categories added in Perl 5.019 */ -#define WARN_SYSCALLS 54 +#define WARN_SYSCALLS 53 /* Warnings Categories added in Perl 5.021 */ -#define WARN_EXPERIMENTAL__CONST_ATTR 55 -#define WARN_EXPERIMENTAL__RE_STRICT 56 -#define WARN_EXPERIMENTAL__REFALIASING 57 -#define WARN_LOCALE 58 -#define WARN_MISSING 59 -#define WARN_REDUNDANT 60 +#define WARN_EXPERIMENTAL__CONST_ATTR 54 +#define WARN_EXPERIMENTAL__RE_STRICT 55 +#define WARN_EXPERIMENTAL__REFALIASING 56 +#define WARN_LOCALE 57 +#define WARN_MISSING 58 +#define WARN_REDUNDANT 59 /* Warnings Categories added in Perl 5.025 */ -#define WARN_EXPERIMENTAL__DECLARED_REFS 61 +#define WARN_EXPERIMENTAL__DECLARED_REFS 60 /* Warnings Categories added in Perl 5.027 */ -#define WARN_SHADOW 62 +#define WARN_SHADOW 61 /* Warnings Categories added in Perl 5.029 */ -#define WARN_EXPERIMENTAL__PRIVATE_USE 63 -#define WARN_EXPERIMENTAL__UNIPROP_WILDCARDS 64 -#define WARN_EXPERIMENTAL__VLB 65 +#define WARN_EXPERIMENTAL__PRIVATE_USE 62 +#define WARN_EXPERIMENTAL__UNIPROP_WILDCARDS 63 +#define WARN_EXPERIMENTAL__VLB 64 /* Warnings Categories added in Perl 5.033 */ -#define WARN_EXPERIMENTAL__TRY 66 +#define WARN_EXPERIMENTAL__TRY 65 /* Warnings Categories added in Perl 5.035 */ -#define WARN_EXPERIMENTAL__ARGS_ARRAY_WITH_SIGNATURES 67 -#define WARN_EXPERIMENTAL__BUILTIN 68 -#define WARN_EXPERIMENTAL__DEFER 69 -#define WARN_EXPERIMENTAL__EXTRA_PAIRED_DELIMITERS 70 -#define WARN_EXPERIMENTAL__FOR_LIST 71 -#define WARN_SCALAR 72 +#define WARN_EXPERIMENTAL__ARGS_ARRAY_WITH_SIGNATURES 66 +#define WARN_EXPERIMENTAL__BUILTIN 67 +#define WARN_EXPERIMENTAL__DEFER 68 +#define WARN_EXPERIMENTAL__EXTRA_PAIRED_DELIMITERS 69 +#define WARN_EXPERIMENTAL__FOR_LIST 70 +#define WARN_SCALAR 71 /* Warnings Categories added in Perl 5.037 */ -#define WARN_EXPERIMENTAL__CLASS 73 +#define WARN_EXPERIMENTAL__CLASS 72 #define WARNsize 19 #define WARN_ALLstring "\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" @@ -302,7 +301,6 @@ category parameters passed. =for apidoc Amnh||WARN_SURROGATE =for apidoc Amnh||WARN_EXPERIMENTAL =for apidoc Amnh||WARN_EXPERIMENTAL__REGEX_SETS -=for apidoc Amnh||WARN_EXPERIMENTAL__SMARTMATCH =for apidoc Amnh||WARN_SYSCALLS =for apidoc Amnh||WARN_EXPERIMENTAL__CONST_ATTR =for apidoc Amnh||WARN_EXPERIMENTAL__RE_STRICT From f3e4086f1f9bdf5f05ccdb72a4a677f364cebdaf Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Mon, 24 Oct 2022 01:22:59 +0200 Subject: [PATCH 2/5] Replace 'experimental::smartmatch' by 'deprecated' in tests --- dist/Safe/t/safeops.t | 2 +- lib/B/Deparse.t | 10 +++++----- lib/overload.t | 8 ++++---- t/lib/croak/pp_ctl | 2 +- t/lib/feature/switch | 30 +++++++++++++++--------------- t/lib/warnings/9uninit | 2 +- t/lib/warnings/op | 2 +- t/op/cmpchain.t | 4 +++- t/op/coreamp.t | 4 ++-- t/op/smartmatch.t | 8 ++++---- t/op/state.t | 2 +- t/op/switch.t | 2 +- t/op/taint.t | 3 ++- t/op/tie_fetch_count.t | 2 +- 14 files changed, 42 insertions(+), 39 deletions(-) diff --git a/dist/Safe/t/safeops.t b/dist/Safe/t/safeops.t index ea159316009c..57c46b62c3ee 100644 --- a/dist/Safe/t/safeops.t +++ b/dist/Safe/t/safeops.t @@ -453,7 +453,7 @@ dor $x // $y dorassign $x //= $y once SKIP {use feature 'state'; state $foo = 42;} say SKIP {use feature 'say'; say "foo";} -smartmatch no warnings 'experimental::smartmatch'; $x ~~ $y +smartmatch no warnings 'deprecated'; $x ~~ $y aeach SKIP each @t akeys SKIP keys @t avalues SKIP values @t diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index c7a3307a9ab8..ae1372f63050 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -1061,7 +1061,7 @@ my $c = []; my $d = \[]; #### # SKIP ?$] < 5.010 && "smartmatch and given/when not implemented on this Perl version" -# CONTEXT use feature ':5.10'; no warnings 'experimental::smartmatch'; +# CONTEXT use feature ':5.10'; no warnings 'deprecated'; # implicit smartmatch in given/when given ('foo') { when ('bar') { continue; } @@ -1624,7 +1624,7 @@ my @a; $a[0] = 1; #### # feature features without feature -# CONTEXT no warnings 'experimental::smartmatch'; +# CONTEXT no warnings 'deprecated'; CORE::state $x; CORE::say $x; CORE::given ($x) { @@ -1640,7 +1640,7 @@ CORE::evalbytes ''; () = CORE::fc $x; #### # feature features when feature has been disabled by use VERSION -# CONTEXT no warnings 'experimental::smartmatch'; +# CONTEXT no warnings 'deprecated'; use feature (sprintf(":%vd", $^V)); use 1; CORE::say $_; @@ -1670,7 +1670,7 @@ CORE::evalbytes ''; () = CORE::__SUB__; #### # (the above test with CONTEXT, and the output is equivalent but different) -# CONTEXT use feature ':5.10'; no warnings 'experimental::smartmatch'; +# CONTEXT use feature ':5.10'; no warnings 'deprecated'; # feature features when feature has been disabled by use VERSION use feature (sprintf(":%vd", $^V)); use 1; @@ -1704,7 +1704,7 @@ CORE::evalbytes ''; #### # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version" # lexical subroutines and keywords of the same name -# CONTEXT use feature 'lexical_subs', 'switch'; no warnings 'experimental'; +# CONTEXT use feature 'lexical_subs', 'switch'; no warnings 'experimental'; no warnings 'deprecated'; my sub default; my sub else; my sub elsif; diff --git a/lib/overload.t b/lib/overload.t index c97b87cc37d6..9035d99cb03d 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -1910,7 +1910,7 @@ foreach my $op (qw(<=> == != < <= > >=)) { for my $sub (keys %subs) { - no warnings 'experimental::smartmatch'; + no warnings 'deprecated'; my $term = $subs{$sub}; my $t = sprintf $term, '$_[0][0]'; my $e ="sub { \$funcs .= '($sub)'; my \$r; if (\$use_int) {" @@ -1952,7 +1952,7 @@ foreach my $op (qw(<=> == != < <= > >=)) { ? "-\$_[0][0]" : "$_[3](\$_[0][0])"; my $r; - no warnings 'experimental::smartmatch'; + no warnings 'deprecated'; if ($use_int) { use integer; $r = eval $e; } @@ -1999,7 +1999,7 @@ foreach my $op (qw(<=> == != < <= > >=)) { $use_int = ($int ne ''); my $plain = $tainted_val; my $plain_term = $int . sprintf $sub_term, '$plain'; - my $exp = do {no warnings 'experimental::smartmatch'; eval $plain_term }; + my $exp = do {no warnings 'deprecated'; eval $plain_term }; diag("eval of plain_term <$plain_term> gave <$@>") if $@; SKIP: { is_if_taint_supported(tainted($exp), $exp_taint, @@ -2029,7 +2029,7 @@ foreach my $op (qw(<=> == != < <= > >=)) { my $res_term = $int . sprintf $sub_term, $var; my $desc = "<$res_term> $ov_pkg" ; - my $res = do { no warnings 'experimental::smartmatch'; eval $res_term }; + my $res = do { no warnings 'deprecated'; eval $res_term }; diag("eval of res_term $desc gave <$@>") if $@; # uniquely, the inc/dec ops return the original # ref rather than a copy, so stringify it to diff --git a/t/lib/croak/pp_ctl b/t/lib/croak/pp_ctl index de0221b57d32..a63cbd78491e 100644 --- a/t/lib/croak/pp_ctl +++ b/t/lib/croak/pp_ctl @@ -41,7 +41,7 @@ EXPECT Can't find label foo at - line 3. ######## # NAME when outside given -use 5.01; no warnings 'experimental::smartmatch'; +use 5.01; no warnings 'deprecated'; when(undef){} EXPECT Can't "when" outside a topicalizer at - line 2. diff --git a/t/lib/feature/switch b/t/lib/feature/switch index 0dee7f51cf91..4d379ea21322 100644 --- a/t/lib/feature/switch +++ b/t/lib/feature/switch @@ -3,28 +3,28 @@ Check the lexical scoping of the switch keywords. __END__ # No switch; given should be a bareword. -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; print STDOUT given; EXPECT Unquoted string "given" may clash with future reserved word at - line 3. given ######## # No switch; when should be a bareword. -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; print STDOUT when; EXPECT Unquoted string "when" may clash with future reserved word at - line 3. when ######## # No switch; default should be a bareword. -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; print STDOUT default; EXPECT Unquoted string "default" may clash with future reserved word at - line 3. default ######## # No switch; break should be a bareword. -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; print STDOUT break; EXPECT Unquoted string "break" may clash with future reserved word at - line 3. @@ -36,19 +36,19 @@ EXPECT Can't "continue" outside a when block at - line 2. ######## # Use switch; so given is a keyword -use feature 'switch'; no warnings 'experimental::smartmatch'; +use feature 'switch'; no warnings 'deprecated'; given("okay\n") { print } EXPECT okay ######## # Use switch; so when is a keyword -use feature 'switch'; no warnings 'experimental::smartmatch'; +use feature 'switch'; no warnings 'deprecated'; given(1) { when(1) { print "okay" } } EXPECT okay ######## # Use switch; so default is a keyword -use feature 'switch'; no warnings 'experimental::smartmatch'; +use feature 'switch'; no warnings 'deprecated'; given(1) { default { print "okay" } } EXPECT okay @@ -60,7 +60,7 @@ EXPECT Can't "break" outside a given block at - line 3. ######## # switch out of scope; given should be a bareword. -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; { use feature 'switch'; given (1) {print "Okay here\n";} } @@ -71,7 +71,7 @@ Okay here given ######## # switch out of scope; when should be a bareword. -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; { use feature 'switch'; given (1) { when(1) {print "Okay here\n";} } } @@ -82,7 +82,7 @@ Okay here when ######## # switch out of scope; default should be a bareword. -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; { use feature 'switch'; given (1) { default {print "Okay here\n";} } } @@ -93,7 +93,7 @@ Okay here default ######## # switch out of scope; break should be a bareword. -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; { use feature 'switch'; given (1) { break } } @@ -103,7 +103,7 @@ Unquoted string "break" may clash with future reserved word at - line 6. break ######## # C should work -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; use feature 'switch'; given (1) { when(1) {print "Okay here\n";} } no feature 'switch'; @@ -114,7 +114,7 @@ Okay here when ######## # C should work too -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; use feature 'switch'; given (1) { when(1) {print "Okay here\n";} } no feature; @@ -125,14 +125,14 @@ Okay here when ######## # Without the feature, no 'Unambiguous use of' warning: -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; @break = ($break = "break"); print ${break}, ${break[0]}; EXPECT breakbreak ######## # With the feature, we get an 'Unambiguous use of' warning: -use warnings; no warnings 'experimental::smartmatch'; +use warnings; no warnings 'deprecated'; use feature 'switch'; @break = ($break = "break"); print ${break}, ${break[0]}; diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index 5c173fdb2ac8..0ceb0d240aa8 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -1943,7 +1943,7 @@ $v = 1 + prototype $fn; EXPECT Use of uninitialized value in addition (+) at - line 4. ######## -use warnings 'uninitialized'; no warnings 'experimental::smartmatch'; +use warnings 'uninitialized'; no warnings 'deprecated'; my $v; my $fn = sub {}; $v = 1 + (1 ~~ $fn); diff --git a/t/lib/warnings/op b/t/lib/warnings/op index 4ef9d565f198..d9de0a441f4c 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -363,7 +363,7 @@ OPTION fatal Can't use an array as a reference at - line 3. ######## # op.c -use warnings 'void' ; no warnings 'experimental::smartmatch'; close STDIN ; +use warnings 'void' ; no warnings 'deprecated'; close STDIN ; #line 2 1 x 3 ; # OP_REPEAT (folded) (1) x 3 ; # OP_REPEAT diff --git a/t/op/cmpchain.t b/t/op/cmpchain.t index 48aaabf1e5b7..13672b836c09 100644 --- a/t/op/cmpchain.t +++ b/t/op/cmpchain.t @@ -7,7 +7,6 @@ BEGIN { } use feature "isa"; -no warnings qw(experimental::smartmatch); my @cheqop = qw(== != eq ne); my @nceqop = qw(<=> cmp ~~); @@ -15,18 +14,21 @@ my @chrelop = qw(< > <= >= lt gt le ge); my @ncrelop = qw(isa); foreach my $c0 (@nceqop) { + no warnings qw(deprecated); foreach my $c1 (@nceqop) { is eval("sub { \$a $c0 \$b $c1 \$c }"), undef, "$c0 $c1 non-associative"; } } foreach my $c (@nceqop) { + no warnings qw(deprecated); foreach my $e (@cheqop) { is eval("sub { \$a $c \$b $e \$c }"), undef, "$c $e non-associative"; is eval("sub { \$a $e \$b $c \$c }"), undef, "$e $c non-associative"; } } foreach my $c (@nceqop) { + no warnings qw(deprecated); foreach my $e0 (@cheqop) { foreach my $e1 (@cheqop) { is eval("sub { \$a $c \$b $e0 \$c $e1 \$d }"), undef, diff --git a/t/op/coreamp.t b/t/op/coreamp.t index ca39c2c555a4..588b4ed50552 100644 --- a/t/op/coreamp.t +++ b/t/op/coreamp.t @@ -15,8 +15,6 @@ BEGIN { $^P |= 0x100; # Provide informative "file" names for evals } -no warnings 'experimental::smartmatch'; - sub lis($$;$) { &is(map(@$_ ? "[@{[map $_//'~~u~~', @$_]}]" : 'nought', @_[0,1]), $_[2]); } @@ -375,6 +373,7 @@ test_proto 'break'; { $tests ++; my $tmp; + no warnings 'deprecated'; CORE::given(1) { CORE::when(1) { &mybreak; @@ -463,6 +462,7 @@ SKIP: test_proto 'continue'; $tests ++; +no warnings 'deprecated'; CORE::given(1) { CORE::when(1) { &mycontinue(); diff --git a/t/op/smartmatch.t b/t/op/smartmatch.t index 10d35390d79e..ca85d15785c2 100644 --- a/t/op/smartmatch.t +++ b/t/op/smartmatch.t @@ -8,7 +8,7 @@ BEGIN { use strict; use warnings; no warnings 'uninitialized'; -no warnings 'experimental::smartmatch'; +no warnings 'deprecated'; # smartmatch is deprecated and will be removed in 5.042 ++$|; @@ -146,7 +146,7 @@ sub NOT_DEF() { undef } # re-introduced it will probably crash in one of the many smoke # builds. fresh_perl_is('print (q(x) ~~ q(x)) | (/x/ ~~ %!)', "1", - { switches => [ "-MErrno", "-M-warnings=experimental::smartmatch" ] }, + { switches => [ "-MErrno", "-M-warnings=deprecated" ] }, "don't fill the stack with rubbish"); } @@ -194,10 +194,10 @@ sub NOT_DEF() { undef } # if there was some other operator's arguments left on the stack, as with # the test cases. fresh_perl_is('print(0->[0 =~ qr/1/ ~~ 0])', '', - { switches => [ "-M-warnings=experimental::smartmatch" ] }, + { switches => [ "-M-warnings=deprecated" ] }, "don't qr-ify left-side match against a stacked argument"); fresh_perl_is('print(0->[0 ~~ (0 =~ qr/1/)])', '', - { switches => [ "-M-warnings=experimental::smartmatch" ] }, + { switches => [ "-M-warnings=deprecated" ] }, "don't qr-ify right-side match against a stacked argument"); } diff --git a/t/op/state.t b/t/op/state.t index 7aef435ffdc4..747e316f226a 100644 --- a/t/op/state.t +++ b/t/op/state.t @@ -346,7 +346,7 @@ foreach my $x (0 .. 4) { # my @spam = qw [spam ham bacon beans]; foreach my $spam (@spam) { - no warnings 'experimental::smartmatch'; + no warnings 'deprecated'; given (state $spam = $spam) { when ($spam [0]) {ok 1, "given"} default {ok 0, "given"} diff --git a/t/op/switch.t b/t/op/switch.t index dbfd906e2a2d..e1c079956f0d 100644 --- a/t/op/switch.t +++ b/t/op/switch.t @@ -8,7 +8,7 @@ BEGIN { use strict; use warnings; -no warnings 'experimental::smartmatch'; +no warnings 'deprecated'; plan tests => 197; diff --git a/t/op/taint.t b/t/op/taint.t index b4b590ef5d3d..daeb164efafe 100644 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -2453,6 +2453,7 @@ EOF my $desc = "tainted value returned from " . shift(@descriptions); my $res = do { + no warnings 'deprecated'; given ($_) { when ('x') { $letter } when ('y') { goto leavegiven } @@ -2482,7 +2483,7 @@ EOF # Tainted values with smartmatch # [perl #93590] S_do_smartmatch stealing its own string buffers { -no warnings 'experimental::smartmatch'; +no warnings 'deprecated'; ok "M$TAINT" ~~ ['m', 'M'], '$tainted ~~ ["whatever", "match"]'; ok !("M$TAINT" ~~ ['m', undef]), '$tainted ~~ ["whatever", undef]'; } diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t index d8b906d7ab45..86505f6eba85 100644 --- a/t/op/tie_fetch_count.t +++ b/t/op/tie_fetch_count.t @@ -165,7 +165,7 @@ $_ = "foo"; $dummy = $var =~ m/ / ; check_count 'm//'; $dummy = $var =~ s/ //; check_count 's///'; { - no warnings 'experimental::smartmatch'; + no warnings 'deprecated'; $dummy = $var ~~ 1 ; check_count '~~'; } $dummy = $var =~ y/ //; check_count 'y///'; From 786c2a05ce9f2fa6f6e06dca23b31f0755094436 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Mon, 24 Oct 2022 23:17:28 +0200 Subject: [PATCH 3/5] Smartmatch deprecation warnings are disabled by `no warnings 'deprecated'` --- t/lib/croak/pp_ctl | 2 -- 1 file changed, 2 deletions(-) diff --git a/t/lib/croak/pp_ctl b/t/lib/croak/pp_ctl index a63cbd78491e..179c8d7aea89 100644 --- a/t/lib/croak/pp_ctl +++ b/t/lib/croak/pp_ctl @@ -11,14 +11,12 @@ no warnings 'deprecated'; goto f; CORE::given(1){f:} EXPECT -given is experimental at - line 3. Can't "goto" into a "given" block at - line 3. ######## # NAME goto from given topic expression no warnings 'deprecated'; CORE::given(goto f){f:} EXPECT -given is experimental at - line 2. Can't "goto" into a "given" block at - line 2. ######## # NAME goto into expression From 9008e7b4b13e4cbc586b3374bd10dad0bc1192b3 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Mon, 24 Oct 2022 23:25:20 +0200 Subject: [PATCH 4/5] Document that smartmatch is deprecated and will be removed in 5.42 --- lib/feature.pm | 3 +++ pod/perldiag.pod | 30 ++++++++++++++---------------- regen/feature.pl | 3 +++ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/feature.pm b/lib/feature.pm index ebaae10f4a7a..cf9529133032 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -183,6 +183,9 @@ given/when construct. See L for details. This feature is available starting with Perl 5.10. +It is deprecated starting with Perl 5.38, and using +C, C or smartmatch will throw a warning. +It will be removed in Perl 5.42. =head2 The 'unicode_strings' feature diff --git a/pod/perldiag.pod b/pod/perldiag.pod index d99f79c6e8a5..d774e3537c8d 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2643,11 +2643,10 @@ C operator returned an invalid UIC. forget to check the return value of your socket() call? See L. -=item given is experimental +=item given is deprecated -(S experimental::smartmatch) C depends on smartmatch, which -is experimental, so its behavior may change or even be removed -in any future release of perl. See the explanation under +(D deprecated) C depends on smartmatch, which is deprecated. It +will be removed in Perl 5.42. See the explanation under L. =item Global symbol "%s" requires explicit package name (did you forget to @@ -6038,14 +6037,13 @@ so there can't be any left to fill later parameters. overload it: Perl refuses to use the object's underlying structure for the smart match. -=item Smartmatch is experimental +=item Smartmatch is deprecated -(S experimental::smartmatch) This warning is emitted if you -use the smartmatch (C<~~>) operator. This is currently an experimental -feature, and its details are subject to change in future releases of -Perl. Particularly, its current behavior is noticed for being -unnecessarily complex and unintuitive, and is very likely to be -overhauled. +(D deprecated) This warning is emitted if you +use the smartmatch (C<~~>) operator. This is a deprecated +feature. Particularly, its behavior is noticed for being +unnecessarily complex and unintuitive, and it will be removed +in Perl 5.42. =item Sorry, hash keys must be smaller than 2**31 bytes @@ -8025,12 +8023,12 @@ but in actual fact, you got So put in parentheses to say what you really mean. -=item when is experimental +=item when is deprecated -(S experimental::smartmatch) C depends on smartmatch, which is -experimental. Additionally, it has several special cases that may -not be immediately obvious, and their behavior may change or -even be removed in any future release of perl. See the explanation +(D deprecated) C depends on smartmatch, which is +deprecated. Additionally, it has several special cases that may +not be immediately obvious, and it will be removed in Perl 5.42. +See the explanation under L. =item Wide character in %s diff --git a/regen/feature.pl b/regen/feature.pl index 32ae36cc83da..33dcabd230c3 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -605,6 +605,9 @@ =head2 The 'switch' feature See L for details. This feature is available starting with Perl 5.10. +It is deprecated starting with Perl 5.38, and using +C, C or smartmatch will throw a warning. +It will be removed in Perl 5.42. =head2 The 'unicode_strings' feature From 24edf7e48ece238ad262990e02b27d910620caa6 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Mon, 24 Oct 2022 23:50:27 +0200 Subject: [PATCH 5/5] Update the smartmatch experiment status --- pod/perlexperiment.pod | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pod/perlexperiment.pod b/pod/perlexperiment.pod index bd0100d16cde..f11075ce7289 100644 --- a/pod/perlexperiment.pod +++ b/pod/perlexperiment.pod @@ -24,8 +24,12 @@ Introduced in Perl 5.10.0 Modified in Perl 5.10.1, 5.12.0 +Deprecated in 5.38.0 + +Will be removed in 5.42.0 + Using this feature triggers warnings in the category -C. +C. The ticket for this experiment is L<[perl #13173]|https://github.com/Perl/perl5/issues/13173>.