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!
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
14 die sprintf "Incorrect use of pragma '%s' at %s line %d.\n", __PACKAGE__, +(caller)[1,2]
15 if __FILE__ !~ ( '(?x) \b '.__PACKAGE__.' \.pmc? \z' )
16 && __FILE__ =~ ( '(?x) \b (?i:'.__PACKAGE__.') \.pmc? \z' );
19 # Warnings Categories added in Perl 5.008
61 'uninitialized' => 82,
67 # Warnings Categories added in Perl 5.011
71 # Warnings Categories added in Perl 5.013
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,
82 # Warnings Categories added in Perl 5.019
83 'experimental::postderef' => 110,
84 'experimental::signatures' => 112,
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,
97 # Warnings Categories added in Perl 5.025
98 'experimental::declared_refs' => 132,
100 # Warnings Categories added in Perl 5.027
101 'experimental::alpha_assertions' => 134,
102 'experimental::script_run' => 136,
107 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55", # [0..71]
108 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29]
109 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30]
110 'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
111 'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1]
112 'debugging' => "\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22]
113 'deprecated' => "\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2]
114 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31]
115 'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
116 'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
117 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x51\x15\x50\x01", # [51..56,58..62,66..68]
118 'experimental::alpha_assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [67]
119 'experimental::bitwise' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [58]
120 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [59]
121 'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [66]
122 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [52]
123 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00", # [55]
124 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00", # [60]
125 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00", # [61]
126 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [53]
127 'experimental::script_run' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [68]
128 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [56]
129 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [54]
130 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [62]
131 'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4]
132 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00", # [47]
133 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00", # [46]
134 'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23]
135 'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24]
136 'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [5..11,57]
137 'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8]
138 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [63]
139 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25]
140 'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12]
141 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [64]
142 'newline' => "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9]
143 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00", # [48]
144 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00", # [49]
145 'numeric' => "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13]
146 'once' => "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14]
147 'overflow' => "\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15]
148 'pack' => "\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16]
149 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [32]
150 'pipe' => "\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10]
151 'portable' => "\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17]
152 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [33]
153 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [34]
154 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [35]
155 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [36]
156 'recursion' => "\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18]
157 'redefine' => "\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19]
158 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [65]
159 'regexp' => "\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20]
160 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [37]
161 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00", # [38]
162 'severe' => "\x00\x00\x00\x00\x00\x54\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25]
163 'shadow' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [69]
164 'signal' => "\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26]
165 'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27]
166 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00", # [50]
167 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00\x00\x00\x00\x00", # [28..38,47]
168 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [57]
169 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [39]
170 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00", # [40]
171 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [41]
172 'unopened' => "\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11]
173 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [42]
174 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [43]
175 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x15\x00\x00\x00\x00\x00", # [44,48..50]
176 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00", # [45]
180 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", # [0..71]
181 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [29]
182 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [30]
183 'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
184 'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1]
185 'debugging' => "\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [22]
186 'deprecated' => "\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [2]
187 'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [31]
188 'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
189 'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
190 'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\xa2\x2a\xa0\x02", # [51..56,58..62,66..68]
191 'experimental::alpha_assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [67]
192 'experimental::bitwise' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [58]
193 'experimental::const_attr' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [59]
194 'experimental::declared_refs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [66]
195 'experimental::lexical_subs' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [52]
196 'experimental::postderef' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00", # [55]
197 'experimental::re_strict' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00", # [60]
198 'experimental::refaliasing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00", # [61]
199 'experimental::regex_sets' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [53]
200 'experimental::script_run' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [68]
201 'experimental::signatures' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [56]
202 'experimental::smartmatch' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [54]
203 'experimental::win32_perlio' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [62]
204 'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4]
205 'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00", # [47]
206 'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00", # [46]
207 'inplace' => "\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23]
208 'internal' => "\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [24]
209 'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [5..11,57]
210 'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8]
211 'locale' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [63]
212 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25]
213 'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12]
214 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [64]
215 'newline' => "\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9]
216 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00", # [48]
217 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00", # [49]
218 'numeric' => "\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [13]
219 'once' => "\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [14]
220 'overflow' => "\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [15]
221 'pack' => "\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [16]
222 'parenthesis' => "\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [32]
223 'pipe' => "\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [10]
224 'portable' => "\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [17]
225 'precedence' => "\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [33]
226 'printf' => "\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [34]
227 'prototype' => "\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [35]
228 'qw' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [36]
229 'recursion' => "\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [18]
230 'redefine' => "\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [19]
231 'redundant' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [65]
232 'regexp' => "\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [20]
233 'reserved' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00", # [37]
234 'semicolon' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00", # [38]
235 'severe' => "\x00\x00\x00\x00\x00\xa8\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [21..25]
236 'shadow' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [69]
237 'signal' => "\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [26]
238 'substr' => "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [27]
239 'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00", # [50]
240 'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00\x00\x00\x00\x00", # [28..38,47]
241 'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [57]
242 'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00", # [39]
243 'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00", # [40]
244 'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00", # [41]
245 'unopened' => "\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [11]
246 'unpack' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [42]
247 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [43]
248 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x2a\x00\x00\x00\x00\x00", # [44,48..50]
249 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00", # [45]
252 # These are used by various things, including our own tests
253 our $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
254 our $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x51\x55\x50\x01", # [2,4,22,23,25,52..56,58..63,66..68]
255 our $LAST_BIT = 140 ;
260 require Carp; # this initializes %CarpInternal
261 local $Carp::CarpInternal{'warnings'};
262 delete $Carp::CarpInternal{'warnings'};
268 my $want_len = ($LAST_BIT + 7) >> 3;
269 my $len = length($bits);
270 if ($len != $want_len) {
272 $bits = "\x00" x $want_len;
273 } elsif ($len > $want_len) {
274 substr $bits, $want_len, $len-$want_len, "";
276 my $a = vec($bits, $Offsets{all} >> 1, 2);
279 $bits .= chr($a) x ($want_len - $len);
291 $mask = _expand_bits($mask);
292 foreach my $word ( @_ ) {
293 if ($word eq 'FATAL') {
297 elsif ($word eq 'NONFATAL') {
301 elsif ($catmask = $Bits{$word}) {
303 $mask |= $DeadBits{$word} if $fatal ;
304 $mask = ~(~$mask | $DeadBits{$word}) if $no_fatal ;
307 { Croaker("Unknown warnings category '$word'")}
315 # called from B::Deparse.pm
316 push @_, 'all' unless @_ ;
317 return _bits("", @_) ;
324 my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ;
326 # append 'all' when implied (empty import list or after a lone
327 # "FATAL" or "NONFATAL")
329 if !@_ || (@_==1 && ($_[0] eq 'FATAL' || $_[0] eq 'NONFATAL'));
331 ${^WARNING_BITS} = _bits($mask, @_);
339 my $mask = ${^WARNING_BITS} // ($^W ? $Bits{all} : $DEFAULT) ;
341 # append 'all' when implied (empty import list or after a lone "FATAL")
342 push @_, 'all' if !@_ || @_==1 && $_[0] eq 'FATAL';
344 $mask = _expand_bits($mask);
345 foreach my $word ( @_ ) {
346 if ($word eq 'FATAL') {
349 elsif ($catmask = $Bits{$word}) {
350 $mask = ~(~$mask | $catmask | $DeadBits{$word});
353 { Croaker("Unknown warnings category '$word'")}
356 ${^WARNING_BITS} = $mask ;
359 my %builtin_type; @builtin_type{qw(SCALAR ARRAY HASH CODE REF GLOB LVALUE Regexp)} = ();
362 sub MESSAGE () { 4 };
372 my $has_message = $wanted & MESSAGE;
373 my $has_level = $wanted & LEVEL ;
376 if (@_ != ($has_message ? 3 : 2)) {
377 my $sub = (caller 1)[3];
378 my $syntax = $has_message
379 ? "category, level, 'message'"
381 Croaker("Usage: $sub($syntax)");
384 elsif (not @_ == 1 || @_ == ($has_message ? 2 : 0)) {
385 my $sub = (caller 1)[3];
386 my $syntax = $has_message ? "[category,] 'message'" : '[category]';
387 Croaker("Usage: $sub($syntax)");
390 my $message = pop if $has_message;
393 # check the category supplied.
395 if (my $type = ref $category) {
396 Croaker("not an object")
397 if exists $builtin_type{$type};
401 $offset = $Offsets{$category};
402 Croaker("Unknown warnings category '$category'")
403 unless defined $offset;
406 $category = (caller(1))[0] ;
407 $offset = $Offsets{$category};
408 Croaker("package '$category' not registered for warnings")
409 unless defined $offset ;
417 while (do { { package DB; $pkg = (caller($i++))[0] } } ) {
418 last unless @DB::args && $DB::args[0] =~ /^$category=/ ;
426 $i = _error_loc(); # see where Carp will allocate the error
429 # Default to 0 if caller returns nothing. Default to $DEFAULT if it
430 # explicitly returns undef.
431 my(@callers_bitmask) = (caller($i))[9] ;
432 my $callers_bitmask =
433 @callers_bitmask ? $callers_bitmask[0] // $DEFAULT : 0 ;
434 length($callers_bitmask) > ($offset >> 3) or $offset = $Offsets{all};
437 foreach my $type (FATAL, NORMAL) {
438 next unless $wanted & $type;
440 push @results, vec($callers_bitmask, $offset + $type - 1, 1);
443 # &enabled and &fatal_enabled
444 return $results[0] unless $has_message;
446 # &warnif, and the category is neither enabled as warning nor as fatal
447 return if ($wanted & (NORMAL | FATAL | MESSAGE))
448 == (NORMAL | FATAL | MESSAGE)
449 && !($results[0] || $results[1]);
451 # If we have an explicit level, bypass Carp.
452 if ($has_level and @callers_bitmask) {
453 # logic copied from util.c:mess_sv
454 my $stuff = " at " . join " line ", (caller $i)[1,2];
455 $stuff .= sprintf ", <%s> %s %d",
457 ($/ eq "\n" ? "line" : "chunk"), $.
458 if $. && ${^LAST_FH};
459 die "$message$stuff.\n" if $results[0];
460 return warn "$message$stuff.\n";
464 Carp::croak($message) if $results[0];
465 # will always get here for &warn. will only get here for &warnif if the
466 # category is enabled
467 Carp::carp($message);
475 vec($mask, $bit, 1) = 1;
479 sub register_categories
483 for my $name (@names) {
484 if (! defined $Bits{$name}) {
485 $Offsets{$name} = $LAST_BIT;
486 $Bits{$name} = _mkMask($LAST_BIT++);
487 $DeadBits{$name} = _mkMask($LAST_BIT++);
488 if (length($Bits{$name}) > length($Bits{all})) {
489 $Bits{all} .= "\x55";
490 $DeadBits{all} .= "\xaa";
498 goto &Carp::short_error_loc; # don't introduce another stack frame
503 return __chk(NORMAL, @_);
508 return __chk(FATAL, @_);
513 return __chk(FATAL | MESSAGE, @_);
518 return __chk(NORMAL | FATAL | MESSAGE, @_);
523 return __chk(NORMAL | LEVEL, @_);
526 sub fatal_enabled_at_level
528 return __chk(FATAL | LEVEL, @_);
533 return __chk(FATAL | MESSAGE | LEVEL, @_);
538 return __chk(NORMAL | FATAL | MESSAGE | LEVEL, @_);
541 # These are not part of any public interface, so we can delete them to save
543 delete @warnings::{qw(NORMAL FATAL MESSAGE LEVEL)};
549 warnings - Perl pragma to control optional warnings
559 use warnings::register;
560 if (warnings::enabled()) {
561 warnings::warn("some warning");
564 if (warnings::enabled("void")) {
565 warnings::warn("void", "some warning");
568 if (warnings::enabled($object)) {
569 warnings::warn($object, "some warning");
572 warnings::warnif("some warning");
573 warnings::warnif("void", "some warning");
574 warnings::warnif($object, "some warning");
578 The C<warnings> pragma gives control over which warnings are enabled in
579 which parts of a Perl program. It's a more flexible alternative for
580 both the command line flag B<-w> and the equivalent Perl variable,
583 This pragma works just like the C<strict> pragma.
584 This means that the scope of the warning pragma is limited to the
585 enclosing block. It also means that the pragma setting will not
586 leak across files (via C<use>, C<require> or C<do>). This allows
587 authors to independently define the degree of warning checks that will
588 be applied to their module.
590 By default, optional warnings are disabled, so any legacy code that
591 doesn't attempt to control the warnings will work unchanged.
593 All warnings are enabled in a block by either of these:
598 Similarly all warnings are disabled in a block by either of these:
603 For example, consider the code below:
613 The code in the enclosing block has warnings enabled, but the inner
614 block has them disabled. In this case that means the assignment to the
615 scalar C<$c> will trip the C<"Scalar value @a[0] better written as $a[0]">
616 warning, but the assignment to the scalar C<$b> will not.
618 =head2 Default Warnings and Optional Warnings
620 Before the introduction of lexical warnings, Perl had two classes of
621 warnings: mandatory and optional.
623 As its name suggests, if your code tripped a mandatory warning, you
624 would get a warning whether you wanted it or not.
625 For example, the code below would always produce an C<"isn't numeric">
626 warning about the "2:".
630 With the introduction of lexical warnings, mandatory warnings now become
631 I<default> warnings. The difference is that although the previously
632 mandatory warnings are still enabled by default, they can then be
633 subsequently enabled or disabled with the lexical warning pragma. For
634 example, in the code below, an C<"isn't numeric"> warning will only
635 be reported for the C<$a> variable.
641 Note that neither the B<-w> flag or the C<$^W> can be used to
642 disable/enable default warnings. They are still mandatory in this case.
644 =head2 What's wrong with B<-w> and C<$^W>
646 Although very useful, the big problem with using B<-w> on the command
647 line to enable warnings is that it is all or nothing. Take the typical
648 scenario when you are writing a Perl program. Parts of the code you
649 will write yourself, but it's very likely that you will make use of
650 pre-written Perl modules. If you use the B<-w> flag in this case, you
651 end up enabling warnings in pieces of code that you haven't written.
653 Similarly, using C<$^W> to either disable or enable blocks of code is
654 fundamentally flawed. For a start, say you want to disable warnings in
655 a block of code. You might expect this to be enough to do the trick:
663 When this code is run with the B<-w> flag, a warning will be produced
664 for the C<$a> line: C<"Reversed += operator">.
666 The problem is that Perl has both compile-time and run-time warnings. To
667 disable compile-time warnings you need to rewrite the code like this:
675 The other big problem with C<$^W> is the way you can inadvertently
676 change the warning setting in unexpected places in your code. For example,
677 when the code below is run (without the B<-w> flag), the second call
678 to C<doit> will trip a C<"Use of uninitialized value"> warning, whereas
693 This is a side-effect of C<$^W> being dynamically scoped.
695 Lexical warnings get around these limitations by allowing finer control
696 over where warnings can or can't be tripped.
698 =head2 Controlling Warnings from the Command Line
700 There are three Command Line flags that can be used to control when
701 warnings are (or aren't) produced:
708 This is the existing flag. If the lexical warnings pragma is B<not>
709 used in any of you code, or any of the modules that you use, this flag
710 will enable warnings everywhere. See L<Backward Compatibility> for
711 details of how this flag interacts with lexical warnings.
716 If the B<-W> flag is used on the command line, it will enable all warnings
717 throughout the program regardless of whether warnings were disabled
718 locally using C<no warnings> or C<$^W =0>.
719 This includes all files that get
720 included via C<use>, C<require> or C<do>.
721 Think of it as the Perl equivalent of the "lint" command.
726 Does the exact opposite to the B<-W> flag, i.e. it disables all warnings.
730 =head2 Backward Compatibility
732 If you are used to working with a version of Perl prior to the
733 introduction of lexically scoped warnings, or have code that uses both
734 lexical warnings and C<$^W>, this section will describe how they interact.
736 How Lexical Warnings interact with B<-w>/C<$^W>:
742 If none of the three command line flags (B<-w>, B<-W> or B<-X>) that
743 control warnings is used and neither C<$^W> nor the C<warnings> pragma
744 are used, then default warnings will be enabled and optional warnings
746 This means that legacy code that doesn't attempt to control the warnings
751 The B<-w> flag just sets the global C<$^W> variable as in 5.005. This
752 means that any legacy code that currently relies on manipulating C<$^W>
753 to control warning behavior will still work as is.
757 Apart from now being a boolean, the C<$^W> variable operates in exactly
758 the same horrible uncontrolled global way, except that it cannot
759 disable/enable default warnings.
763 If a piece of code is under the control of the C<warnings> pragma,
764 both the C<$^W> variable and the B<-w> flag will be ignored for the
765 scope of the lexical warning.
769 The only way to override a lexical warnings setting is with the B<-W>
770 or B<-X> command line flags.
774 The combined effect of 3 & 4 is that it will allow code which uses
775 the C<warnings> pragma to control the warning behavior of $^W-type
776 code (using a C<local $^W=0>) if it really wants to, but not vice-versa.
778 =head2 Category Hierarchy
779 X<warning, categories>
781 A hierarchy of "categories" have been defined to allow groups of warnings
782 to be enabled/disabled in isolation.
784 The current hierarchy is:
796 | +- experimental::alpha_assertions
798 | +- experimental::bitwise
800 | +- experimental::const_attr
802 | +- experimental::declared_refs
804 | +- experimental::lexical_subs
806 | +- experimental::postderef
808 | +- experimental::re_strict
810 | +- experimental::refaliasing
812 | +- experimental::regex_sets
814 | +- experimental::script_run
816 | +- experimental::signatures
818 | +- experimental::smartmatch
820 | +- experimental::win32_perlio
926 Just like the "strict" pragma any of these categories can be combined
928 use warnings qw(void redefine);
929 no warnings qw(io syntax untie);
931 Also like the "strict" pragma, if there is more than one instance of the
932 C<warnings> pragma in a given scope the cumulative effect is additive.
934 use warnings qw(void); # only "void" warnings enabled
936 use warnings qw(io); # only "void" & "io" warnings enabled
938 no warnings qw(void); # only "io" warnings enabled
940 To determine which category a specific warning has been assigned to see
943 Note: Before Perl 5.8.0, the lexical warnings category "deprecated" was a
944 sub-category of the "syntax" category. It is now a top-level category
947 Note: Before 5.21.0, the "missing" lexical warnings category was
948 internally defined to be the same as the "uninitialized" category. It
949 is now a top-level category in its own right.
951 =head2 Fatal Warnings
954 The presence of the word "FATAL" in the category list will escalate
955 warnings in those categories into fatal errors in that lexical scope.
957 B<NOTE:> FATAL warnings should be used with care, particularly
958 C<< FATAL => 'all' >>.
960 Libraries using L<warnings::warn|/FUNCTIONS> for custom warning categories
961 generally don't expect L<warnings::warn|/FUNCTIONS> to be fatal and can wind up
962 in an unexpected state as a result. For XS modules issuing categorized
963 warnings, such unanticipated exceptions could also expose memory leak bugs.
965 Moreover, the Perl interpreter itself has had serious bugs involving
966 fatalized warnings. For a summary of resolved and unresolved problems as
967 of January 2015, please see
968 L<this perl5-porters post|http://www.nntp.perl.org/group/perl.perl5.porters/2015/01/msg225235.html>.
970 While some developers find fatalizing some warnings to be a useful
971 defensive programming technique, using C<< FATAL => 'all' >> to fatalize
972 all possible warning categories -- including custom ones -- is particularly
973 risky. Therefore, the use of C<< FATAL => 'all' >> is
974 L<discouraged|perlpolicy/discouraged>.
976 The L<strictures|strictures/VERSION-2> module on CPAN offers one example of
977 a warnings subset that the module's authors believe is relatively safe to
980 B<NOTE:> users of FATAL warnings, especially those using
981 C<< FATAL => 'all' >>, should be fully aware that they are risking future
982 portability of their programs by doing so. Perl makes absolutely no
983 commitments to not introduce new warnings or warnings categories in the
984 future; indeed, we explicitly reserve the right to do so. Code that may
985 not warn now may warn in a future release of Perl if the Perl5 development
986 team deems it in the best interests of the community to do so. Should code
987 using FATAL warnings break due to the introduction of a new warning we will
988 NOT consider it an incompatible change. Users of FATAL warnings should
989 take special caution during upgrades to check to see if their code triggers
990 any new warnings and should pay particular attention to the fine print of
991 the documentation of the features they use to ensure they do not exploit
992 features that are documented as risky, deprecated, or unspecified, or where
993 the documentation says "so don't do that", or anything with the same sense
994 and spirit. Use of such features in combination with FATAL warnings is
995 ENTIRELY AT THE USER'S RISK.
997 The following documentation describes how to use FATAL warnings but the
998 perl5 porters strongly recommend that you understand the risks before doing
999 so, especially for library code intended for use by others, as there is no
1000 way for downstream users to change the choice of fatal categories.
1002 In the code below, the use of C<time>, C<length>
1003 and C<join> can all produce a C<"Useless use of xxx in void context">
1011 use warnings FATAL => qw(void);
1019 When run it produces this output
1021 Useless use of time in void context at fatal line 3.
1022 Useless use of length in void context at fatal line 7.
1024 The scope where C<length> is used has escalated the C<void> warnings
1025 category into a fatal error, so the program terminates immediately when it
1026 encounters the warning.
1028 To explicitly turn off a "FATAL" warning you just disable the warning
1029 it is associated with. So, for example, to disable the "void" warning
1030 in the example above, either of these will do the trick:
1032 no warnings qw(void);
1033 no warnings FATAL => qw(void);
1035 If you want to downgrade a warning that has been escalated into a fatal
1036 error back to a normal warning, you can use the "NONFATAL" keyword. For
1037 example, the code below will promote all warnings into fatal errors,
1038 except for those in the "syntax" category.
1040 use warnings FATAL => 'all', NONFATAL => 'syntax';
1042 As of Perl 5.20, instead of C<< use warnings FATAL => 'all'; >> you can
1045 use v5.20; # Perl 5.20 or greater is required for the following
1046 use warnings 'FATAL'; # short form of "use warnings FATAL => 'all';"
1048 If you want your program to be compatible with versions of Perl before
1049 5.20, you must use C<< use warnings FATAL => 'all'; >> instead. (In
1050 previous versions of Perl, the behavior of the statements
1051 C<< use warnings 'FATAL'; >>, C<< use warnings 'NONFATAL'; >> and
1052 C<< no warnings 'FATAL'; >> was unspecified; they did not behave as if
1053 they included the C<< => 'all' >> portion. As of 5.20, they do.)
1055 =head2 Reporting Warnings from a Module
1056 X<warning, reporting> X<warning, registering>
1058 The C<warnings> pragma provides a number of functions that are useful for
1059 module authors. These are used when you want to report a module-specific
1060 warning to a calling module has enabled warnings via the C<warnings>
1063 Consider the module C<MyMod::Abc> below.
1067 use warnings::register;
1071 if ($path !~ m#^/#) {
1072 warnings::warn("changing relative path to /var/abc")
1073 if warnings::enabled();
1074 $path = "/var/abc/$path";
1080 The call to C<warnings::register> will create a new warnings category
1081 called "MyMod::Abc", i.e. the new category name matches the current
1082 package name. The C<open> function in the module will display a warning
1083 message if it gets given a relative path as a parameter. This warnings
1084 will only be displayed if the code that uses C<MyMod::Abc> has actually
1085 enabled them with the C<warnings> pragma like below.
1088 use warnings 'MyMod::Abc';
1090 abc::open("../fred.txt");
1092 It is also possible to test whether the pre-defined warnings categories are
1093 set in the calling module with the C<warnings::enabled> function. Consider
1094 this snippet of code:
1099 if (warnings::enabled("deprecated")) {
1100 warnings::warn("deprecated",
1101 "open is deprecated, use new instead");
1110 The function C<open> has been deprecated, so code has been included to
1111 display a warning message whenever the calling module has (at least) the
1112 "deprecated" warnings category enabled. Something like this, say.
1114 use warnings 'deprecated';
1117 MyMod::Abc::open($filename);
1119 Either the C<warnings::warn> or C<warnings::warnif> function should be
1120 used to actually display the warnings message. This is because they can
1121 make use of the feature that allows warnings to be escalated into fatal
1122 errors. So in this case
1125 use warnings FATAL => 'MyMod::Abc';
1127 MyMod::Abc::open('../fred.txt');
1129 the C<warnings::warnif> function will detect this and die after
1130 displaying the warning message.
1132 The three warnings functions, C<warnings::warn>, C<warnings::warnif>
1133 and C<warnings::enabled> can optionally take an object reference in place
1134 of a category name. In this case the functions will use the class name
1135 of the object as the warnings category.
1137 Consider this example:
1142 use warnings::register;
1155 if ($value % 2 && warnings::enabled($self))
1156 { warnings::warn($self, "Odd numbers are unsafe") }
1163 $self->check($value);
1171 use warnings::register;
1173 our @ISA = qw( Original );
1183 The code below makes use of both modules, but it only enables warnings from
1188 use warnings 'Derived';
1189 my $a = Original->new();
1191 my $b = Derived->new();
1194 When this code is run only the C<Derived> object, C<$b>, will generate
1197 Odd numbers are unsafe at main.pl line 7
1199 Notice also that the warning is reported at the line where the object is first
1202 When registering new categories of warning, you can supply more names to
1203 warnings::register like this:
1206 use warnings::register qw(format precision);
1210 warnings::warnif('MyModule::format', '...');
1214 Note: The functions with names ending in C<_at_level> were added in Perl
1219 =item use warnings::register
1221 Creates a new warnings category with the same name as the package where
1222 the call to the pragma is used.
1224 =item warnings::enabled()
1226 Use the warnings category with the same name as the current package.
1228 Return TRUE if that warnings category is enabled in the calling module.
1229 Otherwise returns FALSE.
1231 =item warnings::enabled($category)
1233 Return TRUE if the warnings category, C<$category>, is enabled in the
1235 Otherwise returns FALSE.
1237 =item warnings::enabled($object)
1239 Use the name of the class for the object reference, C<$object>, as the
1242 Return TRUE if that warnings category is enabled in the first scope
1243 where the object is used.
1244 Otherwise returns FALSE.
1246 =item warnings::enabled_at_level($category, $level)
1248 Like C<warnings::enabled>, but $level specifies the exact call frame, 0
1249 being the immediate caller.
1251 =item warnings::fatal_enabled()
1253 Return TRUE if the warnings category with the same name as the current
1254 package has been set to FATAL in the calling module.
1255 Otherwise returns FALSE.
1257 =item warnings::fatal_enabled($category)
1259 Return TRUE if the warnings category C<$category> has been set to FATAL in
1261 Otherwise returns FALSE.
1263 =item warnings::fatal_enabled($object)
1265 Use the name of the class for the object reference, C<$object>, as the
1268 Return TRUE if that warnings category has been set to FATAL in the first
1269 scope where the object is used.
1270 Otherwise returns FALSE.
1272 =item warnings::fatal_enabled_at_level($category, $level)
1274 Like C<warnings::fatal_enabled>, but $level specifies the exact call frame,
1275 0 being the immediate caller.
1277 =item warnings::warn($message)
1279 Print C<$message> to STDERR.
1281 Use the warnings category with the same name as the current package.
1283 If that warnings category has been set to "FATAL" in the calling module
1284 then die. Otherwise return.
1286 =item warnings::warn($category, $message)
1288 Print C<$message> to STDERR.
1290 If the warnings category, C<$category>, has been set to "FATAL" in the
1291 calling module then die. Otherwise return.
1293 =item warnings::warn($object, $message)
1295 Print C<$message> to STDERR.
1297 Use the name of the class for the object reference, C<$object>, as the
1300 If that warnings category has been set to "FATAL" in the scope where C<$object>
1301 is first used then die. Otherwise return.
1303 =item warnings::warn_at_level($category, $level, $message)
1305 Like C<warnings::warn>, but $level specifies the exact call frame,
1306 0 being the immediate caller.
1308 =item warnings::warnif($message)
1312 if (warnings::enabled())
1313 { warnings::warn($message) }
1315 =item warnings::warnif($category, $message)
1319 if (warnings::enabled($category))
1320 { warnings::warn($category, $message) }
1322 =item warnings::warnif($object, $message)
1326 if (warnings::enabled($object))
1327 { warnings::warn($object, $message) }
1329 =item warnings::warnif_at_level($category, $level, $message)
1331 Like C<warnings::warnif>, but $level specifies the exact call frame,
1332 0 being the immediate caller.
1334 =item warnings::register_categories(@names)
1336 This registers warning categories for the given names and is primarily for
1337 use by the warnings::register pragma.
1341 See also L<perlmodlib/Pragmatic Modules> and L<perldiag>.