From 3c3f8cd64edb32a0dac554f7a524cc222184c3ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 25 Jan 2015 14:10:13 +0000 Subject: [PATCH] Revert the support for new warning categories outside of "all" This reverts & amends my v5.21.7-151-gea5519d and Karl Williamson's v5.21.7-183-g2f3cbe1, the latter was only need because of the former. I've also taken the opportunity to fix the long-standing trivial bug with misaligned code in warnings.{pm,h}. That was easier to commit along with this than to split it up from the other generated changes. Why revert this? See the "use warnings 'absolutely-all-almost';" thread on perl5-porters for the latest summary: http://www.nntp.perl.org/group/perl.perl5.porters/2015/01/msg225066.html Basically as I explained in v5.21.7-151-gea5519d the current design of the API makes it too contentious to freely add new warnings, but there's no consensus on how to solve that. I.e. whether we should just add them to "all", or do this change, or several other possible things outlined in that thread and elsewhere. Since the deadline for contentious changes for v5.22 is already past us I'm backing this out for now. --- lib/B/Deparse.t | 12 +- lib/warnings.pm | 796 ++++++++++++++++++++++++------------------------------ mg.c | 11 + op.c | 21 +- pod/perldiag.pod | 11 - pod/perlrun.pod | 4 +- regen/warnings.pl | 308 ++++++++------------- t/lib/warnings/op | 13 +- t/op/caller.t | 5 +- util.c | 27 +- warnings.h | 143 +++++----- 11 files changed, 565 insertions(+), 786 deletions(-) diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index b91598b..d1764b1 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -1857,12 +1857,12 @@ my sub f {} print f(); >>>> use feature 'lexical_subs'; -BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x54\x55\x50\x15"} +BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55"} my sub f { - BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x54\x55\x10"} + BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55"} } -BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x54\x55\x10"} +BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55"} print f(); #### # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version" @@ -1873,13 +1873,13 @@ state sub f {} print f(); >>>> use feature 'lexical_subs'; -BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x54\x55\x50\x15"} +BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55"} CORE::state sub f { - BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x54\x55\x10"} + BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55"} use feature 'state'; } -BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x54\x55\x10"} +BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55"} use feature 'state'; print f(); #### diff --git a/lib/warnings.pm b/lib/warnings.pm index 2020568..80c9cd9 100644 --- a/lib/warnings.pm +++ b/lib/warnings.pm @@ -5,7 +5,7 @@ package warnings; -our $VERSION = '1.30'; +our $VERSION = '1.31'; # Verify that we're called correctly so that warnings will work. # see also strict.pm. @@ -15,248 +15,233 @@ unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { } our %Offsets = ( - # Warnings Categories added in Perl 5.008 - - 'all' => 0, - 'closure' => 2, - 'deprecated' => 4, - 'exiting' => 6, - 'glob' => 8, - 'io' => 10, - 'closed' => 12, - 'exec' => 14, - 'layer' => 16, - 'newline' => 18, - 'pipe' => 20, - 'unopened' => 22, - 'misc' => 24, - 'numeric' => 26, - 'once' => 28, - 'overflow' => 30, - 'pack' => 32, - 'portable' => 34, - 'recursion' => 36, - 'redefine' => 38, - 'regexp' => 40, - 'severe' => 42, - 'debugging' => 44, - 'inplace' => 46, - 'internal' => 48, - 'malloc' => 50, - 'signal' => 52, - 'substr' => 54, - 'syntax' => 56, - 'ambiguous' => 58, - 'bareword' => 60, - 'digit' => 62, - 'parenthesis' => 64, - 'precedence' => 66, - 'printf' => 68, - 'prototype' => 70, - 'qw' => 72, - 'reserved' => 74, - 'semicolon' => 76, - 'taint' => 78, - 'threads' => 80, - 'uninitialized' => 82, - 'unpack' => 84, - 'untie' => 86, - 'utf8' => 88, - 'void' => 90, + 'all' => 0, + 'closure' => 2, + 'deprecated' => 4, + 'exiting' => 6, + 'glob' => 8, + 'io' => 10, + 'closed' => 12, + 'exec' => 14, + 'layer' => 16, + 'newline' => 18, + 'pipe' => 20, + 'unopened' => 22, + 'misc' => 24, + 'numeric' => 26, + 'once' => 28, + 'overflow' => 30, + 'pack' => 32, + 'portable' => 34, + 'recursion' => 36, + 'redefine' => 38, + 'regexp' => 40, + 'severe' => 42, + 'debugging' => 44, + 'inplace' => 46, + 'internal' => 48, + 'malloc' => 50, + 'signal' => 52, + 'substr' => 54, + 'syntax' => 56, + 'ambiguous' => 58, + 'bareword' => 60, + 'digit' => 62, + 'parenthesis' => 64, + 'precedence' => 66, + 'printf' => 68, + 'prototype' => 70, + 'qw' => 72, + 'reserved' => 74, + 'semicolon' => 76, + 'taint' => 78, + 'threads' => 80, + 'uninitialized' => 82, + 'unpack' => 84, + 'untie' => 86, + 'utf8' => 88, + 'void' => 90, # Warnings Categories added in Perl 5.011 - - 'imprecision' => 92, - 'illegalproto' => 94, + 'imprecision' => 92, + 'illegalproto' => 94, # Warnings Categories added in Perl 5.013 - - 'non_unicode' => 96, - 'nonchar' => 98, - 'surrogate' => 100, + 'non_unicode' => 96, + 'nonchar' => 98, + 'surrogate' => 100, # Warnings Categories added in Perl 5.017 - - 'experimental' => 102, - 'experimental::lexical_subs'=> 104, - 'experimental::lexical_topic'=> 106, - 'experimental::regex_sets'=> 108, - 'experimental::smartmatch'=> 110, + 'experimental' => 102, + 'experimental::lexical_subs' => 104, + 'experimental::lexical_topic' => 106, + 'experimental::regex_sets' => 108, + 'experimental::smartmatch' => 110, # Warnings Categories added in Perl 5.019 - - 'experimental::autoderef'=> 112, - 'experimental::postderef'=> 114, - 'experimental::signatures'=> 116, - 'syscalls' => 118, + 'experimental::autoderef' => 112, + 'experimental::postderef' => 114, + 'experimental::signatures' => 116, + 'syscalls' => 118, # Warnings Categories added in Perl 5.021 - - 'everything' => 120, - 'experimental::const_attr'=> 122, - 'experimental::re_strict'=> 124, - 'experimental::refaliasing'=> 126, - 'experimental::win32_perlio'=> 128, - 'locale' => 130, - 'missing' => 132, - 'redundant' => 134, - 'extra' => 136, - 'void_unusual' => 138, - ); + 'experimental::const_attr' => 120, + 'experimental::re_strict' => 122, + 'experimental::refaliasing' => 124, + 'experimental::win32_perlio' => 126, + 'locale' => 128, + 'missing' => 130, + 'redundant' => 132, +); our %Bits = ( - 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x00", # [0..59,61..67] - 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] - 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] - 'closed' => "\x00\x10\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", # [1] - 'debugging' => "\x00\x00\x00\x00\x00\x10\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\x00\x00\x00\x00\x00\x00", # [2] - 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31] - 'everything' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x05", # [0..69] - 'exec' => "\x00\x40\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", # [3] - 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x15\x54\x01\x00", # [51..58,61..64] - 'experimental::autoderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [56] - 'experimental::const_attr'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [61] - 'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [52] - 'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [53] - 'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [57] - 'experimental::re_strict'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [62] - 'experimental::refaliasing'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [63] - 'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [54] - 'experimental::signatures'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [58] - 'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00", # [55] - 'experimental::win32_perlio'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [64] - 'extra' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05", # [68,69] - 'glob' => "\x00\x01\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", # [47] - 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\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", # [23] - 'internal' => "\x00\x00\x00\x00\x00\x00\x01\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\x00\x40\x00\x00\x00", # [5..11,59] - 'layer' => "\x00\x00\x01\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\x00\x00\x04\x00", # [65] - 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\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", # [12] - 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [66] - 'newline' => "\x00\x00\x04\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", # [48] - 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [49] - 'numeric' => "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] - 'once' => "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] - 'overflow' => "\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] - 'pack' => "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] - 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [32] - 'pipe' => "\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] - 'portable' => "\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] - 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [33] - 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [34] - 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [35] - 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\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", # [18] - 'redefine' => "\x00\x00\x00\x00\x40\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\x00\x40\x00", # [67] - 'regexp' => "\x00\x00\x00\x00\x00\x01\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", # [37] - 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\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", # [21..25] - 'signal' => "\x00\x00\x00\x00\x00\x00\x10\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", # [27] - 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\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", # [28..38,47] - 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [59] - 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\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", # [40] - 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [41] - 'unopened' => "\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] - 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [42] - 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [43] - 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x15\x00\x00\x00\x00\x00", # [44,48..50] - 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [45] - 'void_unusual' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [69] - ); + 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15", # [0..66] + 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] + 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] + 'closed' => "\x00\x10\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", # [1] + 'debugging' => "\x00\x00\x00\x00\x00\x10\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\x00\x00\x00\x00\x00", # [2] + 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\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", # [7] + 'exiting' => "\x40\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\x55\x15\x55\x00", # [51..58,60..63] + 'experimental::autoderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00", # [56] + 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [60] + 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [52] + 'experimental::lexical_topic' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [53] + 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [57] + 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [61] + 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [62] + 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [54] + 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [58] + 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [55] + 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [63] + 'glob' => "\x00\x01\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", # [47] + 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [46] + 'inplace' => "\x00\x00\x00\x00\x00\x40\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", # [24] + 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [5..11,59] + 'layer' => "\x00\x00\x01\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\x00\x00\x01", # [64] + 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\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", # [12] + 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [65] + 'newline' => "\x00\x00\x04\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", # [48] + 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [49] + 'numeric' => "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] + 'once' => "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] + 'overflow' => "\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] + 'pack' => "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] + 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [32] + 'pipe' => "\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] + 'portable' => "\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] + 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [33] + 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00", # [34] + 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [35] + 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\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", # [18] + 'redefine' => "\x00\x00\x00\x00\x40\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\x00\x10", # [66] + 'regexp' => "\x00\x00\x00\x00\x00\x01\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", # [37] + 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\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", # [21..25] + 'signal' => "\x00\x00\x00\x00\x00\x00\x10\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", # [27] + 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [50] + 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00\x00\x00\x00", # [28..38,47] + 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [59] + 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\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", # [40] + 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [41] + 'unopened' => "\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] + 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00", # [42] + 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00", # [43] + 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x15\x00\x00\x00\x00", # [44,48..50] + 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [45] +); our %DeadBits = ( - 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xa8\xaa\x00", # [0..59,61..67] - 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] - 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] - 'closed' => "\x00\x20\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", # [1] - 'debugging' => "\x00\x00\x00\x00\x00\x20\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\x00\x00\x00\x00\x00\x00", # [2] - 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31] - 'everything' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x0a", # [0..69] - 'exec' => "\x00\x80\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", # [3] - 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\x2a\xa8\x02\x00", # [51..58,61..64] - 'experimental::autoderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [56] - 'experimental::const_attr'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [61] - 'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [52] - 'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [53] - 'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [57] - 'experimental::re_strict'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [62] - 'experimental::refaliasing'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [63] - 'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [54] - 'experimental::signatures'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [58] - 'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00", # [55] - 'experimental::win32_perlio'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [64] - 'extra' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a", # [68,69] - 'glob' => "\x00\x02\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", # [47] - 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\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", # [23] - 'internal' => "\x00\x00\x00\x00\x00\x00\x02\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\x00\x80\x00\x00\x00", # [5..11,59] - 'layer' => "\x00\x00\x02\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\x00\x00\x08\x00", # [65] - 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\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", # [12] - 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [66] - 'newline' => "\x00\x00\x08\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", # [48] - 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [49] - 'numeric' => "\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] - 'once' => "\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] - 'overflow' => "\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] - 'pack' => "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] - 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [32] - 'pipe' => "\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] - 'portable' => "\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] - 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [33] - 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [34] - 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [35] - 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\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", # [18] - 'redefine' => "\x00\x00\x00\x00\x80\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\x00\x80\x00", # [67] - 'regexp' => "\x00\x00\x00\x00\x00\x02\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", # [37] - 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\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", # [21..25] - 'signal' => "\x00\x00\x00\x00\x00\x00\x20\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", # [27] - 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\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", # [28..38,47] - 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [59] - 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\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", # [40] - 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00", # [41] - 'unopened' => "\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] - 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [42] - 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [43] - 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x2a\x00\x00\x00\x00\x00", # [44,48..50] - 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00", # [45] - 'void_unusual' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [69] - ); - -$NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; -$DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x15\x54\x05\x00", # [2,56,61,52,53,57,62,63,54,58,55,64,4,65,22,23,25] -$LAST_BIT = 140 ; -$BYTES = 18 ; - -$All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; + 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x2a", # [0..66] + 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] + 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] + 'closed' => "\x00\x20\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", # [1] + 'debugging' => "\x00\x00\x00\x00\x00\x20\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\x00\x00\x00\x00\x00", # [2] + 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\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", # [7] + 'exiting' => "\x80\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\xaa\x2a\xaa\x00", # [51..58,60..63] + 'experimental::autoderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00", # [56] + 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [60] + 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [52] + 'experimental::lexical_topic' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [53] + 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [57] + 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [61] + 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [62] + 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [54] + 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [58] + 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [55] + 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [63] + 'glob' => "\x00\x02\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", # [47] + 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [46] + 'inplace' => "\x00\x00\x00\x00\x00\x80\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", # [24] + 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [5..11,59] + 'layer' => "\x00\x00\x02\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\x00\x00\x02", # [64] + 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\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", # [12] + 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [65] + 'newline' => "\x00\x00\x08\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", # [48] + 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [49] + 'numeric' => "\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] + 'once' => "\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] + 'overflow' => "\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] + 'pack' => "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] + 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [32] + 'pipe' => "\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] + 'portable' => "\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] + 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00", # [33] + 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00", # [34] + 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00", # [35] + 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\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", # [18] + 'redefine' => "\x00\x00\x00\x00\x80\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\x00\x20", # [66] + 'regexp' => "\x00\x00\x00\x00\x00\x02\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", # [37] + 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\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", # [21..25] + 'signal' => "\x00\x00\x00\x00\x00\x00\x20\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", # [27] + 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [50] + 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00\x00\x00\x00", # [28..38,47] + 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [59] + 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\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", # [40] + 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00", # [41] + 'unopened' => "\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] + 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00", # [42] + 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00", # [43] + 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x2a\x00\x00\x00\x00", # [44,48..50] + 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [45] +); + +# 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"; +our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x15\x55\x01", # [2,56,60,52,53,57,61,62,54,58,55,63,4,64,22,23,25] +our $LAST_BIT = 134 ; +our $BYTES = 17 ; + +our $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; sub Croaker { @@ -535,17 +520,12 @@ be applied to their module. By default, optional warnings are disabled, so any legacy code that doesn't attempt to control the warnings will work unchanged. -When we talk about "all" warnings we don't actually mean "all the -warnings we support". See L for details. The "all" category should really be called the -"default" category, if not for backwards-compatibility concerns. - -"All" warnings are enabled in a block by either of these: +All warnings are enabled in a block by either of these: use warnings; use warnings 'all'; -Similarly "all" warnings are disabled in a block by either of these: +Similarly all warnings are disabled in a block by either of these: no warnings; no warnings 'all'; @@ -663,7 +643,7 @@ details of how this flag interacts with lexical warnings. =item B<-W> X<-W> -If the B<-W> flag is used on the command line, it will enable "all" warnings +If the B<-W> flag is used on the command line, it will enable all warnings throughout the program regardless of whether warnings were disabled locally using C or C<$^W =0>. This includes all files that get @@ -673,80 +653,10 @@ Think of it as the Perl equivalent of the "lint" command. =item B<-X> X<-X> -Does the exact opposite to the B<-W> flag, i.e. it disables "all" warnings. +Does the exact opposite to the B<-W> flag, i.e. it disables all warnings. =back -=head2 Top-level warning categories & associated confusion - -The lexical warning pragma was introduced in v5.6.0 of perl, and from -the very beginning doing C would enable the "all" -category of warnings, which were all the warnings we support. - -This led to arguments whenever someone suggested a new warning be -added to perl, since that implicitly meant that existing programs that -used the warnings pragma would be retroactively subjected to them when -perl was upgraded. - -So similarly to how most C compilers support C<-Wall> to mean "not -quite all warnings" along with extra options like C<-Wextra>, we -support warnings outside of the "all" category. Think of the "all" -category as "default", that's what we'd call it we were starting out -today and didn't have a bunch of programs doing C -in the wild already. - -The categories we support are: - -=over - -=item * all - -This is the "default" category for warnings that we've supported ever -since v5.6.0. We have and might occasionally add new warnings here if -they're deemed to be similar in nature to our existing warnings, but -mostly these are things we're pretty sure are a logic error, but -aren't irrecoverable, so they're not a runtime error. - -When you upgrade perl you might find that we've added some new -warnings here, but they won't be anything wildly different from the -current set of warnings, so the burden of going through your existing -code and auditing the new parts that are warning should be fairly -light. - -=item * everything - -This is what "all" would be if the world made any sense, but since we -started out with "all" you need to enable "everything" to really -enable "all the warnings". - -You almost definitely don't want to enable "everything", unless you're -willing to potentially get a flood of new warnings with every perl -upgrade, and those warnings may be entirely different in spirit to -existing warnings shipped with previous releases. - -Maybe we'll start introducing really pedantic warnings that aren't -useful for most cases, maybe we'll start warning about inconsistent -indentation, who knows? If you really want ALL the warnings perl has -to offer enable these, otherwise stick with some more sane category. - -=item * extra - -These are warnings that we might have put into "all" -(a.k.a. "default") if we had a time machine and were starting out with -perl today, but they'd probably cause too much of a disruption today -so we're not doing that. - -As of writing this the sole warning in this category is a warning -about useless use of grep in void context, but unlike for the "all" -category we reserve the right to freely add things to this category in -the future. - -=back - -In the future we might add any number of other top-level -categories. The backwards-compatibility promises of those categories -(if any) will be documented here. - =head2 Backward Compatibility If you are used to working with a version of Perl prior to the @@ -803,145 +713,139 @@ to be enabled/disabled in isolation. The current hierarchy is: - everything -+ - | - +- all ---+ - | | - | +- closure - | | - | +- deprecated - | | - | +- exiting - | | - | +- experimental --+ - | | | - | | +- experimental::autoderef - | | | - | | +- experimental::const_attr - | | | - | | +- experimental::lexical_subs - | | | - | | +- experimental::lexical_topic - | | | - | | +- experimental::postderef - | | | - | | +- experimental::re_strict - | | | - | | +- experimental::refaliasing - | | | - | | +- experimental::regex_sets - | | | - | | +- experimental::signatures - | | | - | | +- experimental::smartmatch - | | | - | | +- experimental::win32_perlio - | | - | +- glob - | | - | +- imprecision - | | - | +- io ------------+ - | | | - | | +- closed - | | | - | | +- exec - | | | - | | +- layer - | | | - | | +- newline - | | | - | | +- pipe - | | | - | | +- syscalls - | | | - | | +- unopened - | | - | +- locale - | | - | +- misc - | | - | +- missing - | | - | +- numeric - | | - | +- once - | | - | +- overflow - | | - | +- pack - | | - | +- portable - | | - | +- recursion - | | - | +- redefine - | | - | +- redundant - | | - | +- regexp - | | - | +- severe --------+ - | | | - | | +- debugging - | | | - | | +- inplace - | | | - | | +- internal - | | | - | | +- malloc - | | - | +- signal - | | - | +- substr - | | - | +- syntax --------+ - | | | - | | +- ambiguous - | | | - | | +- bareword - | | | - | | +- digit - | | | - | | +- illegalproto - | | | - | | +- parenthesis - | | | - | | +- precedence - | | | - | | +- printf - | | | - | | +- prototype - | | | - | | +- qw - | | | - | | +- reserved - | | | - | | +- semicolon - | | - | +- taint - | | - | +- threads - | | - | +- uninitialized - | | - | +- unpack - | | - | +- untie - | | - | +- utf8 ----------+ - | | | - | | +- non_unicode - | | | - | | +- nonchar - | | | - | | +- surrogate - | | - | +- void - | - +- extra -+ - | - +- void_unusual + all -+ + | + +- closure + | + +- deprecated + | + +- exiting + | + +- experimental --+ + | | + | +- experimental::autoderef + | | + | +- experimental::const_attr + | | + | +- experimental::lexical_subs + | | + | +- experimental::lexical_topic + | | + | +- experimental::postderef + | | + | +- experimental::re_strict + | | + | +- experimental::refaliasing + | | + | +- experimental::regex_sets + | | + | +- experimental::signatures + | | + | +- experimental::smartmatch + | | + | +- experimental::win32_perlio + | + +- glob + | + +- imprecision + | + +- io ------------+ + | | + | +- closed + | | + | +- exec + | | + | +- layer + | | + | +- newline + | | + | +- pipe + | | + | +- syscalls + | | + | +- unopened + | + +- locale + | + +- misc + | + +- missing + | + +- numeric + | + +- once + | + +- overflow + | + +- pack + | + +- portable + | + +- recursion + | + +- redefine + | + +- redundant + | + +- regexp + | + +- severe --------+ + | | + | +- debugging + | | + | +- inplace + | | + | +- internal + | | + | +- malloc + | + +- signal + | + +- substr + | + +- syntax --------+ + | | + | +- ambiguous + | | + | +- bareword + | | + | +- digit + | | + | +- illegalproto + | | + | +- parenthesis + | | + | +- precedence + | | + | +- printf + | | + | +- prototype + | | + | +- qw + | | + | +- reserved + | | + | +- semicolon + | + +- taint + | + +- threads + | + +- uninitialized + | + +- unpack + | + +- untie + | + +- utf8 ----------+ + | | + | +- non_unicode + | | + | +- nonchar + | | + | +- surrogate + | + +- void Just like the "strict" pragma any of these categories can be combined diff --git a/mg.c b/mg.c index c3de7f5..58427a4 100644 --- a/mg.c +++ b/mg.c @@ -2774,6 +2774,17 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) PerlMemShared_free(PL_compiling.cop_warnings); PL_compiling.cop_warnings = pWARN_NONE; } + /* Yuck. I can't see how to abstract this: */ + else if (isWARN_on( + ((STRLEN *)SvPV_nolen_const(sv)) - 1, + WARN_ALL) + && !any_fatals) + { + if (!specialWARN(PL_compiling.cop_warnings)) + PerlMemShared_free(PL_compiling.cop_warnings); + PL_compiling.cop_warnings = pWARN_ALL; + PL_dowarn |= G_WARN_ONCE ; + } else { STRLEN len; const char *const p = SvPV_const(sv, len); diff --git a/op.c b/op.c index 1df1a7a..5aeedfc 100644 --- a/op.c +++ b/op.c @@ -1767,7 +1767,6 @@ Perl_scalarvoid(pTHX_ OP *arg) do { SV *useless_sv = NULL; const char* useless = NULL; - bool useless_is_grep = FALSE; if (o->op_type == OP_NEXTSTATE || o->op_type == OP_DBSTATE @@ -1887,14 +1886,8 @@ Perl_scalarvoid(pTHX_ OP *arg) case OP_HELEM: case OP_HSLICE: if (!(o->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO))) - useless = OP_DESC(o); - break; - case OP_GREPWHILE: - if (!(o->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO))) { /* Otherwise it's "Useless use of grep iterator" */ - useless = "grep"; - useless_is_grep = TRUE; - } + useless = OP_DESC(o); break; case OP_SPLIT: @@ -2125,15 +2118,9 @@ Perl_scalarvoid(pTHX_ OP *arg) SVfARG(sv_2mortal(useless_sv))); } else if (useless) { - if (useless_is_grep) { - Perl_ck_warner(aTHX_ packWARN(WARN_VOID_UNUSUAL), - "Unusual use of %s in void context", - useless); - } else { - Perl_ck_warner(aTHX_ packWARN(WARN_VOID), - "Useless use of %s in void context", - useless); - } + Perl_ck_warner(aTHX_ packWARN(WARN_VOID), + "Useless use of %s in void context", + useless); } } while ( (o = POP_DEFERRED_OP()) ); diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 3ca9bd3..3ceb747 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -6579,17 +6579,6 @@ since they are often used in statements like String constants that would normally evaluate to 0 or 1 are warned about. -=item Unusual use of %s in void context - -(W void_unusual) Similar to the "Useless use of %s in void context" -warning, but only turned on by the top-level "pedantic" warning -category, used for e.g. C in void context, which may indicate a -bug, but could also just be someone using C for its side-effects -as a loop. - -Enabled as part of "extra" warnings, not in the "all" category. See -L for details - =item Useless use of (?-p) in regex; marked by S<<-- HERE> in m/%s/ (W regexp) The C

modifier cannot be turned off once set. Trying to do diff --git a/pod/perlrun.pod b/pod/perlrun.pod index 0964a42..acf2702 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -925,13 +925,13 @@ of warnings; see L. =item B<-W> X<-W> -Enables "all" warnings regardless of C or C<$^W>. +Enables all warnings regardless of C or C<$^W>. See L. =item B<-X> X<-X> -Disables "all" warnings regardless of C or C<$^W>. +Disables all warnings regardless of C or C<$^W>. See L. =item B<-x> diff --git a/regen/warnings.pl b/regen/warnings.pl index e53059d..13d94da 100644 --- a/regen/warnings.pl +++ b/regen/warnings.pl @@ -28,102 +28,92 @@ sub DEFAULT_ON () { 1 } sub DEFAULT_OFF () { 2 } my $tree = { -'everything' => [ 5.021, { - 'all' => [ 5.008, { - 'io' => [ 5.008, { - 'pipe' => [ 5.008, DEFAULT_OFF], - 'unopened' => [ 5.008, DEFAULT_OFF], - 'closed' => [ 5.008, DEFAULT_OFF], - 'newline' => [ 5.008, DEFAULT_OFF], - 'exec' => [ 5.008, DEFAULT_OFF], - 'layer' => [ 5.008, DEFAULT_OFF], - 'syscalls' => [ 5.019, DEFAULT_OFF], - }], - 'syntax' => [ 5.008, { - 'ambiguous' => [ 5.008, DEFAULT_OFF], - 'semicolon' => [ 5.008, DEFAULT_OFF], - 'precedence' => [ 5.008, DEFAULT_OFF], - 'bareword' => [ 5.008, DEFAULT_OFF], - 'reserved' => [ 5.008, DEFAULT_OFF], - 'digit' => [ 5.008, DEFAULT_OFF], - 'parenthesis' => [ 5.008, DEFAULT_OFF], - 'printf' => [ 5.008, DEFAULT_OFF], - 'prototype' => [ 5.008, DEFAULT_OFF], - 'qw' => [ 5.008, DEFAULT_OFF], - 'illegalproto' => [ 5.011, DEFAULT_OFF], - }], - 'severe' => [ 5.008, { - 'inplace' => [ 5.008, DEFAULT_ON], - 'internal' => [ 5.008, DEFAULT_OFF], - 'debugging' => [ 5.008, DEFAULT_ON], - 'malloc' => [ 5.008, DEFAULT_ON], - }], - 'deprecated' => [ 5.008, DEFAULT_ON], - 'void' => [ 5.008, DEFAULT_OFF], - 'recursion' => [ 5.008, DEFAULT_OFF], - 'redefine' => [ 5.008, DEFAULT_OFF], - 'numeric' => [ 5.008, DEFAULT_OFF], - 'uninitialized' => [ 5.008, DEFAULT_OFF], - 'once' => [ 5.008, DEFAULT_OFF], - 'misc' => [ 5.008, DEFAULT_OFF], - 'regexp' => [ 5.008, DEFAULT_OFF], - 'glob' => [ 5.008, DEFAULT_ON], - 'untie' => [ 5.008, DEFAULT_OFF], - 'substr' => [ 5.008, DEFAULT_OFF], - 'taint' => [ 5.008, DEFAULT_OFF], - 'signal' => [ 5.008, DEFAULT_OFF], - 'closure' => [ 5.008, DEFAULT_OFF], - 'overflow' => [ 5.008, DEFAULT_OFF], - 'portable' => [ 5.008, DEFAULT_OFF], - 'utf8' => [ 5.008, { - 'surrogate' => [ 5.013, DEFAULT_OFF], - 'nonchar' => [ 5.013, DEFAULT_OFF], - 'non_unicode' => [ 5.013, DEFAULT_OFF], - }], - 'exiting' => [ 5.008, DEFAULT_OFF], - 'pack' => [ 5.008, DEFAULT_OFF], - 'unpack' => [ 5.008, DEFAULT_OFF], - 'threads' => [ 5.008, DEFAULT_OFF], - 'imprecision' => [ 5.011, DEFAULT_OFF], - 'experimental' => [ 5.017, { - 'experimental::lexical_subs' => - [ 5.017, DEFAULT_ON ], - 'experimental::regex_sets' => - [ 5.017, DEFAULT_ON ], - 'experimental::lexical_topic' => - [ 5.017, DEFAULT_ON ], - 'experimental::smartmatch' => - [ 5.017, DEFAULT_ON ], - 'experimental::postderef' => - [ 5.019, DEFAULT_ON ], - 'experimental::autoderef' => - [ 5.019, DEFAULT_ON ], - 'experimental::signatures' => - [ 5.019, DEFAULT_ON ], - 'experimental::win32_perlio' => - [ 5.021, DEFAULT_ON ], - 'experimental::refaliasing' => - [ 5.021, DEFAULT_ON ], - 'experimental::re_strict' => - [ 5.021, DEFAULT_ON ], - 'experimental::const_attr' => - [ 5.021, DEFAULT_ON ], - }], - - 'missing' => [ 5.021, DEFAULT_OFF], - 'redundant' => [ 5.021, DEFAULT_OFF], - 'locale' => [ 5.021, DEFAULT_ON], - - #'default' => [ 5.008, DEFAULT_ON ], - }], - - # When adding new warnings outside of "all" make sure to - # either patch util.c to ignore them under -w and -W, or to - # generalize the facility for adding them so that it knows - # about warnings outside of "all". - 'extra' => [ 5.021, { - 'void_unusual' => [ 5.021, DEFAULT_OFF], - }], +'all' => [ 5.008, { + 'io' => [ 5.008, { + 'pipe' => [ 5.008, DEFAULT_OFF], + 'unopened' => [ 5.008, DEFAULT_OFF], + 'closed' => [ 5.008, DEFAULT_OFF], + 'newline' => [ 5.008, DEFAULT_OFF], + 'exec' => [ 5.008, DEFAULT_OFF], + 'layer' => [ 5.008, DEFAULT_OFF], + 'syscalls' => [ 5.019, DEFAULT_OFF], + }], + 'syntax' => [ 5.008, { + 'ambiguous' => [ 5.008, DEFAULT_OFF], + 'semicolon' => [ 5.008, DEFAULT_OFF], + 'precedence' => [ 5.008, DEFAULT_OFF], + 'bareword' => [ 5.008, DEFAULT_OFF], + 'reserved' => [ 5.008, DEFAULT_OFF], + 'digit' => [ 5.008, DEFAULT_OFF], + 'parenthesis' => [ 5.008, DEFAULT_OFF], + 'printf' => [ 5.008, DEFAULT_OFF], + 'prototype' => [ 5.008, DEFAULT_OFF], + 'qw' => [ 5.008, DEFAULT_OFF], + 'illegalproto' => [ 5.011, DEFAULT_OFF], + }], + 'severe' => [ 5.008, { + 'inplace' => [ 5.008, DEFAULT_ON], + 'internal' => [ 5.008, DEFAULT_OFF], + 'debugging' => [ 5.008, DEFAULT_ON], + 'malloc' => [ 5.008, DEFAULT_ON], + }], + 'deprecated' => [ 5.008, DEFAULT_ON], + 'void' => [ 5.008, DEFAULT_OFF], + 'recursion' => [ 5.008, DEFAULT_OFF], + 'redefine' => [ 5.008, DEFAULT_OFF], + 'numeric' => [ 5.008, DEFAULT_OFF], + 'uninitialized' => [ 5.008, DEFAULT_OFF], + 'once' => [ 5.008, DEFAULT_OFF], + 'misc' => [ 5.008, DEFAULT_OFF], + 'regexp' => [ 5.008, DEFAULT_OFF], + 'glob' => [ 5.008, DEFAULT_ON], + 'untie' => [ 5.008, DEFAULT_OFF], + 'substr' => [ 5.008, DEFAULT_OFF], + 'taint' => [ 5.008, DEFAULT_OFF], + 'signal' => [ 5.008, DEFAULT_OFF], + 'closure' => [ 5.008, DEFAULT_OFF], + 'overflow' => [ 5.008, DEFAULT_OFF], + 'portable' => [ 5.008, DEFAULT_OFF], + 'utf8' => [ 5.008, { + 'surrogate' => [ 5.013, DEFAULT_OFF], + 'nonchar' => [ 5.013, DEFAULT_OFF], + 'non_unicode' => [ 5.013, DEFAULT_OFF], + }], + 'exiting' => [ 5.008, DEFAULT_OFF], + 'pack' => [ 5.008, DEFAULT_OFF], + 'unpack' => [ 5.008, DEFAULT_OFF], + 'threads' => [ 5.008, DEFAULT_OFF], + 'imprecision' => [ 5.011, DEFAULT_OFF], + 'experimental' => [ 5.017, { + 'experimental::lexical_subs' => + [ 5.017, DEFAULT_ON ], + 'experimental::regex_sets' => + [ 5.017, DEFAULT_ON ], + 'experimental::lexical_topic' => + [ 5.017, DEFAULT_ON ], + 'experimental::smartmatch' => + [ 5.017, DEFAULT_ON ], + 'experimental::postderef' => + [ 5.019, DEFAULT_ON ], + 'experimental::autoderef' => + [ 5.019, DEFAULT_ON ], + 'experimental::signatures' => + [ 5.019, DEFAULT_ON ], + 'experimental::win32_perlio' => + [ 5.021, DEFAULT_ON ], + 'experimental::refaliasing' => + [ 5.021, DEFAULT_ON ], + 'experimental::re_strict' => + [ 5.021, DEFAULT_ON ], + 'experimental::const_attr' => + [ 5.021, DEFAULT_ON ], + }], + + 'missing' => [ 5.021, DEFAULT_OFF], + 'redundant' => [ 5.021, DEFAULT_OFF], + 'locale' => [ 5.021, DEFAULT_ON], + + #'default' => [ 5.008, DEFAULT_ON ], }]}; my @def ; @@ -299,7 +289,7 @@ sub mkOct if (@ARGV && $ARGV[0] eq "tree") { - print warningsTree($tree, " ") ; + print warningsTree($tree, " ") ; exit ; } @@ -359,14 +349,14 @@ EOM print $warn "\n/* Warnings Categories added in Perl $version */\n\n" if $last_ver != $version ; $name =~ y/:/_/; - print $warn tab(5, "#define WARN_$name"), " $k\n" ; + print $warn tab(6, "#define WARN_$name"), " $k\n" ; $last_ver = $version ; } print $warn "\n" ; - print $warn tab(5, '#define WARNsize'), "$warn_size\n" ; - print $warn tab(5, '#define WARN_ALLstring'), '"', ('\125' x $warn_size) , "\"\n" ; - print $warn tab(5, '#define WARN_NONEstring'), '"', ('\0' x $warn_size) , "\"\n" ; + print $warn tab(6, '#define WARNsize'), " $warn_size\n" ; + print $warn tab(6, '#define WARN_ALLstring'), ' "', ('\125' x $warn_size) , "\"\n" ; + print $warn tab(6, '#define WARN_NONEstring'), ' "', ('\0' x $warn_size) , "\"\n" ; print $warn <<'EOM'; @@ -431,21 +421,21 @@ while () { } my $last_ver = 0; -print $pm "our %Offsets = (\n" ; +print $pm "our %Offsets = (" ; foreach my $k (sort { $a <=> $b } keys %ValueToName) { my ($name, $version) = @{ $ValueToName{$k} }; $name = lc $name; $k *= 2 ; if ( $last_ver != $version ) { print $pm "\n"; - print $pm tab(4, " # Warnings Categories added in Perl $version"); - print $pm "\n\n"; + print $pm tab(6, " # Warnings Categories added in Perl $version"); + print $pm "\n"; } - print $pm tab(4, " '$name'"), "=> $k,\n" ; + print $pm tab(6, " '$name'"), "=> $k,\n" ; $last_ver = $version; } -print $pm " );\n\n" ; +print $pm ");\n\n" ; print $pm "our %Bits = (\n" ; foreach my $k (sort keys %list) { @@ -453,12 +443,12 @@ foreach my $k (sort keys %list) { my $v = $list{$k} ; my @list = sort { $a <=> $b } @$v ; - print $pm tab(4, " '$k'"), '=> "', + print $pm tab(6, " '$k'"), '=> "', mkHex($warn_size, map $_ * 2 , @list), '", # [', mkRange(@list), "]\n" ; } -print $pm " );\n\n" ; +print $pm ");\n\n" ; print $pm "our %DeadBits = (\n" ; foreach my $k (sort keys %list) { @@ -466,20 +456,21 @@ foreach my $k (sort keys %list) { my $v = $list{$k} ; my @list = sort { $a <=> $b } @$v ; - print $pm tab(4, " '$k'"), '=> "', + print $pm tab(6, " '$k'"), '=> "', mkHex($warn_size, map $_ * 2 + 1 , @list), '", # [', mkRange(@list), "]\n" ; } -print $pm " );\n\n" ; -print $pm '$NONE = "', ('\0' x $warn_size) , "\";\n" ; -print $pm '$DEFAULT = "', mkHex($warn_size, map $_ * 2, @def), +print $pm ");\n\n" ; +print $pm "# These are used by various things, including our own tests\n"; +print $pm tab(6, 'our $NONE'), '= "', ('\0' x $warn_size) , "\";\n" ; +print $pm tab(6, 'our $DEFAULT'), '= "', mkHex($warn_size, map $_ * 2, @def), '", # [', mkRange(@def), "]\n" ; -print $pm '$LAST_BIT = ' . "$index ;\n" ; -print $pm '$BYTES = ' . "$warn_size ;\n" ; +print $pm tab(6, 'our $LAST_BIT'), '= ' . "$index ;\n" ; +print $pm tab(6, 'our $BYTES'), '= ' . "$warn_size ;\n" ; while () { if ($_ eq "=for warnings.pl tree-goes-here\n") { - print $pm warningsTree($tree, " "); + print $pm warningsTree($tree, " "); next; } print $pm $_ ; @@ -490,7 +481,7 @@ read_only_bottom_close_and_rename($pm); __END__ package warnings; -our $VERSION = '1.30'; +our $VERSION = '1.31'; # Verify that we're called correctly so that warnings will work. # see also strict.pm. @@ -501,7 +492,7 @@ unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { KEYWORDS -$All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; +our $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; sub Croaker { @@ -780,17 +771,12 @@ be applied to their module. By default, optional warnings are disabled, so any legacy code that doesn't attempt to control the warnings will work unchanged. -When we talk about "all" warnings we don't actually mean "all the -warnings we support". See L for details. The "all" category should really be called the -"default" category, if not for backwards-compatibility concerns. - -"All" warnings are enabled in a block by either of these: +All warnings are enabled in a block by either of these: use warnings; use warnings 'all'; -Similarly "all" warnings are disabled in a block by either of these: +Similarly all warnings are disabled in a block by either of these: no warnings; no warnings 'all'; @@ -908,7 +894,7 @@ details of how this flag interacts with lexical warnings. =item B<-W> X<-W> -If the B<-W> flag is used on the command line, it will enable "all" warnings +If the B<-W> flag is used on the command line, it will enable all warnings throughout the program regardless of whether warnings were disabled locally using C or C<$^W =0>. This includes all files that get @@ -918,80 +904,10 @@ Think of it as the Perl equivalent of the "lint" command. =item B<-X> X<-X> -Does the exact opposite to the B<-W> flag, i.e. it disables "all" warnings. +Does the exact opposite to the B<-W> flag, i.e. it disables all warnings. =back -=head2 Top-level warning categories & associated confusion - -The lexical warning pragma was introduced in v5.6.0 of perl, and from -the very beginning doing C would enable the "all" -category of warnings, which were all the warnings we support. - -This led to arguments whenever someone suggested a new warning be -added to perl, since that implicitly meant that existing programs that -used the warnings pragma would be retroactively subjected to them when -perl was upgraded. - -So similarly to how most C compilers support C<-Wall> to mean "not -quite all warnings" along with extra options like C<-Wextra>, we -support warnings outside of the "all" category. Think of the "all" -category as "default", that's what we'd call it we were starting out -today and didn't have a bunch of programs doing C -in the wild already. - -The categories we support are: - -=over - -=item * all - -This is the "default" category for warnings that we've supported ever -since v5.6.0. We have and might occasionally add new warnings here if -they're deemed to be similar in nature to our existing warnings, but -mostly these are things we're pretty sure are a logic error, but -aren't irrecoverable, so they're not a runtime error. - -When you upgrade perl you might find that we've added some new -warnings here, but they won't be anything wildly different from the -current set of warnings, so the burden of going through your existing -code and auditing the new parts that are warning should be fairly -light. - -=item * everything - -This is what "all" would be if the world made any sense, but since we -started out with "all" you need to enable "everything" to really -enable "all the warnings". - -You almost definitely don't want to enable "everything", unless you're -willing to potentially get a flood of new warnings with every perl -upgrade, and those warnings may be entirely different in spirit to -existing warnings shipped with previous releases. - -Maybe we'll start introducing really pedantic warnings that aren't -useful for most cases, maybe we'll start warning about inconsistent -indentation, who knows? If you really want ALL the warnings perl has -to offer enable these, otherwise stick with some more sane category. - -=item * extra - -These are warnings that we might have put into "all" -(a.k.a. "default") if we had a time machine and were starting out with -perl today, but they'd probably cause too much of a disruption today -so we're not doing that. - -As of writing this the sole warning in this category is a warning -about useless use of grep in void context, but unlike for the "all" -category we reserve the right to freely add things to this category in -the future. - -=back - -In the future we might add any number of other top-level -categories. The backwards-compatibility promises of those categories -(if any) will be documented here. - =head2 Backward Compatibility If you are used to working with a version of Perl prior to the diff --git a/t/lib/warnings/op b/t/lib/warnings/op index 009a102..2ca9edf 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -417,7 +417,7 @@ $a <=> $b; # OP_NCMP use 5.015; __SUB__ ; # OP_RUNCV []; # OP_ANONLIST -grep /42/, (1,2); # OP_GREP, not warned about, in the "everything" & "void_unusual" category +grep /42/, (1,2); # OP_GREP. Not warned about (yet). Grep git logs for void_unusual to see why... EXPECT Useless use of a constant ("111") in void context at - line 2. Useless use of repeat (x) in void context at - line 3. @@ -467,17 +467,6 @@ Useless use of __SUB__ in void context at - line 61. Useless use of anonymous array ([]) in void context at - line 62. ######## # op.c -use warnings 'void_unusual' ; close STDIN ; -grep /42/, (1,2); # OP_GREP -no warnings 'void_unusual'; -grep /42/, (1,2); # OP_GREP -use warnings 'everything'; -grep /42/, (1,2); # OP_GREP -EXPECT -Unusual use of grep in void context at - line 3. -Unusual use of grep in void context at - line 7. -######## -# op.c use warnings 'void' ; close STDIN ; my $x = sort (2,1,3); no warnings 'void' ; diff --git a/t/op/caller.t b/t/op/caller.t index 760c412..6e56d67 100644 --- a/t/op/caller.t +++ b/t/op/caller.t @@ -106,14 +106,15 @@ sub testwarn { vec($default, $i, 2) = 1; } $registered = $default; + vec($registered, $warnings::LAST_BIT/2, 2) = 1; } BEGIN { check_bits( ${^WARNING_BITS}, "\0" x $warnings::BYTES, 'all bits off via "no warnings"' ) } testwarn("\0" x $warnings::BYTES, 'no bits'); - use warnings qw(everything); + use warnings; BEGIN { check_bits( ${^WARNING_BITS}, $default, - 'all bits on via "use warnings qw(everything)"' ); } + 'default bits on via "use warnings"' ); } BEGIN { testwarn($default, 'all'); } # run-time : # the warning mask has been extended by warnings::register diff --git a/util.c b/util.c index 67136fe..fbccd8a 100644 --- a/util.c +++ b/util.c @@ -1944,13 +1944,8 @@ bool Perl_ckwarn(pTHX_ U32 w) { /* If lexical warnings have not been set, use $^W. */ - if (isLEXWARN_off) { - /* TODO: Hardcoding this here sucks, see the commit that added this */ - if (w == WARN_VOID_UNUSUAL) - return FALSE; - else - return PL_dowarn & G_WARN_ON; - } + if (isLEXWARN_off) + return PL_dowarn & G_WARN_ON; return ckwarn_common(w); } @@ -1961,13 +1956,8 @@ bool Perl_ckwarn_d(pTHX_ U32 w) { /* If lexical warnings have not been set then default classes warn. */ - if (isLEXWARN_off) { - /* TODO: Hardcoding this here sucks, see the commit that added this */ - if (w == WARN_VOID_UNUSUAL) - return FALSE; - else - return TRUE; - } + if (isLEXWARN_off) + return TRUE; return ckwarn_common(w); } @@ -1975,13 +1965,8 @@ Perl_ckwarn_d(pTHX_ U32 w) static bool S_ckwarn_common(pTHX_ U32 w) { - if (PL_curcop->cop_warnings == pWARN_ALL) { - /* TODO: Hardcoding this here sucks, see the commit that added this */ - if (w == WARN_VOID_UNUSUAL) - return FALSE; - else - return TRUE; - } + if (PL_curcop->cop_warnings == pWARN_ALL) + return TRUE; if (PL_curcop->cop_warnings == pWARN_NONE) return FALSE; diff --git a/warnings.h b/warnings.h index 6a80096..cc3afc3 100644 --- a/warnings.h +++ b/warnings.h @@ -29,95 +29,92 @@ /* Warnings Categories added in Perl 5.008 */ -#define WARN_ALL 0 -#define WARN_CLOSURE 1 -#define WARN_DEPRECATED 2 -#define WARN_EXITING 3 -#define WARN_GLOB 4 -#define WARN_IO 5 -#define WARN_CLOSED 6 -#define WARN_EXEC 7 -#define WARN_LAYER 8 -#define WARN_NEWLINE 9 -#define WARN_PIPE 10 -#define WARN_UNOPENED 11 -#define WARN_MISC 12 -#define WARN_NUMERIC 13 -#define WARN_ONCE 14 -#define WARN_OVERFLOW 15 -#define WARN_PACK 16 -#define WARN_PORTABLE 17 -#define WARN_RECURSION 18 -#define WARN_REDEFINE 19 -#define WARN_REGEXP 20 -#define WARN_SEVERE 21 -#define WARN_DEBUGGING 22 -#define WARN_INPLACE 23 -#define WARN_INTERNAL 24 -#define WARN_MALLOC 25 -#define WARN_SIGNAL 26 -#define WARN_SUBSTR 27 -#define WARN_SYNTAX 28 -#define WARN_AMBIGUOUS 29 -#define WARN_BAREWORD 30 -#define WARN_DIGIT 31 -#define WARN_PARENTHESIS 32 -#define WARN_PRECEDENCE 33 -#define WARN_PRINTF 34 -#define WARN_PROTOTYPE 35 -#define WARN_QW 36 -#define WARN_RESERVED 37 -#define WARN_SEMICOLON 38 -#define WARN_TAINT 39 -#define WARN_THREADS 40 -#define WARN_UNINITIALIZED 41 -#define WARN_UNPACK 42 -#define WARN_UNTIE 43 -#define WARN_UTF8 44 -#define WARN_VOID 45 +#define WARN_ALL 0 +#define WARN_CLOSURE 1 +#define WARN_DEPRECATED 2 +#define WARN_EXITING 3 +#define WARN_GLOB 4 +#define WARN_IO 5 +#define WARN_CLOSED 6 +#define WARN_EXEC 7 +#define WARN_LAYER 8 +#define WARN_NEWLINE 9 +#define WARN_PIPE 10 +#define WARN_UNOPENED 11 +#define WARN_MISC 12 +#define WARN_NUMERIC 13 +#define WARN_ONCE 14 +#define WARN_OVERFLOW 15 +#define WARN_PACK 16 +#define WARN_PORTABLE 17 +#define WARN_RECURSION 18 +#define WARN_REDEFINE 19 +#define WARN_REGEXP 20 +#define WARN_SEVERE 21 +#define WARN_DEBUGGING 22 +#define WARN_INPLACE 23 +#define WARN_INTERNAL 24 +#define WARN_MALLOC 25 +#define WARN_SIGNAL 26 +#define WARN_SUBSTR 27 +#define WARN_SYNTAX 28 +#define WARN_AMBIGUOUS 29 +#define WARN_BAREWORD 30 +#define WARN_DIGIT 31 +#define WARN_PARENTHESIS 32 +#define WARN_PRECEDENCE 33 +#define WARN_PRINTF 34 +#define WARN_PROTOTYPE 35 +#define WARN_QW 36 +#define WARN_RESERVED 37 +#define WARN_SEMICOLON 38 +#define WARN_TAINT 39 +#define WARN_THREADS 40 +#define WARN_UNINITIALIZED 41 +#define WARN_UNPACK 42 +#define WARN_UNTIE 43 +#define WARN_UTF8 44 +#define WARN_VOID 45 /* Warnings Categories added in Perl 5.011 */ -#define WARN_IMPRECISION 46 -#define WARN_ILLEGALPROTO 47 +#define WARN_IMPRECISION 46 +#define WARN_ILLEGALPROTO 47 /* Warnings Categories added in Perl 5.013 */ -#define WARN_NON_UNICODE 48 -#define WARN_NONCHAR 49 -#define WARN_SURROGATE 50 +#define WARN_NON_UNICODE 48 +#define WARN_NONCHAR 49 +#define WARN_SURROGATE 50 /* Warnings Categories added in Perl 5.017 */ -#define WARN_EXPERIMENTAL 51 -#define WARN_EXPERIMENTAL__LEXICAL_SUBS 52 +#define WARN_EXPERIMENTAL 51 +#define WARN_EXPERIMENTAL__LEXICAL_SUBS 52 #define WARN_EXPERIMENTAL__LEXICAL_TOPIC 53 -#define WARN_EXPERIMENTAL__REGEX_SETS 54 -#define WARN_EXPERIMENTAL__SMARTMATCH 55 +#define WARN_EXPERIMENTAL__REGEX_SETS 54 +#define WARN_EXPERIMENTAL__SMARTMATCH 55 /* Warnings Categories added in Perl 5.019 */ -#define WARN_EXPERIMENTAL__AUTODEREF 56 -#define WARN_EXPERIMENTAL__POSTDEREF 57 -#define WARN_EXPERIMENTAL__SIGNATURES 58 -#define WARN_SYSCALLS 59 +#define WARN_EXPERIMENTAL__AUTODEREF 56 +#define WARN_EXPERIMENTAL__POSTDEREF 57 +#define WARN_EXPERIMENTAL__SIGNATURES 58 +#define WARN_SYSCALLS 59 /* Warnings Categories added in Perl 5.021 */ -#define WARN_EVERYTHING 60 -#define WARN_EXPERIMENTAL__CONST_ATTR 61 -#define WARN_EXPERIMENTAL__RE_STRICT 62 -#define WARN_EXPERIMENTAL__REFALIASING 63 -#define WARN_EXPERIMENTAL__WIN32_PERLIO 64 -#define WARN_LOCALE 65 -#define WARN_MISSING 66 -#define WARN_REDUNDANT 67 -#define WARN_EXTRA 68 -#define WARN_VOID_UNUSUAL 69 - -#define WARNsize 18 -#define WARN_ALLstring "\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" +#define WARN_EXPERIMENTAL__CONST_ATTR 60 +#define WARN_EXPERIMENTAL__RE_STRICT 61 +#define WARN_EXPERIMENTAL__REFALIASING 62 +#define WARN_EXPERIMENTAL__WIN32_PERLIO 63 +#define WARN_LOCALE 64 +#define WARN_MISSING 65 +#define WARN_REDUNDANT 66 + +#define WARNsize 17 +#define WARN_ALLstring "\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" #define isLEXWARN_on (PL_curcop->cop_warnings != pWARN_STD) #define isLEXWARN_off (PL_curcop->cop_warnings == pWARN_STD) -- 1.8.3.1