| Filename | /usr/share/perl/5.26/warnings.pm |
| Statements | Executed 223 statements in 863µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 1 | 1 | 217µs | 239µs | warnings::register_categories |
| 6 | 6 | 6 | 62µs | 62µs | warnings::import |
| 1 | 1 | 1 | 26µs | 26µs | warnings::CORE:match (opcode) |
| 4 | 2 | 1 | 22µs | 22µs | warnings::_mkMask |
| 1 | 1 | 1 | 17µs | 17µs | warnings::unimport |
| 0 | 0 | 0 | 0s | 0s | warnings::Croaker |
| 0 | 0 | 0 | 0s | 0s | warnings::__chk |
| 0 | 0 | 0 | 0s | 0s | warnings::_bits |
| 0 | 0 | 0 | 0s | 0s | warnings::_error_loc |
| 0 | 0 | 0 | 0s | 0s | warnings::bits |
| 0 | 0 | 0 | 0s | 0s | warnings::enabled |
| 0 | 0 | 0 | 0s | 0s | warnings::fatal_enabled |
| 0 | 0 | 0 | 0s | 0s | warnings::warn |
| 0 | 0 | 0 | 0s | 0s | warnings::warnif |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # -*- buffer-read-only: t -*- | ||||
| 2 | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!! | ||||
| 3 | # This file is built by regen/warnings.pl. | ||||
| 4 | # Any changes made here will be lost! | ||||
| 5 | |||||
| 6 | package warnings; | ||||
| 7 | |||||
| 8 | 1 | 2µs | our $VERSION = "1.37"; | ||
| 9 | |||||
| 10 | # Verify that we're called correctly so that warnings will work. | ||||
| 11 | # Can't use Carp, since Carp uses us! | ||||
| 12 | # String regexps because constant folding = smaller optree = less memory vs regexp literal | ||||
| 13 | # see also strict.pm. | ||||
| 14 | 1 | 60µs | 1 | 26µs | die sprintf "Incorrect use of pragma '%s' at %s line %d.\n", __PACKAGE__, +(caller)[1,2] # spent 26µs making 1 call to warnings::CORE:match |
| 15 | if __FILE__ !~ ( '(?x) \b '.__PACKAGE__.' \.pmc? \z' ) | ||||
| 16 | && __FILE__ =~ ( '(?x) \b (?i:'.__PACKAGE__.') \.pmc? \z' ); | ||||
| 17 | |||||
| 18 | 1 | 112µs | our %Offsets = ( | ||
| 19 | # Warnings Categories added in Perl 5.008 | ||||
| 20 | 'all' => 0, | ||||
| 21 | 'closure' => 2, | ||||
| 22 | 'deprecated' => 4, | ||||
| 23 | 'exiting' => 6, | ||||
| 24 | 'glob' => 8, | ||||
| 25 | 'io' => 10, | ||||
| 26 | 'closed' => 12, | ||||
| 27 | 'exec' => 14, | ||||
| 28 | 'layer' => 16, | ||||
| 29 | 'newline' => 18, | ||||
| 30 | 'pipe' => 20, | ||||
| 31 | 'unopened' => 22, | ||||
| 32 | 'misc' => 24, | ||||
| 33 | 'numeric' => 26, | ||||
| 34 | 'once' => 28, | ||||
| 35 | 'overflow' => 30, | ||||
| 36 | 'pack' => 32, | ||||
| 37 | 'portable' => 34, | ||||
| 38 | 'recursion' => 36, | ||||
| 39 | 'redefine' => 38, | ||||
| 40 | 'regexp' => 40, | ||||
| 41 | 'severe' => 42, | ||||
| 42 | 'debugging' => 44, | ||||
| 43 | 'inplace' => 46, | ||||
| 44 | 'internal' => 48, | ||||
| 45 | 'malloc' => 50, | ||||
| 46 | 'signal' => 52, | ||||
| 47 | 'substr' => 54, | ||||
| 48 | 'syntax' => 56, | ||||
| 49 | 'ambiguous' => 58, | ||||
| 50 | 'bareword' => 60, | ||||
| 51 | 'digit' => 62, | ||||
| 52 | 'parenthesis' => 64, | ||||
| 53 | 'precedence' => 66, | ||||
| 54 | 'printf' => 68, | ||||
| 55 | 'prototype' => 70, | ||||
| 56 | 'qw' => 72, | ||||
| 57 | 'reserved' => 74, | ||||
| 58 | 'semicolon' => 76, | ||||
| 59 | 'taint' => 78, | ||||
| 60 | 'threads' => 80, | ||||
| 61 | 'uninitialized' => 82, | ||||
| 62 | 'unpack' => 84, | ||||
| 63 | 'untie' => 86, | ||||
| 64 | 'utf8' => 88, | ||||
| 65 | 'void' => 90, | ||||
| 66 | |||||
| 67 | # Warnings Categories added in Perl 5.011 | ||||
| 68 | 'imprecision' => 92, | ||||
| 69 | 'illegalproto' => 94, | ||||
| 70 | |||||
| 71 | # Warnings Categories added in Perl 5.013 | ||||
| 72 | 'non_unicode' => 96, | ||||
| 73 | 'nonchar' => 98, | ||||
| 74 | 'surrogate' => 100, | ||||
| 75 | |||||
| 76 | # Warnings Categories added in Perl 5.017 | ||||
| 77 | 'experimental' => 102, | ||||
| 78 | 'experimental::lexical_subs' => 104, | ||||
| 79 | 'experimental::regex_sets' => 106, | ||||
| 80 | 'experimental::smartmatch' => 108, | ||||
| 81 | |||||
| 82 | # Warnings Categories added in Perl 5.019 | ||||
| 83 | 'experimental::postderef' => 110, | ||||
| 84 | 'experimental::signatures' => 112, | ||||
| 85 | 'syscalls' => 114, | ||||
| 86 | |||||
| 87 | # Warnings Categories added in Perl 5.021 | ||||
| 88 | 'experimental::bitwise' => 116, | ||||
| 89 | 'experimental::const_attr' => 118, | ||||
| 90 | 'experimental::re_strict' => 120, | ||||
| 91 | 'experimental::refaliasing' => 122, | ||||
| 92 | 'experimental::win32_perlio' => 124, | ||||
| 93 | 'locale' => 126, | ||||
| 94 | 'missing' => 128, | ||||
| 95 | 'redundant' => 130, | ||||
| 96 | |||||
| 97 | # Warnings Categories added in Perl 5.025 | ||||
| 98 | 'experimental::declared_refs' => 132, | ||||
| 99 | ); | ||||
| 100 | |||||
| 101 | 1 | 78µs | our %Bits = ( | ||
| 102 | 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15", # [0..66] | ||||
| 103 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] | ||||
| 104 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] | ||||
| 105 | 'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
| 106 | 'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
| 107 | 'debugging' => "\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
| 108 | 'deprecated' => "\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
| 109 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31] | ||||
| 110 | 'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
| 111 | 'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
| 112 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x51\x15\x10", # [51..56,58..62,66] | ||||
| 113 | 'experimental::bitwise' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [58] | ||||
| 114 | 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [59] | ||||
| 115 | 'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [66] | ||||
| 116 | 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [52] | ||||
| 117 | 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [55] | ||||
| 118 | 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [60] | ||||
| 119 | 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [61] | ||||
| 120 | 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [53] | ||||
| 121 | 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00", # [56] | ||||
| 122 | 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [54] | ||||
| 123 | 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [62] | ||||
| 124 | 'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
| 125 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00", # [47] | ||||
| 126 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [46] | ||||
| 127 | 'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
| 128 | 'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
| 129 | 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [5..11,57] | ||||
| 130 | 'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
| 131 | 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [63] | ||||
| 132 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
| 133 | 'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
| 134 | 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [64] | ||||
| 135 | 'newline' => "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
| 136 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [48] | ||||
| 137 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [49] | ||||
| 138 | 'numeric' => "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
| 139 | 'once' => "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
| 140 | 'overflow' => "\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
| 141 | 'pack' => "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
| 142 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [32] | ||||
| 143 | 'pipe' => "\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
| 144 | 'portable' => "\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
| 145 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [33] | ||||
| 146 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00", # [34] | ||||
| 147 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [35] | ||||
| 148 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00", # [36] | ||||
| 149 | 'recursion' => "\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
| 150 | 'redefine' => "\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
| 151 | 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [65] | ||||
| 152 | 'regexp' => "\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
| 153 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [37] | ||||
| 154 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [38] | ||||
| 155 | 'severe' => "\x00\x00\x00\x00\x00\x54\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
| 156 | 'signal' => "\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
| 157 | 'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
| 158 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [50] | ||||
| 159 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00\x00\x00\x00", # [28..38,47] | ||||
| 160 | 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [57] | ||||
| 161 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [39] | ||||
| 162 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00", # [40] | ||||
| 163 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [41] | ||||
| 164 | 'unopened' => "\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
| 165 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00", # [42] | ||||
| 166 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00", # [43] | ||||
| 167 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x15\x00\x00\x00\x00", # [44,48..50] | ||||
| 168 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [45] | ||||
| 169 | ); | ||||
| 170 | |||||
| 171 | 1 | 68µs | our %DeadBits = ( | ||
| 172 | 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x2a", # [0..66] | ||||
| 173 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] | ||||
| 174 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] | ||||
| 175 | 'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
| 176 | 'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
| 177 | 'debugging' => "\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
| 178 | 'deprecated' => "\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
| 179 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31] | ||||
| 180 | 'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
| 181 | 'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
| 182 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\xa2\x2a\x20", # [51..56,58..62,66] | ||||
| 183 | 'experimental::bitwise' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [58] | ||||
| 184 | 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [59] | ||||
| 185 | 'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [66] | ||||
| 186 | 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [52] | ||||
| 187 | 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [55] | ||||
| 188 | 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [60] | ||||
| 189 | 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [61] | ||||
| 190 | 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [53] | ||||
| 191 | 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00", # [56] | ||||
| 192 | 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [54] | ||||
| 193 | 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [62] | ||||
| 194 | 'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
| 195 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00", # [47] | ||||
| 196 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [46] | ||||
| 197 | 'inplace' => "\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
| 198 | 'internal' => "\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
| 199 | 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [5..11,57] | ||||
| 200 | 'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
| 201 | 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [63] | ||||
| 202 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
| 203 | 'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
| 204 | 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [64] | ||||
| 205 | 'newline' => "\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
| 206 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [48] | ||||
| 207 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [49] | ||||
| 208 | 'numeric' => "\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
| 209 | 'once' => "\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
| 210 | 'overflow' => "\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
| 211 | 'pack' => "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
| 212 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [32] | ||||
| 213 | 'pipe' => "\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
| 214 | 'portable' => "\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
| 215 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00", # [33] | ||||
| 216 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00", # [34] | ||||
| 217 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00", # [35] | ||||
| 218 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00", # [36] | ||||
| 219 | 'recursion' => "\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
| 220 | 'redefine' => "\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
| 221 | 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [65] | ||||
| 222 | 'regexp' => "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
| 223 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00", # [37] | ||||
| 224 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [38] | ||||
| 225 | 'severe' => "\x00\x00\x00\x00\x00\xa8\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
| 226 | 'signal' => "\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
| 227 | 'substr' => "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
| 228 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [50] | ||||
| 229 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00\x00\x00\x00", # [28..38,47] | ||||
| 230 | 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [57] | ||||
| 231 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [39] | ||||
| 232 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00", # [40] | ||||
| 233 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00", # [41] | ||||
| 234 | 'unopened' => "\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
| 235 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00", # [42] | ||||
| 236 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00", # [43] | ||||
| 237 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x2a\x00\x00\x00\x00", # [44,48..50] | ||||
| 238 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [45] | ||||
| 239 | ); | ||||
| 240 | |||||
| 241 | # These are used by various things, including our own tests | ||||
| 242 | 1 | 800ns | our $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; | ||
| 243 | 1 | 1µs | our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x51\x55\x10", # [2,4,22,23,25,52..56,58..63,66] | ||
| 244 | our $LAST_BIT = 134 ; | ||||
| 245 | 1 | 800ns | our $BYTES = 17 ; | ||
| 246 | |||||
| 247 | 2 | 21µs | our $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; | ||
| 248 | |||||
| 249 | sub Croaker | ||||
| 250 | { | ||||
| 251 | require Carp; # this initializes %CarpInternal | ||||
| 252 | local $Carp::CarpInternal{'warnings'}; | ||||
| 253 | delete $Carp::CarpInternal{'warnings'}; | ||||
| 254 | Carp::croak(@_); | ||||
| 255 | } | ||||
| 256 | |||||
| 257 | sub _bits { | ||||
| 258 | my $mask = shift ; | ||||
| 259 | my $catmask ; | ||||
| 260 | my $fatal = 0 ; | ||||
| 261 | my $no_fatal = 0 ; | ||||
| 262 | |||||
| 263 | foreach my $word ( @_ ) { | ||||
| 264 | if ($word eq 'FATAL') { | ||||
| 265 | $fatal = 1; | ||||
| 266 | $no_fatal = 0; | ||||
| 267 | } | ||||
| 268 | elsif ($word eq 'NONFATAL') { | ||||
| 269 | $fatal = 0; | ||||
| 270 | $no_fatal = 1; | ||||
| 271 | } | ||||
| 272 | elsif ($catmask = $Bits{$word}) { | ||||
| 273 | $mask |= $catmask ; | ||||
| 274 | $mask |= $DeadBits{$word} if $fatal ; | ||||
| 275 | $mask &= ~($DeadBits{$word}|$All) if $no_fatal ; | ||||
| 276 | } | ||||
| 277 | else | ||||
| 278 | { Croaker("Unknown warnings category '$word'")} | ||||
| 279 | } | ||||
| 280 | |||||
| 281 | return $mask ; | ||||
| 282 | } | ||||
| 283 | |||||
| 284 | sub bits | ||||
| 285 | { | ||||
| 286 | # called from B::Deparse.pm | ||||
| 287 | push @_, 'all' unless @_ ; | ||||
| 288 | return _bits(undef, @_) ; | ||||
| 289 | } | ||||
| 290 | |||||
| 291 | sub import | ||||
| 292 | # spent 62µs within warnings::import which was called 6 times, avg 10µs/call:
# once (29µs+0s) by main::BEGIN@26 at line 26 of /home/tmurray/proj/Game-Collisions/scripts/bench.pl
# once (11µs+0s) by Config::BEGIN@10 at line 10 of Config.pm
# once (6µs+0s) by Game::Collisions::AABB::BEGIN@28 at line 28 of /home/tmurray/proj/Game-Collisions/lib/Game/Collisions/AABB.pm
# once (6µs+0s) by Game::Collisions::BEGIN@27 at line 27 of /home/tmurray/proj/Game-Collisions/lib/Game/Collisions.pm
# once (5µs+0s) by List::Util::BEGIN@10 at line 10 of List/Util.pm
# once (4µs+0s) by Scalar::Util::BEGIN@10 at line 10 of Scalar/Util.pm | ||||
| 293 | 6 | 3µs | shift; | ||
| 294 | |||||
| 295 | 6 | 15µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
| 296 | |||||
| 297 | 6 | 9µs | if (vec($mask, $Offsets{'all'}, 1)) { | ||
| 298 | $mask |= $Bits{'all'} ; | ||||
| 299 | $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); | ||||
| 300 | } | ||||
| 301 | |||||
| 302 | # append 'all' when implied (after a lone "FATAL" or "NONFATAL") | ||||
| 303 | 6 | 5µs | push @_, 'all' if @_==1 && ( $_[0] eq 'FATAL' || $_[0] eq 'NONFATAL' ); | ||
| 304 | |||||
| 305 | # Empty @_ is equivalent to @_ = 'all' ; | ||||
| 306 | 6 | 57µs | ${^WARNING_BITS} = @_ ? _bits($mask, @_) : $mask | $Bits{all} ; | ||
| 307 | } | ||||
| 308 | |||||
| 309 | sub unimport | ||||
| 310 | # spent 17µs within warnings::unimport which was called:
# once (17µs+0s) by Exporter::Heavy::BEGIN@188 at line 188 of Exporter/Heavy.pm | ||||
| 311 | 1 | 400ns | shift; | ||
| 312 | |||||
| 313 | 1 | 400ns | my $catmask ; | ||
| 314 | 1 | 2µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
| 315 | |||||
| 316 | 1 | 2µs | if (vec($mask, $Offsets{'all'}, 1)) { | ||
| 317 | $mask |= $Bits{'all'} ; | ||||
| 318 | $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); | ||||
| 319 | } | ||||
| 320 | |||||
| 321 | # append 'all' when implied (empty import list or after a lone "FATAL") | ||||
| 322 | 1 | 2µs | push @_, 'all' if !@_ || @_==1 && $_[0] eq 'FATAL'; | ||
| 323 | |||||
| 324 | 1 | 1µs | foreach my $word ( @_ ) { | ||
| 325 | 1 | 6µs | if ($word eq 'FATAL') { | ||
| 326 | next; | ||||
| 327 | } | ||||
| 328 | elsif ($catmask = $Bits{$word}) { | ||||
| 329 | $mask &= ~($catmask | $DeadBits{$word} | $All); | ||||
| 330 | } | ||||
| 331 | else | ||||
| 332 | { Croaker("Unknown warnings category '$word'")} | ||||
| 333 | } | ||||
| 334 | |||||
| 335 | 1 | 10µs | ${^WARNING_BITS} = $mask ; | ||
| 336 | } | ||||
| 337 | |||||
| 338 | 2 | 11µs | my %builtin_type; @builtin_type{qw(SCALAR ARRAY HASH CODE REF GLOB LVALUE Regexp)} = (); | ||
| 339 | |||||
| 340 | sub MESSAGE () { 4 }; | ||||
| 341 | sub FATAL () { 2 }; | ||||
| 342 | sub NORMAL () { 1 }; | ||||
| 343 | |||||
| 344 | sub __chk | ||||
| 345 | { | ||||
| 346 | my $category ; | ||||
| 347 | my $offset ; | ||||
| 348 | my $isobj = 0 ; | ||||
| 349 | my $wanted = shift; | ||||
| 350 | my $has_message = $wanted & MESSAGE; | ||||
| 351 | |||||
| 352 | unless (@_ == 1 || @_ == ($has_message ? 2 : 0)) { | ||||
| 353 | my $sub = (caller 1)[3]; | ||||
| 354 | my $syntax = $has_message ? "[category,] 'message'" : '[category]'; | ||||
| 355 | Croaker("Usage: $sub($syntax)"); | ||||
| 356 | } | ||||
| 357 | |||||
| 358 | my $message = pop if $has_message; | ||||
| 359 | |||||
| 360 | if (@_) { | ||||
| 361 | # check the category supplied. | ||||
| 362 | $category = shift ; | ||||
| 363 | if (my $type = ref $category) { | ||||
| 364 | Croaker("not an object") | ||||
| 365 | if exists $builtin_type{$type}; | ||||
| 366 | $category = $type; | ||||
| 367 | $isobj = 1 ; | ||||
| 368 | } | ||||
| 369 | $offset = $Offsets{$category}; | ||||
| 370 | Croaker("Unknown warnings category '$category'") | ||||
| 371 | unless defined $offset; | ||||
| 372 | } | ||||
| 373 | else { | ||||
| 374 | $category = (caller(1))[0] ; | ||||
| 375 | $offset = $Offsets{$category}; | ||||
| 376 | Croaker("package '$category' not registered for warnings") | ||||
| 377 | unless defined $offset ; | ||||
| 378 | } | ||||
| 379 | |||||
| 380 | my $i; | ||||
| 381 | |||||
| 382 | if ($isobj) { | ||||
| 383 | my $pkg; | ||||
| 384 | $i = 2; | ||||
| 385 | while (do { { package DB; $pkg = (caller($i++))[0] } } ) { | ||||
| 386 | last unless @DB::args && $DB::args[0] =~ /^$category=/ ; | ||||
| 387 | } | ||||
| 388 | $i -= 2 ; | ||||
| 389 | } | ||||
| 390 | else { | ||||
| 391 | $i = _error_loc(); # see where Carp will allocate the error | ||||
| 392 | } | ||||
| 393 | |||||
| 394 | # Default to 0 if caller returns nothing. Default to $DEFAULT if it | ||||
| 395 | # explicitly returns undef. | ||||
| 396 | my(@callers_bitmask) = (caller($i))[9] ; | ||||
| 397 | my $callers_bitmask = | ||||
| 398 | @callers_bitmask ? $callers_bitmask[0] // $DEFAULT : 0 ; | ||||
| 399 | |||||
| 400 | my @results; | ||||
| 401 | foreach my $type (FATAL, NORMAL) { | ||||
| 402 | next unless $wanted & $type; | ||||
| 403 | |||||
| 404 | push @results, (vec($callers_bitmask, $offset + $type - 1, 1) || | ||||
| 405 | vec($callers_bitmask, $Offsets{'all'} + $type - 1, 1)); | ||||
| 406 | } | ||||
| 407 | |||||
| 408 | # &enabled and &fatal_enabled | ||||
| 409 | return $results[0] unless $has_message; | ||||
| 410 | |||||
| 411 | # &warnif, and the category is neither enabled as warning nor as fatal | ||||
| 412 | return if $wanted == (NORMAL | FATAL | MESSAGE) | ||||
| 413 | && !($results[0] || $results[1]); | ||||
| 414 | |||||
| 415 | require Carp; | ||||
| 416 | Carp::croak($message) if $results[0]; | ||||
| 417 | # will always get here for &warn. will only get here for &warnif if the | ||||
| 418 | # category is enabled | ||||
| 419 | Carp::carp($message); | ||||
| 420 | } | ||||
| 421 | |||||
| 422 | sub _mkMask | ||||
| 423 | { | ||||
| 424 | 4 | 2µs | my ($bit) = @_; | ||
| 425 | 4 | 2µs | my $mask = ""; | ||
| 426 | |||||
| 427 | 4 | 11µs | vec($mask, $bit, 1) = 1; | ||
| 428 | 4 | 21µs | return $mask; | ||
| 429 | } | ||||
| 430 | |||||
| 431 | sub register_categories | ||||
| 432 | # spent 239µs (217+22) within warnings::register_categories which was called 2 times, avg 120µs/call:
# 2 times (217µs+22µs) by warnings::register::import at line 23 of warnings/register.pm, avg 120µs/call | ||||
| 433 | 2 | 2µs | my @names = @_; | ||
| 434 | |||||
| 435 | 2 | 9µs | for my $name (@names) { | ||
| 436 | 2 | 5µs | if (! defined $Bits{$name}) { | ||
| 437 | 2 | 6µs | 2 | 15µs | $Bits{$name} = _mkMask($LAST_BIT); # spent 15µs making 2 calls to warnings::_mkMask, avg 8µs/call |
| 438 | 2 | 4µs | vec($Bits{'all'}, $LAST_BIT, 1) = 1; | ||
| 439 | 2 | 3µs | $Offsets{$name} = $LAST_BIT ++; | ||
| 440 | 2 | 32µs | foreach my $k (keys %Bits) { | ||
| 441 | 137 | 138µs | vec($Bits{$k}, $LAST_BIT, 1) = 0; | ||
| 442 | } | ||||
| 443 | 2 | 4µs | 2 | 7µs | $DeadBits{$name} = _mkMask($LAST_BIT); # spent 7µs making 2 calls to warnings::_mkMask, avg 3µs/call |
| 444 | 2 | 3µs | vec($DeadBits{'all'}, $LAST_BIT++, 1) = 1; | ||
| 445 | } | ||||
| 446 | } | ||||
| 447 | } | ||||
| 448 | |||||
| 449 | sub _error_loc { | ||||
| 450 | require Carp; | ||||
| 451 | goto &Carp::short_error_loc; # don't introduce another stack frame | ||||
| 452 | } | ||||
| 453 | |||||
| 454 | sub enabled | ||||
| 455 | { | ||||
| 456 | return __chk(NORMAL, @_); | ||||
| 457 | } | ||||
| 458 | |||||
| 459 | sub fatal_enabled | ||||
| 460 | { | ||||
| 461 | return __chk(FATAL, @_); | ||||
| 462 | } | ||||
| 463 | |||||
| 464 | sub warn | ||||
| 465 | { | ||||
| 466 | return __chk(FATAL | MESSAGE, @_); | ||||
| 467 | } | ||||
| 468 | |||||
| 469 | sub warnif | ||||
| 470 | { | ||||
| 471 | return __chk(NORMAL | FATAL | MESSAGE, @_); | ||||
| 472 | } | ||||
| 473 | |||||
| 474 | # These are not part of any public interface, so we can delete them to save | ||||
| 475 | # space. | ||||
| 476 | 1 | 17µs | delete @warnings::{qw(NORMAL FATAL MESSAGE)}; | ||
| 477 | |||||
| 478 | 1 | 137µs | 1; | ||
| 479 | __END__ | ||||
# spent 26µs within warnings::CORE:match which was called:
# once (26µs+0s) by main::BEGIN@26 at line 14 |