Filename | /home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/5.22.1/warnings.pm |
Statements | Executed 809 statements in 1.48ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
7 | 2 | 2 | 531µs | 590µs | register_categories | warnings::
37 | 37 | 33 | 318µs | 318µs | import | warnings::
7 | 7 | 4 | 121µs | 121µs | unimport | warnings::
12 | 2 | 1 | 59µs | 59µs | _mkMask | warnings::
1 | 1 | 1 | 49µs | 49µs | CORE:regcomp (opcode) | warnings::
1 | 1 | 1 | 10µs | 10µs | CORE:match (opcode) | warnings::
0 | 0 | 0 | 0s | 0s | Croaker | warnings::
0 | 0 | 0 | 0s | 0s | __chk | warnings::
0 | 0 | 0 | 0s | 0s | _bits | warnings::
0 | 0 | 0 | 0s | 0s | _error_loc | warnings::
0 | 0 | 0 | 0s | 0s | bits | warnings::
0 | 0 | 0 | 0s | 0s | enabled | warnings::
0 | 0 | 0 | 0s | 0s | fatal_enabled | warnings::
0 | 0 | 0 | 0s | 0s | warn | warnings::
0 | 0 | 0 | 0s | 0s | warnif | warnings::
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 | 1µs | our $VERSION = "1.34"; | ||
9 | |||||
10 | # Verify that we're called correctly so that warnings will work. | ||||
11 | # see also strict.pm. | ||||
12 | 1 | 82µs | 2 | 58µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 49µs making 1 call to warnings::CORE:regcomp
# spent 10µs making 1 call to warnings::CORE:match |
13 | my (undef, $f, $l) = caller; | ||||
14 | die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n"); | ||||
15 | } | ||||
16 | |||||
17 | 1 | 38µs | our %Offsets = ( | ||
18 | # Warnings Categories added in Perl 5.008 | ||||
19 | 'all' => 0, | ||||
20 | 'closure' => 2, | ||||
21 | 'deprecated' => 4, | ||||
22 | 'exiting' => 6, | ||||
23 | 'glob' => 8, | ||||
24 | 'io' => 10, | ||||
25 | 'closed' => 12, | ||||
26 | 'exec' => 14, | ||||
27 | 'layer' => 16, | ||||
28 | 'newline' => 18, | ||||
29 | 'pipe' => 20, | ||||
30 | 'unopened' => 22, | ||||
31 | 'misc' => 24, | ||||
32 | 'numeric' => 26, | ||||
33 | 'once' => 28, | ||||
34 | 'overflow' => 30, | ||||
35 | 'pack' => 32, | ||||
36 | 'portable' => 34, | ||||
37 | 'recursion' => 36, | ||||
38 | 'redefine' => 38, | ||||
39 | 'regexp' => 40, | ||||
40 | 'severe' => 42, | ||||
41 | 'debugging' => 44, | ||||
42 | 'inplace' => 46, | ||||
43 | 'internal' => 48, | ||||
44 | 'malloc' => 50, | ||||
45 | 'signal' => 52, | ||||
46 | 'substr' => 54, | ||||
47 | 'syntax' => 56, | ||||
48 | 'ambiguous' => 58, | ||||
49 | 'bareword' => 60, | ||||
50 | 'digit' => 62, | ||||
51 | 'parenthesis' => 64, | ||||
52 | 'precedence' => 66, | ||||
53 | 'printf' => 68, | ||||
54 | 'prototype' => 70, | ||||
55 | 'qw' => 72, | ||||
56 | 'reserved' => 74, | ||||
57 | 'semicolon' => 76, | ||||
58 | 'taint' => 78, | ||||
59 | 'threads' => 80, | ||||
60 | 'uninitialized' => 82, | ||||
61 | 'unpack' => 84, | ||||
62 | 'untie' => 86, | ||||
63 | 'utf8' => 88, | ||||
64 | 'void' => 90, | ||||
65 | |||||
66 | # Warnings Categories added in Perl 5.011 | ||||
67 | 'imprecision' => 92, | ||||
68 | 'illegalproto' => 94, | ||||
69 | |||||
70 | # Warnings Categories added in Perl 5.013 | ||||
71 | 'non_unicode' => 96, | ||||
72 | 'nonchar' => 98, | ||||
73 | 'surrogate' => 100, | ||||
74 | |||||
75 | # Warnings Categories added in Perl 5.017 | ||||
76 | 'experimental' => 102, | ||||
77 | 'experimental::lexical_subs' => 104, | ||||
78 | 'experimental::lexical_topic' => 106, | ||||
79 | 'experimental::regex_sets' => 108, | ||||
80 | 'experimental::smartmatch' => 110, | ||||
81 | |||||
82 | # Warnings Categories added in Perl 5.019 | ||||
83 | 'experimental::autoderef' => 112, | ||||
84 | 'experimental::postderef' => 114, | ||||
85 | 'experimental::signatures' => 116, | ||||
86 | 'syscalls' => 118, | ||||
87 | |||||
88 | # Warnings Categories added in Perl 5.021 | ||||
89 | 'experimental::bitwise' => 120, | ||||
90 | 'experimental::const_attr' => 122, | ||||
91 | 'experimental::re_strict' => 124, | ||||
92 | 'experimental::refaliasing' => 126, | ||||
93 | 'experimental::win32_perlio' => 128, | ||||
94 | 'locale' => 130, | ||||
95 | 'missing' => 132, | ||||
96 | 'redundant' => 134, | ||||
97 | ); | ||||
98 | |||||
99 | 1 | 34µs | our %Bits = ( | ||
100 | 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55", # [0..67] | ||||
101 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] | ||||
102 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] | ||||
103 | 'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
104 | 'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
105 | 'debugging' => "\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
106 | 'deprecated' => "\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
107 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31] | ||||
108 | 'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
109 | 'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
110 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x15\x55\x01", # [51..58,60..64] | ||||
111 | 'experimental::autoderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00", # [56] | ||||
112 | 'experimental::bitwise' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [60] | ||||
113 | 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [61] | ||||
114 | 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [52] | ||||
115 | 'experimental::lexical_topic' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [53] | ||||
116 | 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [57] | ||||
117 | 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [62] | ||||
118 | 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [63] | ||||
119 | 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [54] | ||||
120 | 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [58] | ||||
121 | 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [55] | ||||
122 | 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [64] | ||||
123 | 'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
124 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00", # [47] | ||||
125 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [46] | ||||
126 | 'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
127 | 'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
128 | 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [5..11,59] | ||||
129 | 'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
130 | 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [65] | ||||
131 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
132 | 'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
133 | 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [66] | ||||
134 | 'newline' => "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
135 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [48] | ||||
136 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [49] | ||||
137 | 'numeric' => "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
138 | 'once' => "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
139 | 'overflow' => "\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
140 | 'pack' => "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
141 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [32] | ||||
142 | 'pipe' => "\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
143 | 'portable' => "\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
144 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [33] | ||||
145 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00", # [34] | ||||
146 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [35] | ||||
147 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00", # [36] | ||||
148 | 'recursion' => "\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
149 | 'redefine' => "\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
150 | 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40", # [67] | ||||
151 | 'regexp' => "\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
152 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [37] | ||||
153 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [38] | ||||
154 | 'severe' => "\x00\x00\x00\x00\x00\x54\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
155 | 'signal' => "\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
156 | 'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
157 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [50] | ||||
158 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00\x00\x00\x00", # [28..38,47] | ||||
159 | 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [59] | ||||
160 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [39] | ||||
161 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00", # [40] | ||||
162 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [41] | ||||
163 | 'unopened' => "\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
164 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00", # [42] | ||||
165 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00", # [43] | ||||
166 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x15\x00\x00\x00\x00", # [44,48..50] | ||||
167 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [45] | ||||
168 | ); | ||||
169 | |||||
170 | 1 | 24µs | our %DeadBits = ( | ||
171 | 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", # [0..67] | ||||
172 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29] | ||||
173 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30] | ||||
174 | 'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
175 | 'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
176 | 'debugging' => "\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
177 | 'deprecated' => "\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
178 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31] | ||||
179 | 'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
180 | 'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
181 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\x2a\xaa\x02", # [51..58,60..64] | ||||
182 | 'experimental::autoderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00", # [56] | ||||
183 | 'experimental::bitwise' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [60] | ||||
184 | 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [61] | ||||
185 | 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [52] | ||||
186 | 'experimental::lexical_topic' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [53] | ||||
187 | 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [57] | ||||
188 | 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [62] | ||||
189 | 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [63] | ||||
190 | 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [54] | ||||
191 | 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [58] | ||||
192 | 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [55] | ||||
193 | 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [64] | ||||
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\x80\x00\x00", # [5..11,59] | ||||
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\x00\x08", # [65] | ||||
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\x20", # [66] | ||||
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\x80", # [67] | ||||
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\x80\x00\x00", # [59] | ||||
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 | 400ns | our $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; | ||
243 | 1 | 400ns | our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x15\x55\x05", # [2,56,60,61,52,53,57,62,63,54,58,55,64,4,65,22,23,25] | ||
244 | our $LAST_BIT = 136 ; | ||||
245 | 1 | 100ns | our $BYTES = 17 ; | ||
246 | |||||
247 | 2 | 8µ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 318µs within warnings::import which was called 37 times, avg 9µs/call:
# once (22µs+0s) by DateTime::Locale::BEGIN@6 at line 6 of DateTime/Locale.pm
# once (17µs+0s) by experimental::BEGIN@4 at line 4 of experimental.pm
# once (13µs+0s) by DateTime::Format::Alami::EN::BEGIN@8 at line 8 of DateTime/Format/Alami/EN.pm
# once (13µs+0s) by Role::Tiny::With::BEGIN@4 at line 4 of Role/Tiny/With.pm
# once (11µs+0s) by DateTime::Locale::FromData::BEGIN@4 at line 4 of DateTime/Locale/FromData.pm
# once (11µs+0s) by Role::Tiny::import at line 54 of Role/Tiny.pm
# once (9µs+0s) by DateTime::Infinite::Future::BEGIN@73 at line 73 of DateTime/Infinite.pm
# once (9µs+0s) by Role::Tiny::BEGIN@7 at line 7 of Role/Tiny.pm
# once (9µs+0s) by Carp::BEGIN@5 at line 5 of Carp.pm
# once (9µs+0s) by DateTime::BEGIN@6 at line 6 of DateTime.pm
# once (9µs+0s) by overloading::BEGIN@2 at line 2 of overloading.pm
# once (9µs+0s) by DateTime::Infinite::BEGIN@4 at line 4 of DateTime/Infinite.pm
# once (8µs+0s) by DateTime::TimeZone::UTC::BEGIN@4 at line 4 of DateTime/TimeZone/UTC.pm
# once (8µs+0s) by DateTime::Format::Alami::BEGIN@8 at line 8 of DateTime/Format/Alami.pm
# once (8µs+0s) by DateTime::Helpers::BEGIN@4 at line 4 of DateTime/Helpers.pm
# once (8µs+0s) by POSIX::BEGIN@3 at line 3 of POSIX.pm
# once (8µs+0s) by Params::Validate::Constants::BEGIN@4 at line 4 of Params/Validate/Constants.pm
# once (8µs+0s) by Scalar::Util::BEGIN@10 at line 10 of Scalar/Util.pm
# once (8µs+0s) by DateTime::Duration::BEGIN@4 at line 4 of DateTime/Duration.pm
# once (8µs+0s) by DateTime::TimeZone::Local::BEGIN@4 at line 4 of DateTime/TimeZone/Local.pm
# once (8µs+0s) by Params::Validate::XS::BEGIN@4 at line 4 of Params/Validate/XS.pm
# once (7µs+0s) by Parse::Number::EN::BEGIN@10 at line 10 of Parse/Number/EN.pm
# once (7µs+0s) by Try::Tiny::BEGIN@8 at line 8 of Try/Tiny.pm
# once (7µs+0s) by Class::Singleton::BEGIN@20 at line 20 of Class/Singleton.pm
# once (7µs+0s) by re::BEGIN@5 at line 5 of re.pm
# once (7µs+0s) by DateTime::TimeZone::OlsonDB::Change::BEGIN@4 at line 4 of DateTime/TimeZone/OlsonDB/Change.pm
# once (7µs+0s) by DateTime::Infinite::Past::BEGIN@98 at line 98 of DateTime/Infinite.pm
# once (7µs+0s) by DateTime::TimeZone::OffsetOnly::BEGIN@4 at line 4 of DateTime/TimeZone/OffsetOnly.pm
# once (6µs+0s) by Sub::Util::BEGIN@8 at line 8 of Sub/Util.pm
# once (6µs+0s) by DateTime::Locale::Util::BEGIN@4 at line 4 of DateTime/Locale/Util.pm
# once (6µs+0s) by Module::Implementation::BEGIN@6 at line 6 of Module/Implementation.pm
# once (6µs+0s) by Params::Validate::BEGIN@6 at line 6 of Params/Validate.pm
# once (6µs+0s) by List::Util::BEGIN@10 at line 10 of List/Util.pm
# once (6µs+0s) by FakeLocale::BEGIN@124 at line 124 of DateTime/Infinite.pm
# once (6µs+0s) by DateTime::Locale::Data::BEGIN@18 at line 18 of DateTime/Locale/Data.pm
# once (6µs+0s) by DateTime::TimeZone::BEGIN@6 at line 6 of DateTime/TimeZone.pm
# once (6µs+0s) by DateTime::TimeZone::Floating::BEGIN@4 at line 4 of DateTime/TimeZone/Floating.pm | ||||
293 | 37 | 9µs | shift; | ||
294 | |||||
295 | 37 | 81µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
296 | |||||
297 | 37 | 52µs | if (vec($mask, $Offsets{'all'}, 1)) { | ||
298 | 4 | 4µs | $mask |= $Bits{'all'} ; | ||
299 | 4 | 4µs | $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); | ||
300 | } | ||||
301 | |||||
302 | # append 'all' when implied (after a lone "FATAL" or "NONFATAL") | ||||
303 | 37 | 21µs | push @_, 'all' if @_==1 && ( $_[0] eq 'FATAL' || $_[0] eq 'NONFATAL' ); | ||
304 | |||||
305 | # Empty @_ is equivalent to @_ = 'all' ; | ||||
306 | 37 | 295µs | ${^WARNING_BITS} = @_ ? _bits($mask, @_) : $mask | $Bits{all} ; | ||
307 | } | ||||
308 | |||||
309 | sub unimport | ||||
310 | # spent 121µs within warnings::unimport which was called 7 times, avg 17µs/call:
# once (24µs+0s) by Role::Tiny::BEGIN@27 at line 27 of Role/Tiny.pm
# once (19µs+0s) by Carp::BEGIN@6 at line 24 of Carp.pm
# once (17µs+0s) by Module::Implementation::BEGIN@129 at line 129 of Module/Implementation.pm
# once (16µs+0s) by Role::Tiny::BEGIN@379 at line 379 of Role/Tiny.pm
# once (16µs+0s) by experimental::_enable at line 56 of experimental.pm
# once (15µs+0s) by Role::Tiny::BEGIN@453 at line 453 of Role/Tiny.pm
# once (14µs+0s) by Carp::BEGIN@603 at line 603 of Carp.pm | ||||
311 | 7 | 2µs | shift; | ||
312 | |||||
313 | 7 | 2µs | my $catmask ; | ||
314 | 7 | 23µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
315 | |||||
316 | 7 | 11µs | if (vec($mask, $Offsets{'all'}, 1)) { | ||
317 | 6 | 6µs | $mask |= $Bits{'all'} ; | ||
318 | 6 | 7µs | $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 | 7 | 12µs | push @_, 'all' if !@_ || @_==1 && $_[0] eq 'FATAL'; | ||
323 | |||||
324 | 7 | 8µs | foreach my $word ( @_ ) { | ||
325 | 7 | 29µ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 | 7 | 55µs | ${^WARNING_BITS} = $mask ; | ||
336 | } | ||||
337 | |||||
338 | 2 | 6µ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 | 12 | 6µs | my ($bit) = @_; | ||
425 | 12 | 4µs | my $mask = ""; | ||
426 | |||||
427 | 12 | 27µs | vec($mask, $bit, 1) = 1; | ||
428 | 12 | 54µs | return $mask; | ||
429 | } | ||||
430 | |||||
431 | sub register_categories | ||||
432 | # spent 590µs (531+59) within warnings::register_categories which was called 7 times, avg 84µs/call:
# 6 times (525µs+59µs) by warnings::register::import at line 23 of warnings/register.pm, avg 97µs/call
# once (7µs+0s) by experimental::BEGIN@5 at line 7 of version.pm | ||||
433 | 7 | 8µs | my @names = @_; | ||
434 | |||||
435 | 7 | 39µs | for my $name (@names) { | ||
436 | 7 | 13µs | if (! defined $Bits{$name}) { | ||
437 | 6 | 16µs | 6 | 38µs | $Bits{$name} = _mkMask($LAST_BIT); # spent 38µs making 6 calls to warnings::_mkMask, avg 6µs/call |
438 | 6 | 11µs | vec($Bits{'all'}, $LAST_BIT, 1) = 1; | ||
439 | 6 | 6µs | $Offsets{$name} = $LAST_BIT ++; | ||
440 | 6 | 78µs | foreach my $k (keys %Bits) { | ||
441 | 429 | 322µs | vec($Bits{$k}, $LAST_BIT, 1) = 0; | ||
442 | } | ||||
443 | 6 | 13µs | 6 | 20µs | $DeadBits{$name} = _mkMask($LAST_BIT); # spent 20µs making 6 calls to warnings::_mkMask, avg 3µs/call |
444 | 6 | 10µ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 | 8µs | delete @warnings::{qw(NORMAL FATAL MESSAGE)}; | ||
477 | |||||
478 | 1 | 51µs | 1; | ||
479 | __END__ | ||||
# spent 10µs within warnings::CORE:match which was called:
# once (10µs+0s) by DateTime::Format::Alami::EN::BEGIN@8 at line 12 | |||||
# spent 49µs within warnings::CORE:regcomp which was called:
# once (49µs+0s) by DateTime::Format::Alami::EN::BEGIN@8 at line 12 |