Filename | /usr/share/perl/5.18/warnings.pm |
Statements | Executed 603 statements in 1.22ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
43 | 32 | 31 | 263µs | 263µs | import | warnings::
3 | 1 | 1 | 259µs | 286µs | register_categories | warnings::
20 | 20 | 15 | 257µs | 257µs | unimport | warnings::
6 | 2 | 1 | 28µs | 28µs | _mkMask | warnings::
1 | 1 | 1 | 19µs | 19µs | CORE:regcomp (opcode) | warnings::
1 | 1 | 1 | 4µs | 4µ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.18'; | ||
9 | |||||
10 | # Verify that we're called correctly so that warnings will work. | ||||
11 | # see also strict.pm. | ||||
12 | 1 | 37µs | 2 | 23µs | unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { # spent 19µs making 1 call to warnings::CORE:regcomp
# spent 4µ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 | 19µs | our %Offsets = ( | ||
18 | |||||
19 | # Warnings Categories added in Perl 5.008 | ||||
20 | |||||
21 | 'all' => 0, | ||||
22 | 'closure' => 2, | ||||
23 | 'deprecated' => 4, | ||||
24 | 'exiting' => 6, | ||||
25 | 'glob' => 8, | ||||
26 | 'io' => 10, | ||||
27 | 'closed' => 12, | ||||
28 | 'exec' => 14, | ||||
29 | 'layer' => 16, | ||||
30 | 'newline' => 18, | ||||
31 | 'pipe' => 20, | ||||
32 | 'unopened' => 22, | ||||
33 | 'misc' => 24, | ||||
34 | 'numeric' => 26, | ||||
35 | 'once' => 28, | ||||
36 | 'overflow' => 30, | ||||
37 | 'pack' => 32, | ||||
38 | 'portable' => 34, | ||||
39 | 'recursion' => 36, | ||||
40 | 'redefine' => 38, | ||||
41 | 'regexp' => 40, | ||||
42 | 'severe' => 42, | ||||
43 | 'debugging' => 44, | ||||
44 | 'inplace' => 46, | ||||
45 | 'internal' => 48, | ||||
46 | 'malloc' => 50, | ||||
47 | 'signal' => 52, | ||||
48 | 'substr' => 54, | ||||
49 | 'syntax' => 56, | ||||
50 | 'ambiguous' => 58, | ||||
51 | 'bareword' => 60, | ||||
52 | 'digit' => 62, | ||||
53 | 'parenthesis' => 64, | ||||
54 | 'precedence' => 66, | ||||
55 | 'printf' => 68, | ||||
56 | 'prototype' => 70, | ||||
57 | 'qw' => 72, | ||||
58 | 'reserved' => 74, | ||||
59 | 'semicolon' => 76, | ||||
60 | 'taint' => 78, | ||||
61 | 'threads' => 80, | ||||
62 | 'uninitialized' => 82, | ||||
63 | 'unpack' => 84, | ||||
64 | 'untie' => 86, | ||||
65 | 'utf8' => 88, | ||||
66 | 'void' => 90, | ||||
67 | |||||
68 | # Warnings Categories added in Perl 5.011 | ||||
69 | |||||
70 | 'imprecision' => 92, | ||||
71 | 'illegalproto' => 94, | ||||
72 | |||||
73 | # Warnings Categories added in Perl 5.013 | ||||
74 | |||||
75 | 'non_unicode' => 96, | ||||
76 | 'nonchar' => 98, | ||||
77 | 'surrogate' => 100, | ||||
78 | |||||
79 | # Warnings Categories added in Perl 5.017 | ||||
80 | |||||
81 | 'experimental' => 102, | ||||
82 | 'experimental::lexical_subs'=> 104, | ||||
83 | 'experimental::lexical_topic'=> 106, | ||||
84 | 'experimental::regex_sets'=> 108, | ||||
85 | 'experimental::smartmatch'=> 110, | ||||
86 | ); | ||||
87 | |||||
88 | 1 | 25µs | our %Bits = ( | ||
89 | 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55", # [0..55] | ||||
90 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [29] | ||||
91 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00", # [30] | ||||
92 | 'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
93 | 'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
94 | 'debugging' => "\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
95 | 'deprecated' => "\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
96 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00", # [31] | ||||
97 | 'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
98 | 'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
99 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55", # [51..55] | ||||
100 | 'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [52] | ||||
101 | 'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [53] | ||||
102 | 'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [54] | ||||
103 | 'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40", # [55] | ||||
104 | 'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
105 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [47] | ||||
106 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [46] | ||||
107 | 'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
108 | 'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
109 | 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [5..11] | ||||
110 | 'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
111 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
112 | 'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
113 | 'newline' => "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
114 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [48] | ||||
115 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [49] | ||||
116 | 'numeric' => "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
117 | 'once' => "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
118 | 'overflow' => "\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
119 | 'pack' => "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
120 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00", # [32] | ||||
121 | 'pipe' => "\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
122 | 'portable' => "\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
123 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [33] | ||||
124 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [34] | ||||
125 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00", # [35] | ||||
126 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [36] | ||||
127 | 'recursion' => "\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
128 | 'redefine' => "\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
129 | 'regexp' => "\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
130 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [37] | ||||
131 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [38] | ||||
132 | 'severe' => "\x00\x00\x00\x00\x00\x54\x05\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
133 | 'signal' => "\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
134 | 'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
135 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [50] | ||||
136 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00", # [28..38,47] | ||||
137 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00", # [39] | ||||
138 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [40] | ||||
139 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [41] | ||||
140 | 'unopened' => "\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
141 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [42] | ||||
142 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [43] | ||||
143 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x15\x00", # [44,48..50] | ||||
144 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [45] | ||||
145 | ); | ||||
146 | |||||
147 | 1 | 20µs | our %DeadBits = ( | ||
148 | 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", # [0..55] | ||||
149 | 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00", # [29] | ||||
150 | 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00", # [30] | ||||
151 | 'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] | ||||
152 | 'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] | ||||
153 | 'debugging' => "\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00", # [22] | ||||
154 | 'deprecated' => "\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2] | ||||
155 | 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00", # [31] | ||||
156 | 'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7] | ||||
157 | 'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3] | ||||
158 | 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa", # [51..55] | ||||
159 | 'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [52] | ||||
160 | 'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [53] | ||||
161 | 'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [54] | ||||
162 | 'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80", # [55] | ||||
163 | 'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4] | ||||
164 | 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [47] | ||||
165 | 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [46] | ||||
166 | 'inplace' => "\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00", # [23] | ||||
167 | 'internal' => "\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00", # [24] | ||||
168 | 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [5..11] | ||||
169 | 'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] | ||||
170 | 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00", # [25] | ||||
171 | 'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] | ||||
172 | 'newline' => "\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] | ||||
173 | 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [48] | ||||
174 | 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [49] | ||||
175 | 'numeric' => "\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13] | ||||
176 | 'once' => "\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14] | ||||
177 | 'overflow' => "\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15] | ||||
178 | 'pack' => "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16] | ||||
179 | 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00", # [32] | ||||
180 | 'pipe' => "\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10] | ||||
181 | 'portable' => "\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17] | ||||
182 | 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [33] | ||||
183 | 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [34] | ||||
184 | 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00", # [35] | ||||
185 | 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [36] | ||||
186 | 'recursion' => "\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18] | ||||
187 | 'redefine' => "\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19] | ||||
188 | 'regexp' => "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [20] | ||||
189 | 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [37] | ||||
190 | 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [38] | ||||
191 | 'severe' => "\x00\x00\x00\x00\x00\xa8\x0a\x00\x00\x00\x00\x00\x00\x00", # [21..25] | ||||
192 | 'signal' => "\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [26] | ||||
193 | 'substr' => "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [27] | ||||
194 | 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [50] | ||||
195 | 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00", # [28..38,47] | ||||
196 | 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00", # [39] | ||||
197 | 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [40] | ||||
198 | 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [41] | ||||
199 | 'unopened' => "\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11] | ||||
200 | 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [42] | ||||
201 | 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [43] | ||||
202 | 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x2a\x00", # [44,48..50] | ||||
203 | 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [45] | ||||
204 | ); | ||||
205 | |||||
206 | 1 | 400ns | $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; | ||
207 | 1 | 3µs | $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55", # [2,52..55,4,22,23,25] | ||
208 | $LAST_BIT = 112 ; | ||||
209 | 1 | 300ns | $BYTES = 14 ; | ||
210 | |||||
211 | 2 | 8µs | $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; | ||
212 | |||||
213 | sub Croaker | ||||
214 | { | ||||
215 | require Carp; # this initializes %CarpInternal | ||||
216 | local $Carp::CarpInternal{'warnings'}; | ||||
217 | delete $Carp::CarpInternal{'warnings'}; | ||||
218 | Carp::croak(@_); | ||||
219 | } | ||||
220 | |||||
221 | sub _bits { | ||||
222 | my $mask = shift ; | ||||
223 | my $catmask ; | ||||
224 | my $fatal = 0 ; | ||||
225 | my $no_fatal = 0 ; | ||||
226 | |||||
227 | foreach my $word ( @_ ) { | ||||
228 | if ($word eq 'FATAL') { | ||||
229 | $fatal = 1; | ||||
230 | $no_fatal = 0; | ||||
231 | } | ||||
232 | elsif ($word eq 'NONFATAL') { | ||||
233 | $fatal = 0; | ||||
234 | $no_fatal = 1; | ||||
235 | } | ||||
236 | elsif ($catmask = $Bits{$word}) { | ||||
237 | $mask |= $catmask ; | ||||
238 | $mask |= $DeadBits{$word} if $fatal ; | ||||
239 | $mask &= ~($DeadBits{$word}|$All) if $no_fatal ; | ||||
240 | } | ||||
241 | else | ||||
242 | { Croaker("Unknown warnings category '$word'")} | ||||
243 | } | ||||
244 | |||||
245 | return $mask ; | ||||
246 | } | ||||
247 | |||||
248 | sub bits | ||||
249 | { | ||||
250 | # called from B::Deparse.pm | ||||
251 | push @_, 'all' unless @_ ; | ||||
252 | return _bits(undef, @_) ; | ||||
253 | } | ||||
254 | |||||
255 | sub import | ||||
256 | # spent 263µs within warnings::import which was called 43 times, avg 6µs/call:
# 11 times (63µs+0s) by Moo::_strictures::import at line 14 of Moo/_strictures.pm, avg 6µs/call
# 2 times (12µs+0s) by Moo::import at line 26 of Moo.pm, avg 6µs/call
# once (12µs+0s) by main::BEGIN@3 at line 3 of index.cgi
# once (9µs+0s) by Data::GUID::BEGIN@3 at line 3 of Sub/Exporter.pm
# once (9µs+0s) by Sub::Name::BEGIN@54 at line 54 of Sub/Name.pm
# once (7µs+0s) by namespace::clean::BEGIN@3 at line 3 of namespace/clean.pm
# once (7µs+0s) by namespace::clean::_Util::BEGIN@12 at line 12 of namespace/clean/_Util.pm
# once (7µs+0s) by Devel::GlobalDestruction::BEGIN@4 at line 4 of Devel/GlobalDestruction.pm
# once (7µs+0s) by overloading::BEGIN@2 at line 2 of overloading.pm
# once (6µs+0s) by Unicode::Normalize::BEGIN@11 at line 11 of Unicode/Normalize.pm
# once (6µs+0s) by Moo::BEGIN@2 at line 2 of Class/Method/Modifiers.pm
# once (6µs+0s) by Package::Stash::XS::BEGIN@9 at line 9 of Package/Stash/XS.pm
# once (6µs+0s) by Sub::Exporter::BEGIN@2 at line 2 of Data/OptList.pm
# once (6µs+0s) by List::Util::BEGIN@10 at line 10 of List/Util.pm
# once (6µs+0s) by B::Hooks::EndOfScope::XS::BEGIN@5 at line 5 of B/Hooks/EndOfScope/XS.pm
# once (6µs+0s) by Class::XSAccessor::BEGIN@4 at line 4 of Class/XSAccessor.pm
# once (6µs+0s) by Class::XSAccessor::Heavy::BEGIN@6 at line 6 of Class/XSAccessor/Heavy.pm
# once (6µs+0s) by Data::GUID::BEGIN@2 at line 2 of Sub/Install.pm
# once (6µs+0s) by String::Markov::BEGIN@2 at line 2 of namespace/autoclean.pm
# once (6µs+0s) by Variable::Magic::BEGIN@6 at line 6 of Variable/Magic.pm
# once (6µs+0s) by Moo::_strictures::BEGIN@3 at line 3 of Moo/_strictures.pm
# once (6µs+0s) by main::BEGIN@2.1 at line 2 of Data/GUID.pm
# once (6µs+0s) by Package::Stash::BEGIN@7 at line 7 of Package/Stash.pm
# once (6µs+0s) by Config::BEGIN@10 at line 10 of Config.pm
# once (5µs+0s) by Carp::BEGIN@5 at line 5 of Carp.pm
# once (5µs+0s) by B::Hooks::EndOfScope::BEGIN@6 at line 6 of B/Hooks/EndOfScope.pm
# once (5µs+0s) by Scalar::Util::BEGIN@10 at line 10 of Scalar/Util.pm
# once (5µs+0s) by mro::BEGIN@11 at line 11 of mro.pm
# once (5µs+0s) by Try::Tiny::BEGIN@10 at line 10 of Try/Tiny.pm
# once (5µs+0s) by Module::Implementation::BEGIN@6 at line 6 of Module/Implementation.pm
# once (5µs+0s) by Sub::Exporter::Progressive::BEGIN@4 at line 4 of Sub/Exporter/Progressive.pm
# once (5µs+0s) by Sub::Util::BEGIN@8 at line 8 of Sub/Util.pm | ||||
257 | 43 | 10µs | shift; | ||
258 | |||||
259 | 43 | 70µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
260 | |||||
261 | 43 | 49µs | if (vec($mask, $Offsets{'all'}, 1)) { | ||
262 | 1 | 800ns | $mask |= $Bits{'all'} ; | ||
263 | 1 | 900ns | $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); | ||
264 | } | ||||
265 | |||||
266 | # Empty @_ is equivalent to @_ = 'all' ; | ||||
267 | 43 | 278µs | ${^WARNING_BITS} = @_ ? _bits($mask, @_) : $mask | $Bits{all} ; | ||
268 | } | ||||
269 | |||||
270 | sub unimport | ||||
271 | # spent 257µs within warnings::unimport which was called 20 times, avg 13µs/call:
# once (18µs+0s) by Sub::Quote::BEGIN@16 at line 16 of (eval 33)[Sub/Quote.pm:3]
# once (14µs+0s) by Sub::Defer::BEGIN@27 at line 27 of Sub/Defer.pm
# once (14µs+0s) by Module::Implementation::BEGIN@129 at line 129 of Module/Implementation.pm
# once (14µs+0s) by Class::XSAccessor::Heavy::BEGIN@30 at line 30 of Class/XSAccessor/Heavy.pm
# once (14µs+0s) by Class::XSAccessor::BEGIN@84 at line 84 of Class/XSAccessor.pm
# once (14µs+0s) by Carp::BEGIN@434 at line 434 of Carp.pm
# once (14µs+0s) by Moo::HandleMoose::_TypeMap::BEGIN@21 at line 21 of Moo/HandleMoose/_TypeMap.pm
# once (14µs+0s) by Moo::_Utils::BEGIN@90 at line 90 of Moo/_Utils.pm
# once (13µs+0s) by Moo::BEGIN@112 at line 112 of Moo.pm
# once (13µs+0s) by Devel::GlobalDestruction::BEGIN@23 at line 23 of Devel/GlobalDestruction.pm
# once (13µs+0s) by Class::Method::Modifiers::BEGIN@150 at line 150 of Class/Method/Modifiers.pm
# once (13µs+0s) by Moo::Object::BEGIN@65 at line 65 of Moo/Object.pm
# once (13µs+0s) by Unicode::Normalize::BEGIN@14 at line 14 of Unicode/Normalize.pm
# once (13µs+0s) by Sub::Quote::BEGIN@4 at line 4 of (eval 13)[Sub/Quote.pm:3]
# once (12µs+0s) by Moo::sification::BEGIN@4 at line 4 of Moo/sification.pm
# once (12µs+0s) by Class::Method::Modifiers::BEGIN@204 at line 204 of Class/Method/Modifiers.pm
# once (11µs+0s) by Moo::_Utils::BEGIN@3 at line 3 of Moo/_Utils.pm
# once (11µs+0s) by Carp::BEGIN@441 at line 441 of Carp.pm
# once (10µs+0s) by Moo::_Utils::BEGIN@97 at line 97 of Moo/_Utils.pm
# once (8µs+0s) by Class::Method::Modifiers::BEGIN@151 at line 151 of Class/Method/Modifiers.pm | ||||
272 | 20 | 5µs | shift; | ||
273 | |||||
274 | 20 | 5µs | my $catmask ; | ||
275 | 20 | 48µs | my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ; | ||
276 | |||||
277 | 20 | 29µs | if (vec($mask, $Offsets{'all'}, 1)) { | ||
278 | 15 | 11µs | $mask |= $Bits{'all'} ; | ||
279 | 15 | 13µs | $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); | ||
280 | } | ||||
281 | |||||
282 | 20 | 9µs | push @_, 'all' unless @_; | ||
283 | |||||
284 | 20 | 25µs | foreach my $word ( @_ ) { | ||
285 | 20 | 66µs | if ($word eq 'FATAL') { | ||
286 | next; | ||||
287 | } | ||||
288 | elsif ($catmask = $Bits{$word}) { | ||||
289 | $mask &= ~($catmask | $DeadBits{$word} | $All); | ||||
290 | } | ||||
291 | else | ||||
292 | { Croaker("Unknown warnings category '$word'")} | ||||
293 | } | ||||
294 | |||||
295 | 20 | 145µs | ${^WARNING_BITS} = $mask ; | ||
296 | } | ||||
297 | |||||
298 | 2 | 7µs | my %builtin_type; @builtin_type{qw(SCALAR ARRAY HASH CODE REF GLOB LVALUE Regexp)} = (); | ||
299 | |||||
300 | sub MESSAGE () { 4 }; | ||||
301 | sub FATAL () { 2 }; | ||||
302 | sub NORMAL () { 1 }; | ||||
303 | |||||
304 | sub __chk | ||||
305 | { | ||||
306 | my $category ; | ||||
307 | my $offset ; | ||||
308 | my $isobj = 0 ; | ||||
309 | my $wanted = shift; | ||||
310 | my $has_message = $wanted & MESSAGE; | ||||
311 | |||||
312 | unless (@_ == 1 || @_ == ($has_message ? 2 : 0)) { | ||||
313 | my $sub = (caller 1)[3]; | ||||
314 | my $syntax = $has_message ? "[category,] 'message'" : '[category]'; | ||||
315 | Croaker("Usage: $sub($syntax)"); | ||||
316 | } | ||||
317 | |||||
318 | my $message = pop if $has_message; | ||||
319 | |||||
320 | if (@_) { | ||||
321 | # check the category supplied. | ||||
322 | $category = shift ; | ||||
323 | if (my $type = ref $category) { | ||||
324 | Croaker("not an object") | ||||
325 | if exists $builtin_type{$type}; | ||||
326 | $category = $type; | ||||
327 | $isobj = 1 ; | ||||
328 | } | ||||
329 | $offset = $Offsets{$category}; | ||||
330 | Croaker("Unknown warnings category '$category'") | ||||
331 | unless defined $offset; | ||||
332 | } | ||||
333 | else { | ||||
334 | $category = (caller(1))[0] ; | ||||
335 | $offset = $Offsets{$category}; | ||||
336 | Croaker("package '$category' not registered for warnings") | ||||
337 | unless defined $offset ; | ||||
338 | } | ||||
339 | |||||
340 | my $i; | ||||
341 | |||||
342 | if ($isobj) { | ||||
343 | my $pkg; | ||||
344 | $i = 2; | ||||
345 | while (do { { package DB; $pkg = (caller($i++))[0] } } ) { | ||||
346 | last unless @DB::args && $DB::args[0] =~ /^$category=/ ; | ||||
347 | } | ||||
348 | $i -= 2 ; | ||||
349 | } | ||||
350 | else { | ||||
351 | $i = _error_loc(); # see where Carp will allocate the error | ||||
352 | } | ||||
353 | |||||
354 | # Default to 0 if caller returns nothing. Default to $DEFAULT if it | ||||
355 | # explicitly returns undef. | ||||
356 | my(@callers_bitmask) = (caller($i))[9] ; | ||||
357 | my $callers_bitmask = | ||||
358 | @callers_bitmask ? $callers_bitmask[0] // $DEFAULT : 0 ; | ||||
359 | |||||
360 | my @results; | ||||
361 | foreach my $type (FATAL, NORMAL) { | ||||
362 | next unless $wanted & $type; | ||||
363 | |||||
364 | push @results, (vec($callers_bitmask, $offset + $type - 1, 1) || | ||||
365 | vec($callers_bitmask, $Offsets{'all'} + $type - 1, 1)); | ||||
366 | } | ||||
367 | |||||
368 | # &enabled and &fatal_enabled | ||||
369 | return $results[0] unless $has_message; | ||||
370 | |||||
371 | # &warnif, and the category is neither enabled as warning nor as fatal | ||||
372 | return if $wanted == (NORMAL | FATAL | MESSAGE) | ||||
373 | && !($results[0] || $results[1]); | ||||
374 | |||||
375 | require Carp; | ||||
376 | Carp::croak($message) if $results[0]; | ||||
377 | # will always get here for &warn. will only get here for &warnif if the | ||||
378 | # category is enabled | ||||
379 | Carp::carp($message); | ||||
380 | } | ||||
381 | |||||
382 | sub _mkMask | ||||
383 | { | ||||
384 | 6 | 3µs | my ($bit) = @_; | ||
385 | 6 | 3µs | my $mask = ""; | ||
386 | |||||
387 | 6 | 10µs | vec($mask, $bit, 1) = 1; | ||
388 | 6 | 29µs | return $mask; | ||
389 | } | ||||
390 | |||||
391 | sub register_categories | ||||
392 | # spent 286µs (259+28) within warnings::register_categories which was called 3 times, avg 95µs/call:
# 3 times (259µs+28µs) by warnings::register::import at line 24 of warnings/register.pm, avg 95µs/call | ||||
393 | 3 | 2µs | my @names = @_; | ||
394 | |||||
395 | 3 | 12µs | for my $name (@names) { | ||
396 | 3 | 6µs | if (! defined $Bits{$name}) { | ||
397 | 3 | 9µs | 3 | 18µs | $Bits{$name} = _mkMask($LAST_BIT); # spent 18µs making 3 calls to warnings::_mkMask, avg 6µs/call |
398 | 3 | 5µs | vec($Bits{'all'}, $LAST_BIT, 1) = 1; | ||
399 | 3 | 3µs | $Offsets{$name} = $LAST_BIT ++; | ||
400 | 3 | 33µs | foreach my $k (keys %Bits) { | ||
401 | 174 | 163µs | vec($Bits{$k}, $LAST_BIT, 1) = 0; | ||
402 | } | ||||
403 | 3 | 7µs | 3 | 10µs | $DeadBits{$name} = _mkMask($LAST_BIT); # spent 10µs making 3 calls to warnings::_mkMask, avg 3µs/call |
404 | 3 | 5µs | vec($DeadBits{'all'}, $LAST_BIT++, 1) = 1; | ||
405 | } | ||||
406 | } | ||||
407 | } | ||||
408 | |||||
409 | sub _error_loc { | ||||
410 | require Carp; | ||||
411 | goto &Carp::short_error_loc; # don't introduce another stack frame | ||||
412 | } | ||||
413 | |||||
414 | sub enabled | ||||
415 | { | ||||
416 | return __chk(NORMAL, @_); | ||||
417 | } | ||||
418 | |||||
419 | sub fatal_enabled | ||||
420 | { | ||||
421 | return __chk(FATAL, @_); | ||||
422 | } | ||||
423 | |||||
424 | sub warn | ||||
425 | { | ||||
426 | return __chk(FATAL | MESSAGE, @_); | ||||
427 | } | ||||
428 | |||||
429 | sub warnif | ||||
430 | { | ||||
431 | return __chk(NORMAL | FATAL | MESSAGE, @_); | ||||
432 | } | ||||
433 | |||||
434 | # These are not part of any public interface, so we can delete them to save | ||||
435 | # space. | ||||
436 | 1 | 6µs | delete @warnings::{qw(NORMAL FATAL MESSAGE)}; | ||
437 | |||||
438 | 1 | 36µs | 1; | ||
439 | |||||
440 | # ex: set ro: | ||||
# spent 4µs within warnings::CORE:match which was called:
# once (4µs+0s) by main::BEGIN@3 at line 12 | |||||
# spent 19µs within warnings::CORE:regcomp which was called:
# once (19µs+0s) by main::BEGIN@3 at line 12 |