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