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)};
550 warnings - Perl pragma to control optional warnings
560 use warnings::register;
561 if (warnings::enabled()) {
562 warnings::warn("some warning");
565 if (warnings::enabled("void")) {
566 warnings::warn("void", "some warning");
569 if (warnings::enabled($object)) {
570 warnings::warn($object, "some warning");
573 warnings::warnif("some warning");
574 warnings::warnif("void", "some warning");
575 warnings::warnif($object, "some warning");
579 The C<warnings> pragma gives control over which warnings are enabled in
580 which parts of a Perl program. It's a more flexible alternative for
581 both the command line flag B<-w> and the equivalent Perl variable,
584 This pragma works just like the C<strict> pragma.
585 This means that the scope of the warning pragma is limited to the
586 enclosing block. It also means that the pragma setting will not
587 leak across files (via C<use>, C<require> or C<do>). This allows
588 authors to independently define the degree of warning checks that will
589 be applied to their module.
591 By default, optional warnings are disabled, so any legacy code that
592 doesn't attempt to control the warnings will work unchanged.
594 All warnings are enabled in a block by either of these:
599 Similarly all warnings are disabled in a block by either of these:
604 For example, consider the code below:
614 The code in the enclosing block has warnings enabled, but the inner
615 block has them disabled. In this case that means the assignment to the
616 scalar C<$c> will trip the C<"Scalar value @a[0] better written as $a[0]">
617 warning, but the assignment to the scalar C<$b> will not.
619 =head2 Default Warnings and Optional Warnings
621 Before the introduction of lexical warnings, Perl had two classes of
622 warnings: mandatory and optional.
624 As its name suggests, if your code tripped a mandatory warning, you
625 would get a warning whether you wanted it or not.
626 For example, the code below would always produce an C<"isn't numeric">
627 warning about the "2:".
631 With the introduction of lexical warnings, mandatory warnings now become
632 I<default> warnings. The difference is that although the previously
633 mandatory warnings are still enabled by default, they can then be
634 subsequently enabled or disabled with the lexical warning pragma. For
635 example, in the code below, an C<"isn't numeric"> warning will only
636 be reported for the C<$a> variable.
642 Note that neither the B<-w> flag or the C<$^W> can be used to
643 disable/enable default warnings. They are still mandatory in this case.
645 =head2 What's wrong with B<-w> and C<$^W>
647 Although very useful, the big problem with using B<-w> on the command
648 line to enable warnings is that it is all or nothing. Take the typical
649 scenario when you are writing a Perl program. Parts of the code you
650 will write yourself, but it's very likely that you will make use of
651 pre-written Perl modules. If you use the B<-w> flag in this case, you
652 end up enabling warnings in pieces of code that you haven't written.
654 Similarly, using C<$^W> to either disable or enable blocks of code is
655 fundamentally flawed. For a start, say you want to disable warnings in
656 a block of code. You might expect this to be enough to do the trick:
664 When this code is run with the B<-w> flag, a warning will be produced
665 for the C<$a> line: C<"Reversed += operator">.
667 The problem is that Perl has both compile-time and run-time warnings. To
668 disable compile-time warnings you need to rewrite the code like this:
676 The other big problem with C<$^W> is the way you can inadvertently
677 change the warning setting in unexpected places in your code. For example,
678 when the code below is run (without the B<-w> flag), the second call
679 to C<doit> will trip a C<"Use of uninitialized value"> warning, whereas
694 This is a side-effect of C<$^W> being dynamically scoped.
696 Lexical warnings get around these limitations by allowing finer control
697 over where warnings can or can't be tripped.
699 =head2 Controlling Warnings from the Command Line
701 There are three Command Line flags that can be used to control when
702 warnings are (or aren't) produced:
709 This is the existing flag. If the lexical warnings pragma is B<not>
710 used in any of you code, or any of the modules that you use, this flag
711 will enable warnings everywhere. See L<Backward Compatibility> for
712 details of how this flag interacts with lexical warnings.
717 If the B<-W> flag is used on the command line, it will enable all warnings
718 throughout the program regardless of whether warnings were disabled
719 locally using C<no warnings> or C<$^W =0>.
720 This includes all files that get
721 included via C<use>, C<require> or C<do>.
722 Think of it as the Perl equivalent of the "lint" command.
727 Does the exact opposite to the B<-W> flag, i.e. it disables all warnings.
731 =head2 Backward Compatibility
733 If you are used to working with a version of Perl prior to the
734 introduction of lexically scoped warnings, or have code that uses both
735 lexical warnings and C<$^W>, this section will describe how they interact.
737 How Lexical Warnings interact with B<-w>/C<$^W>:
743 If none of the three command line flags (B<-w>, B<-W> or B<-X>) that
744 control warnings is used and neither C<$^W> nor the C<warnings> pragma
745 are used, then default warnings will be enabled and optional warnings
747 This means that legacy code that doesn't attempt to control the warnings
752 The B<-w> flag just sets the global C<$^W> variable as in 5.005. This
753 means that any legacy code that currently relies on manipulating C<$^W>
754 to control warning behavior will still work as is.
758 Apart from now being a boolean, the C<$^W> variable operates in exactly
759 the same horrible uncontrolled global way, except that it cannot
760 disable/enable default warnings.
764 If a piece of code is under the control of the C<warnings> pragma,
765 both the C<$^W> variable and the B<-w> flag will be ignored for the
766 scope of the lexical warning.
770 The only way to override a lexical warnings setting is with the B<-W>
771 or B<-X> command line flags.
775 The combined effect of 3 & 4 is that it will allow code which uses
776 the C<warnings> pragma to control the warning behavior of $^W-type
777 code (using a C<local $^W=0>) if it really wants to, but not vice-versa.
779 =head2 Category Hierarchy
780 X<warning, categories>
782 A hierarchy of "categories" have been defined to allow groups of warnings
783 to be enabled/disabled in isolation.
785 The current hierarchy is:
797 | +- experimental::alpha_assertions
799 | +- experimental::bitwise
801 | +- experimental::const_attr
803 | +- experimental::declared_refs
805 | +- experimental::lexical_subs
807 | +- experimental::postderef
809 | +- experimental::re_strict
811 | +- experimental::refaliasing
813 | +- experimental::regex_sets
815 | +- experimental::script_run
817 | +- experimental::signatures
819 | +- experimental::smartmatch
821 | +- experimental::win32_perlio
927 Just like the "strict" pragma any of these categories can be combined
929 use warnings qw(void redefine);
930 no warnings qw(io syntax untie);
932 Also like the "strict" pragma, if there is more than one instance of the
933 C<warnings> pragma in a given scope the cumulative effect is additive.
935 use warnings qw(void); # only "void" warnings enabled
937 use warnings qw(io); # only "void" & "io" warnings enabled
939 no warnings qw(void); # only "io" warnings enabled
941 To determine which category a specific warning has been assigned to see
944 Note: Before Perl 5.8.0, the lexical warnings category "deprecated" was a
945 sub-category of the "syntax" category. It is now a top-level category
948 Note: Before 5.21.0, the "missing" lexical warnings category was
949 internally defined to be the same as the "uninitialized" category. It
950 is now a top-level category in its own right.
952 =head2 Fatal Warnings
955 The presence of the word "FATAL" in the category list will escalate
956 warnings in those categories into fatal errors in that lexical scope.
958 B<NOTE:> FATAL warnings should be used with care, particularly
959 C<< FATAL => 'all' >>.
961 Libraries using L<warnings::warn|/FUNCTIONS> for custom warning categories
962 generally don't expect L<warnings::warn|/FUNCTIONS> to be fatal and can wind up
963 in an unexpected state as a result. For XS modules issuing categorized
964 warnings, such unanticipated exceptions could also expose memory leak bugs.
966 Moreover, the Perl interpreter itself has had serious bugs involving
967 fatalized warnings. For a summary of resolved and unresolved problems as
968 of January 2015, please see
969 L<this perl5-porters post|http://www.nntp.perl.org/group/perl.perl5.porters/2015/01/msg225235.html>.
971 While some developers find fatalizing some warnings to be a useful
972 defensive programming technique, using C<< FATAL => 'all' >> to fatalize
973 all possible warning categories -- including custom ones -- is particularly
974 risky. Therefore, the use of C<< FATAL => 'all' >> is
975 L<discouraged|perlpolicy/discouraged>.
977 The L<strictures|strictures/VERSION-2> module on CPAN offers one example of
978 a warnings subset that the module's authors believe is relatively safe to
981 B<NOTE:> users of FATAL warnings, especially those using
982 C<< FATAL => 'all' >>, should be fully aware that they are risking future
983 portability of their programs by doing so. Perl makes absolutely no
984 commitments to not introduce new warnings or warnings categories in the
985 future; indeed, we explicitly reserve the right to do so. Code that may
986 not warn now may warn in a future release of Perl if the Perl5 development
987 team deems it in the best interests of the community to do so. Should code
988 using FATAL warnings break due to the introduction of a new warning we will
989 NOT consider it an incompatible change. Users of FATAL warnings should
990 take special caution during upgrades to check to see if their code triggers
991 any new warnings and should pay particular attention to the fine print of
992 the documentation of the features they use to ensure they do not exploit
993 features that are documented as risky, deprecated, or unspecified, or where
994 the documentation says "so don't do that", or anything with the same sense
995 and spirit. Use of such features in combination with FATAL warnings is
996 ENTIRELY AT THE USER'S RISK.
998 The following documentation describes how to use FATAL warnings but the
999 perl5 porters strongly recommend that you understand the risks before doing
1000 so, especially for library code intended for use by others, as there is no
1001 way for downstream users to change the choice of fatal categories.
1003 In the code below, the use of C<time>, C<length>
1004 and C<join> can all produce a C<"Useless use of xxx in void context">
1012 use warnings FATAL => qw(void);
1020 When run it produces this output
1022 Useless use of time in void context at fatal line 3.
1023 Useless use of length in void context at fatal line 7.
1025 The scope where C<length> is used has escalated the C<void> warnings
1026 category into a fatal error, so the program terminates immediately when it
1027 encounters the warning.
1029 To explicitly turn off a "FATAL" warning you just disable the warning
1030 it is associated with. So, for example, to disable the "void" warning
1031 in the example above, either of these will do the trick:
1033 no warnings qw(void);
1034 no warnings FATAL => qw(void);
1036 If you want to downgrade a warning that has been escalated into a fatal
1037 error back to a normal warning, you can use the "NONFATAL" keyword. For
1038 example, the code below will promote all warnings into fatal errors,
1039 except for those in the "syntax" category.
1041 use warnings FATAL => 'all', NONFATAL => 'syntax';
1043 As of Perl 5.20, instead of C<< use warnings FATAL => 'all'; >> you can
1046 use v5.20; # Perl 5.20 or greater is required for the following
1047 use warnings 'FATAL'; # short form of "use warnings FATAL => 'all';"
1049 If you want your program to be compatible with versions of Perl before
1050 5.20, you must use C<< use warnings FATAL => 'all'; >> instead. (In
1051 previous versions of Perl, the behavior of the statements
1052 C<< use warnings 'FATAL'; >>, C<< use warnings 'NONFATAL'; >> and
1053 C<< no warnings 'FATAL'; >> was unspecified; they did not behave as if
1054 they included the C<< => 'all' >> portion. As of 5.20, they do.)
1056 =head2 Reporting Warnings from a Module
1057 X<warning, reporting> X<warning, registering>
1059 The C<warnings> pragma provides a number of functions that are useful for
1060 module authors. These are used when you want to report a module-specific
1061 warning to a calling module has enabled warnings via the C<warnings>
1064 Consider the module C<MyMod::Abc> below.
1068 use warnings::register;
1072 if ($path !~ m#^/#) {
1073 warnings::warn("changing relative path to /var/abc")
1074 if warnings::enabled();
1075 $path = "/var/abc/$path";
1081 The call to C<warnings::register> will create a new warnings category
1082 called "MyMod::Abc", i.e. the new category name matches the current
1083 package name. The C<open> function in the module will display a warning
1084 message if it gets given a relative path as a parameter. This warnings
1085 will only be displayed if the code that uses C<MyMod::Abc> has actually
1086 enabled them with the C<warnings> pragma like below.
1089 use warnings 'MyMod::Abc';
1091 abc::open("../fred.txt");
1093 It is also possible to test whether the pre-defined warnings categories are
1094 set in the calling module with the C<warnings::enabled> function. Consider
1095 this snippet of code:
1100 if (warnings::enabled("deprecated")) {
1101 warnings::warn("deprecated",
1102 "open is deprecated, use new instead");
1111 The function C<open> has been deprecated, so code has been included to
1112 display a warning message whenever the calling module has (at least) the
1113 "deprecated" warnings category enabled. Something like this, say.
1115 use warnings 'deprecated';
1118 MyMod::Abc::open($filename);
1120 Either the C<warnings::warn> or C<warnings::warnif> function should be
1121 used to actually display the warnings message. This is because they can
1122 make use of the feature that allows warnings to be escalated into fatal
1123 errors. So in this case
1126 use warnings FATAL => 'MyMod::Abc';
1128 MyMod::Abc::open('../fred.txt');
1130 the C<warnings::warnif> function will detect this and die after
1131 displaying the warning message.
1133 The three warnings functions, C<warnings::warn>, C<warnings::warnif>
1134 and C<warnings::enabled> can optionally take an object reference in place
1135 of a category name. In this case the functions will use the class name
1136 of the object as the warnings category.
1138 Consider this example:
1143 use warnings::register;
1156 if ($value % 2 && warnings::enabled($self))
1157 { warnings::warn($self, "Odd numbers are unsafe") }
1164 $self->check($value);
1172 use warnings::register;
1174 our @ISA = qw( Original );
1184 The code below makes use of both modules, but it only enables warnings from
1189 use warnings 'Derived';
1190 my $a = Original->new();
1192 my $b = Derived->new();
1195 When this code is run only the C<Derived> object, C<$b>, will generate
1198 Odd numbers are unsafe at main.pl line 7
1200 Notice also that the warning is reported at the line where the object is first
1203 When registering new categories of warning, you can supply more names to
1204 warnings::register like this:
1207 use warnings::register qw(format precision);
1211 warnings::warnif('MyModule::format', '...');
1215 Note: The functions with names ending in C<_at_level> were added in Perl
1220 =item use warnings::register
1222 Creates a new warnings category with the same name as the package where
1223 the call to the pragma is used.
1225 =item warnings::enabled()
1227 Use the warnings category with the same name as the current package.
1229 Return TRUE if that warnings category is enabled in the calling module.
1230 Otherwise returns FALSE.
1232 =item warnings::enabled($category)
1234 Return TRUE if the warnings category, C<$category>, is enabled in the
1236 Otherwise returns FALSE.
1238 =item warnings::enabled($object)
1240 Use the name of the class for the object reference, C<$object>, as the
1243 Return TRUE if that warnings category is enabled in the first scope
1244 where the object is used.
1245 Otherwise returns FALSE.
1247 =item warnings::enabled_at_level($category, $level)
1249 Like C<warnings::enabled>, but $level specifies the exact call frame, 0
1250 being the immediate caller.
1252 =item warnings::fatal_enabled()
1254 Return TRUE if the warnings category with the same name as the current
1255 package has been set to FATAL in the calling module.
1256 Otherwise returns FALSE.
1258 =item warnings::fatal_enabled($category)
1260 Return TRUE if the warnings category C<$category> has been set to FATAL in
1262 Otherwise returns FALSE.
1264 =item warnings::fatal_enabled($object)
1266 Use the name of the class for the object reference, C<$object>, as the
1269 Return TRUE if that warnings category has been set to FATAL in the first
1270 scope where the object is used.
1271 Otherwise returns FALSE.
1273 =item warnings::fatal_enabled_at_level($category, $level)
1275 Like C<warnings::fatal_enabled>, but $level specifies the exact call frame,
1276 0 being the immediate caller.
1278 =item warnings::warn($message)
1280 Print C<$message> to STDERR.
1282 Use the warnings category with the same name as the current package.
1284 If that warnings category has been set to "FATAL" in the calling module
1285 then die. Otherwise return.
1287 =item warnings::warn($category, $message)
1289 Print C<$message> to STDERR.
1291 If the warnings category, C<$category>, has been set to "FATAL" in the
1292 calling module then die. Otherwise return.
1294 =item warnings::warn($object, $message)
1296 Print C<$message> to STDERR.
1298 Use the name of the class for the object reference, C<$object>, as the
1301 If that warnings category has been set to "FATAL" in the scope where C<$object>
1302 is first used then die. Otherwise return.
1304 =item warnings::warn_at_level($category, $level, $message)
1306 Like C<warnings::warn>, but $level specifies the exact call frame,
1307 0 being the immediate caller.
1309 =item warnings::warnif($message)
1313 if (warnings::enabled())
1314 { warnings::warn($message) }
1316 =item warnings::warnif($category, $message)
1320 if (warnings::enabled($category))
1321 { warnings::warn($category, $message) }
1323 =item warnings::warnif($object, $message)
1327 if (warnings::enabled($object))
1328 { warnings::warn($object, $message) }
1330 =item warnings::warnif_at_level($category, $level, $message)
1332 Like C<warnings::warnif>, but $level specifies the exact call frame,
1333 0 being the immediate caller.
1335 =item warnings::register_categories(@names)
1337 This registers warning categories for the given names and is primarily for
1338 use by the warnings::register pragma.
1342 See also L<perlmodlib/Pragmatic Modules> and L<perldiag>.