Commit | Line | Data |
---|---|---|
6a3688ca | 1 | /* -*- mode: C; buffer-read-only: t -*- |
37442d52 | 2 | !!!!!!! DO NOT EDIT THIS FILE !!!!!!! |
78102347 | 3 | This file is built by regen/warnings.pl. |
599cee73 | 4 | Any changes made here will be lost! |
78102347 | 5 | */ |
599cee73 PM |
6 | |
7 | ||
6f17df98 KW |
8 | #define Perl_Warn_Off_(x) ((x) / 8) |
9 | #define Perl_Warn_Bit_(x) (1 << ((x) % 8)) | |
10 | #define PerlWarnIsSet_(a, x) ((a)[Perl_Warn_Off_(x)] & Perl_Warn_Bit_(x)) | |
599cee73 PM |
11 | |
12 | #define G_WARN_OFF 0 /* $^W == 0 */ | |
0453d815 | 13 | #define G_WARN_ON 1 /* -w flag and $^W != 0 */ |
599cee73 PM |
14 | #define G_WARN_ALL_ON 2 /* -W flag */ |
15 | #define G_WARN_ALL_OFF 4 /* -X flag */ | |
0453d815 | 16 | #define G_WARN_ONCE 8 /* set if 'once' ever enabled */ |
599cee73 PM |
17 | #define G_WARN_ALL_MASK (G_WARN_ALL_ON|G_WARN_ALL_OFF) |
18 | ||
84b2b14b | 19 | #define pWARN_STD NULL |
f8552c1a YO |
20 | #define pWARN_ALL &PL_WARN_ALL /* use warnings 'all' */ |
21 | #define pWARN_NONE &PL_WARN_NONE /* no warnings 'all' */ | |
599cee73 | 22 | |
d3a7d8c7 | 23 | #define specialWARN(x) ((x) == pWARN_STD || (x) == pWARN_ALL || \ |
9824c081 | 24 | (x) == pWARN_NONE) |
0d658bf5 | 25 | |
5f2d9966 | 26 | /* if PL_warnhook is set to this value, then warnings die */ |
06dcd5bf | 27 | #define PERL_WARNHOOK_FATAL (&PL_sv_placeholder) |
5f2d9966 | 28 | |
0d658bf5 PM |
29 | /* Warnings Categories added in Perl 5.008 */ |
30 | ||
3c3f8cd6 AB |
31 | #define WARN_ALL 0 |
32 | #define WARN_CLOSURE 1 | |
33 | #define WARN_DEPRECATED 2 | |
34 | #define WARN_EXITING 3 | |
35 | #define WARN_GLOB 4 | |
36 | #define WARN_IO 5 | |
37 | #define WARN_CLOSED 6 | |
38 | #define WARN_EXEC 7 | |
39 | #define WARN_LAYER 8 | |
40 | #define WARN_NEWLINE 9 | |
41 | #define WARN_PIPE 10 | |
42 | #define WARN_UNOPENED 11 | |
43 | #define WARN_MISC 12 | |
44 | #define WARN_NUMERIC 13 | |
45 | #define WARN_ONCE 14 | |
46 | #define WARN_OVERFLOW 15 | |
47 | #define WARN_PACK 16 | |
48 | #define WARN_PORTABLE 17 | |
49 | #define WARN_RECURSION 18 | |
50 | #define WARN_REDEFINE 19 | |
51 | #define WARN_REGEXP 20 | |
52 | #define WARN_SEVERE 21 | |
53 | #define WARN_DEBUGGING 22 | |
54 | #define WARN_INPLACE 23 | |
55 | #define WARN_INTERNAL 24 | |
56 | #define WARN_MALLOC 25 | |
57 | #define WARN_SIGNAL 26 | |
58 | #define WARN_SUBSTR 27 | |
59 | #define WARN_SYNTAX 28 | |
60 | #define WARN_AMBIGUOUS 29 | |
61 | #define WARN_BAREWORD 30 | |
62 | #define WARN_DIGIT 31 | |
63 | #define WARN_PARENTHESIS 32 | |
64 | #define WARN_PRECEDENCE 33 | |
65 | #define WARN_PRINTF 34 | |
66 | #define WARN_PROTOTYPE 35 | |
67 | #define WARN_QW 36 | |
68 | #define WARN_RESERVED 37 | |
69 | #define WARN_SEMICOLON 38 | |
70 | #define WARN_TAINT 39 | |
71 | #define WARN_THREADS 40 | |
72 | #define WARN_UNINITIALIZED 41 | |
73 | #define WARN_UNPACK 42 | |
74 | #define WARN_UNTIE 43 | |
75 | #define WARN_UTF8 44 | |
76 | #define WARN_VOID 45 | |
e476b1b5 | 77 | |
b88df990 NC |
78 | /* Warnings Categories added in Perl 5.011 */ |
79 | ||
3c3f8cd6 AB |
80 | #define WARN_IMPRECISION 46 |
81 | #define WARN_ILLEGALPROTO 47 | |
b88df990 | 82 | |
25991c51 YO |
83 | /* Warnings Categories added in Perl 5.011003 */ |
84 | ||
2d8fceed YO |
85 | #define WARN_DEPRECATED__GOTO_CONSTRUCT 48 |
86 | #define WARN_DEPRECATED__UNICODE_PROPERTY_NAME 49 | |
25991c51 | 87 | |
8457b38f KW |
88 | /* Warnings Categories added in Perl 5.013 */ |
89 | ||
2d8fceed YO |
90 | #define WARN_NON_UNICODE 50 |
91 | #define WARN_NONCHAR 51 | |
92 | #define WARN_SURROGATE 52 | |
8457b38f | 93 | |
6f87cb12 FC |
94 | /* Warnings Categories added in Perl 5.017 */ |
95 | ||
2d8fceed YO |
96 | #define WARN_EXPERIMENTAL 53 |
97 | #define WARN_EXPERIMENTAL__REGEX_SETS 54 | |
6f87cb12 | 98 | |
c8028aa6 TC |
99 | /* Warnings Categories added in Perl 5.019 */ |
100 | ||
2d8fceed | 101 | #define WARN_SYSCALLS 55 |
c8028aa6 | 102 | |
7ac92924 TC |
103 | /* Warnings Categories added in Perl 5.021 */ |
104 | ||
2d8fceed YO |
105 | #define WARN_EXPERIMENTAL__CONST_ATTR 56 |
106 | #define WARN_EXPERIMENTAL__RE_STRICT 57 | |
107 | #define WARN_EXPERIMENTAL__REFALIASING 58 | |
108 | #define WARN_LOCALE 59 | |
109 | #define WARN_MISSING 60 | |
110 | #define WARN_REDUNDANT 61 | |
3c3f8cd6 | 111 | |
88d5dae9 FC |
112 | /* Warnings Categories added in Perl 5.025 */ |
113 | ||
2d8fceed | 114 | #define WARN_EXPERIMENTAL__DECLARED_REFS 62 |
88d5dae9 | 115 | |
21b005c9 YO |
116 | /* Warnings Categories added in Perl 5.025011 */ |
117 | ||
2d8fceed | 118 | #define WARN_DEPRECATED__DOT_IN_INC 63 |
21b005c9 | 119 | |
52e3acf8 Z |
120 | /* Warnings Categories added in Perl 5.027 */ |
121 | ||
2d8fceed | 122 | #define WARN_SHADOW 64 |
52e3acf8 | 123 | |
21c34e97 KW |
124 | /* Warnings Categories added in Perl 5.029 */ |
125 | ||
2d8fceed YO |
126 | #define WARN_EXPERIMENTAL__PRIVATE_USE 65 |
127 | #define WARN_EXPERIMENTAL__UNIPROP_WILDCARDS 66 | |
128 | #define WARN_EXPERIMENTAL__VLB 67 | |
a1325b90 PE |
129 | |
130 | /* Warnings Categories added in Perl 5.033 */ | |
131 | ||
2d8fceed | 132 | #define WARN_EXPERIMENTAL__TRY 68 |
f79e2ff9 PE |
133 | |
134 | /* Warnings Categories added in Perl 5.035 */ | |
135 | ||
2d8fceed YO |
136 | #define WARN_EXPERIMENTAL__ARGS_ARRAY_WITH_SIGNATURES 69 |
137 | #define WARN_EXPERIMENTAL__BUILTIN 70 | |
138 | #define WARN_EXPERIMENTAL__DEFER 71 | |
139 | #define WARN_EXPERIMENTAL__EXTRA_PAIRED_DELIMITERS 72 | |
140 | #define WARN_EXPERIMENTAL__FOR_LIST 73 | |
141 | #define WARN_SCALAR 74 | |
99b497aa | 142 | |
b689ed93 YO |
143 | /* Warnings Categories added in Perl 5.035009 */ |
144 | ||
145 | #define WARN_DEPRECATED__VERSION_DOWNGRADE 75 | |
146 | ||
71e49ade YO |
147 | /* Warnings Categories added in Perl 5.03501 */ |
148 | ||
b689ed93 | 149 | #define WARN_DEPRECATED__DELIMITER_WILL_BE_PAIRED 76 |
71e49ade | 150 | |
99b497aa PE |
151 | /* Warnings Categories added in Perl 5.037 */ |
152 | ||
b689ed93 | 153 | #define WARN_EXPERIMENTAL__CLASS 77 |
d81b4f93 YO |
154 | |
155 | /* Warnings Categories added in Perl 5.037009 */ | |
156 | ||
b689ed93 | 157 | #define WARN_DEPRECATED__APOSTROPHE_AS_PACKAGE_SEPARATOR 78 |
25676a74 YO |
158 | |
159 | /* Warnings Categories added in Perl 5.03701 */ | |
160 | ||
b689ed93 | 161 | #define WARN_DEPRECATED__SMARTMATCH 79 |
25676a74 YO |
162 | #define WARNsize 20 |
163 | #define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125" | |
164 | #define WARN_NONEstring "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | |
599cee73 | 165 | |
a2637ca0 | 166 | #define isLEXWARN_on \ |
9824c081 | 167 | cBOOL(PL_curcop && PL_curcop->cop_warnings != pWARN_STD) |
a2637ca0 | 168 | #define isLEXWARN_off \ |
9824c081 | 169 | cBOOL(!PL_curcop || PL_curcop->cop_warnings == pWARN_STD) |
d5a71f30 | 170 | #define isWARN_ONCE (PL_dowarn & (G_WARN_ON|G_WARN_ONCE)) |
f8552c1a | 171 | #define hasWARNBIT(c,x) (RCPV_LEN(c) > (2*(x)/8)) |
f0774ef1 | 172 | #define isWARN_on(c,x) (hasWARNBIT(c,x) \ |
f8552c1a | 173 | ? PerlWarnIsSet_((U8 *)(c), 2*(x)) \ |
f0774ef1 YO |
174 | : 0) |
175 | #define isWARNf_on(c,x) (hasWARNBIT(c,x) \ | |
f8552c1a | 176 | ? PerlWarnIsSet_((U8 *)(c), 2*(x)+1) \ |
f0774ef1 | 177 | : 0) |
72dc9ed5 | 178 | |
c1e47bad | 179 | #define DUP_WARNINGS(p) Perl_dup_warnings(aTHX_ p) |
d5a71f30 | 180 | |
94c8b9c1 | 181 | #define free_and_set_cop_warnings(cmp,w) STMT_START { \ |
f8552c1a | 182 | if (!specialWARN((cmp)->cop_warnings)) rcpv_free((cmp)->cop_warnings); \ |
1943af61 | 183 | (cmp)->cop_warnings = w; \ |
94c8b9c1 N |
184 | } STMT_END |
185 | ||
feff94e1 KW |
186 | /* |
187 | ||
188 | =head1 Warning and Dieing | |
189 | ||
bb3eff5d KW |
190 | In all these calls, the C<U32 wI<n>> parameters are warning category |
191 | constants. You can see the ones currently available in | |
192 | L<warnings/Category Hierarchy>, just capitalize all letters in the names | |
193 | and prefix them by C<WARN_>. So, for example, the category C<void> used in a | |
194 | perl program becomes C<WARN_VOID> when used in XS code and passed to one of | |
195 | the calls below. | |
196 | ||
feff94e1 | 197 | =for apidoc Am|bool|ckWARN|U32 w |
0afc88d2 KW |
198 | =for apidoc_item ||ckWARN2|U32 w1|U32 w2 |
199 | =for apidoc_item ||ckWARN3|U32 w1|U32 w2|U32 w3 | |
200 | =for apidoc_item ||ckWARN4|U32 w1|U32 w2|U32 w3|U32 w4 | |
201 | These return a boolean as to whether or not warnings are enabled for any of | |
202 | the warning category(ies) parameters: C<w>, C<w1>, .... | |
feff94e1 | 203 | |
0afc88d2 KW |
204 | Should any of the categories by default be enabled even if not within the |
205 | scope of S<C<use warnings>>, instead use the C<L</ckWARN_d>> macros. | |
feff94e1 | 206 | |
0afc88d2 KW |
207 | The categories must be completely independent, one may not be subclassed from |
208 | the other. | |
feff94e1 | 209 | |
0afc88d2 | 210 | =for apidoc Am|bool|ckWARN_d|U32 w |
b8a2649a KW |
211 | =for apidoc_item ||ckWARN2_d|U32 w1|U32 w2 |
212 | =for apidoc_item ||ckWARN3_d|U32 w1|U32 w2|U32 w3 | |
213 | =for apidoc_item ||ckWARN4_d|U32 w1|U32 w2|U32 w3|U32 w4 | |
feff94e1 | 214 | |
0afc88d2 | 215 | Like C<L</ckWARN>>, but for use if and only if the warning category(ies) is by |
feff94e1 KW |
216 | default enabled even if not within the scope of S<C<use warnings>>. |
217 | ||
b8a2649a KW |
218 | =for apidoc Am|U32|packWARN|U32 w1 |
219 | =for apidoc_item ||packWARN2|U32 w1|U32 w2 | |
220 | =for apidoc_item ||packWARN3|U32 w1|U32 w2|U32 w3 | |
221 | =for apidoc_item ||packWARN4|U32 w1|U32 w2|U32 w3|U32 w4 | |
222 | ||
223 | These macros are used to pack warning categories into a single U32 to pass to | |
224 | macros and functions that take a warning category parameter. The number of | |
225 | categories to pack is given by the name, with a corresponding number of | |
226 | category parameters passed. | |
feff94e1 KW |
227 | |
228 | =cut | |
229 | ||
230 | */ | |
231 | ||
f54ba1c2 | 232 | #define ckWARN(w) Perl_ckwarn(aTHX_ packWARN(w)) |
7c08c4c5 KW |
233 | |
234 | /* The w1, w2 ... should be independent warnings categories; one shouldn't be | |
235 | * a subcategory of any other */ | |
236 | ||
f54ba1c2 DM |
237 | #define ckWARN2(w1,w2) Perl_ckwarn(aTHX_ packWARN2(w1,w2)) |
238 | #define ckWARN3(w1,w2,w3) Perl_ckwarn(aTHX_ packWARN3(w1,w2,w3)) | |
239 | #define ckWARN4(w1,w2,w3,w4) Perl_ckwarn(aTHX_ packWARN4(w1,w2,w3,w4)) | |
240 | ||
241 | #define ckWARN_d(w) Perl_ckwarn_d(aTHX_ packWARN(w)) | |
242 | #define ckWARN2_d(w1,w2) Perl_ckwarn_d(aTHX_ packWARN2(w1,w2)) | |
243 | #define ckWARN3_d(w1,w2,w3) Perl_ckwarn_d(aTHX_ packWARN3(w1,w2,w3)) | |
244 | #define ckWARN4_d(w1,w2,w3,w4) Perl_ckwarn_d(aTHX_ packWARN4(w1,w2,w3,w4)) | |
12bcd1a6 | 245 | |
98fe6610 NC |
246 | #define WARNshift 8 |
247 | ||
3b9e3074 | 248 | #define packWARN(a) (a ) |
7c08c4c5 KW |
249 | |
250 | /* The a, b, ... should be independent warnings categories; one shouldn't be | |
251 | * a subcategory of any other */ | |
252 | ||
3b9e3074 SH |
253 | #define packWARN2(a,b) ((a) | ((b)<<8) ) |
254 | #define packWARN3(a,b,c) ((a) | ((b)<<8) | ((c)<<16) ) | |
255 | #define packWARN4(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d) <<24)) | |
12bcd1a6 | 256 | |
0132fc56 KW |
257 | #define unpackWARN1(x) ((U8) (x) ) |
258 | #define unpackWARN2(x) ((U8) ((x) >> 8)) | |
259 | #define unpackWARN3(x) ((U8) ((x) >> 16)) | |
260 | #define unpackWARN4(x) ((U8) ((x) >> 24)) | |
12bcd1a6 PM |
261 | |
262 | #define ckDEAD(x) \ | |
006c1a1d Z |
263 | (PL_curcop && \ |
264 | !specialWARN(PL_curcop->cop_warnings) && \ | |
265 | (isWARNf_on(PL_curcop->cop_warnings, unpackWARN1(x)) || \ | |
266 | (unpackWARN2(x) && \ | |
9824c081 MS |
267 | (isWARNf_on(PL_curcop->cop_warnings, unpackWARN2(x)) || \ |
268 | (unpackWARN3(x) && \ | |
269 | (isWARNf_on(PL_curcop->cop_warnings, unpackWARN3(x)) || \ | |
270 | (unpackWARN4(x) && \ | |
271 | isWARNf_on(PL_curcop->cop_warnings, unpackWARN4(x))))))))) | |
12bcd1a6 | 272 | |
c286f332 KW |
273 | |
274 | ||
275 | /* | |
276 | =for apidoc Amnh||WARN_ALL | |
277 | =for apidoc Amnh||WARN_CLOSURE | |
278 | =for apidoc Amnh||WARN_DEPRECATED | |
279 | =for apidoc Amnh||WARN_EXITING | |
280 | =for apidoc Amnh||WARN_GLOB | |
281 | =for apidoc Amnh||WARN_IO | |
282 | =for apidoc Amnh||WARN_CLOSED | |
283 | =for apidoc Amnh||WARN_EXEC | |
284 | =for apidoc Amnh||WARN_LAYER | |
285 | =for apidoc Amnh||WARN_NEWLINE | |
286 | =for apidoc Amnh||WARN_PIPE | |
287 | =for apidoc Amnh||WARN_UNOPENED | |
288 | =for apidoc Amnh||WARN_MISC | |
289 | =for apidoc Amnh||WARN_NUMERIC | |
290 | =for apidoc Amnh||WARN_ONCE | |
291 | =for apidoc Amnh||WARN_OVERFLOW | |
292 | =for apidoc Amnh||WARN_PACK | |
293 | =for apidoc Amnh||WARN_PORTABLE | |
294 | =for apidoc Amnh||WARN_RECURSION | |
295 | =for apidoc Amnh||WARN_REDEFINE | |
296 | =for apidoc Amnh||WARN_REGEXP | |
297 | =for apidoc Amnh||WARN_SEVERE | |
298 | =for apidoc Amnh||WARN_DEBUGGING | |
299 | =for apidoc Amnh||WARN_INPLACE | |
300 | =for apidoc Amnh||WARN_INTERNAL | |
301 | =for apidoc Amnh||WARN_MALLOC | |
302 | =for apidoc Amnh||WARN_SIGNAL | |
303 | =for apidoc Amnh||WARN_SUBSTR | |
304 | =for apidoc Amnh||WARN_SYNTAX | |
305 | =for apidoc Amnh||WARN_AMBIGUOUS | |
306 | =for apidoc Amnh||WARN_BAREWORD | |
307 | =for apidoc Amnh||WARN_DIGIT | |
308 | =for apidoc Amnh||WARN_PARENTHESIS | |
309 | =for apidoc Amnh||WARN_PRECEDENCE | |
310 | =for apidoc Amnh||WARN_PRINTF | |
311 | =for apidoc Amnh||WARN_PROTOTYPE | |
312 | =for apidoc Amnh||WARN_QW | |
313 | =for apidoc Amnh||WARN_RESERVED | |
314 | =for apidoc Amnh||WARN_SEMICOLON | |
315 | =for apidoc Amnh||WARN_TAINT | |
316 | =for apidoc Amnh||WARN_THREADS | |
317 | =for apidoc Amnh||WARN_UNINITIALIZED | |
318 | =for apidoc Amnh||WARN_UNPACK | |
319 | =for apidoc Amnh||WARN_UNTIE | |
320 | =for apidoc Amnh||WARN_UTF8 | |
321 | =for apidoc Amnh||WARN_VOID | |
322 | =for apidoc Amnh||WARN_IMPRECISION | |
323 | =for apidoc Amnh||WARN_ILLEGALPROTO | |
2d8fceed | 324 | =for apidoc Amnh||WARN_DEPRECATED__GOTO_CONSTRUCT |
25991c51 | 325 | =for apidoc Amnh||WARN_DEPRECATED__UNICODE_PROPERTY_NAME |
c286f332 KW |
326 | =for apidoc Amnh||WARN_NON_UNICODE |
327 | =for apidoc Amnh||WARN_NONCHAR | |
328 | =for apidoc Amnh||WARN_SURROGATE | |
329 | =for apidoc Amnh||WARN_EXPERIMENTAL | |
c286f332 | 330 | =for apidoc Amnh||WARN_EXPERIMENTAL__REGEX_SETS |
c286f332 | 331 | =for apidoc Amnh||WARN_SYSCALLS |
c286f332 KW |
332 | =for apidoc Amnh||WARN_EXPERIMENTAL__CONST_ATTR |
333 | =for apidoc Amnh||WARN_EXPERIMENTAL__RE_STRICT | |
334 | =for apidoc Amnh||WARN_EXPERIMENTAL__REFALIASING | |
c286f332 KW |
335 | =for apidoc Amnh||WARN_LOCALE |
336 | =for apidoc Amnh||WARN_MISSING | |
337 | =for apidoc Amnh||WARN_REDUNDANT | |
338 | =for apidoc Amnh||WARN_EXPERIMENTAL__DECLARED_REFS | |
21b005c9 | 339 | =for apidoc Amnh||WARN_DEPRECATED__DOT_IN_INC |
c286f332 KW |
340 | =for apidoc Amnh||WARN_SHADOW |
341 | =for apidoc Amnh||WARN_EXPERIMENTAL__PRIVATE_USE | |
342 | =for apidoc Amnh||WARN_EXPERIMENTAL__UNIPROP_WILDCARDS | |
343 | =for apidoc Amnh||WARN_EXPERIMENTAL__VLB | |
a1325b90 | 344 | =for apidoc Amnh||WARN_EXPERIMENTAL__TRY |
1c547c3e | 345 | =for apidoc Amnh||WARN_EXPERIMENTAL__ARGS_ARRAY_WITH_SIGNATURES |
59802880 | 346 | =for apidoc Amnh||WARN_EXPERIMENTAL__BUILTIN |
f79e2ff9 | 347 | =for apidoc Amnh||WARN_EXPERIMENTAL__DEFER |
9c9853e8 | 348 | =for apidoc Amnh||WARN_EXPERIMENTAL__EXTRA_PAIRED_DELIMITERS |
3b54923c | 349 | =for apidoc Amnh||WARN_EXPERIMENTAL__FOR_LIST |
4c58833d | 350 | =for apidoc Amnh||WARN_SCALAR |
b689ed93 | 351 | =for apidoc Amnh||WARN_DEPRECATED__VERSION_DOWNGRADE |
71e49ade | 352 | =for apidoc Amnh||WARN_DEPRECATED__DELIMITER_WILL_BE_PAIRED |
99b497aa | 353 | =for apidoc Amnh||WARN_EXPERIMENTAL__CLASS |
25676a74 | 354 | =for apidoc Amnh||WARN_DEPRECATED__APOSTROPHE_AS_PACKAGE_SEPARATOR |
d81b4f93 | 355 | =for apidoc Amnh||WARN_DEPRECATED__SMARTMATCH |
c286f332 KW |
356 | |
357 | =cut | |
358 | */ | |
359 | ||
4438c4b7 | 360 | /* end of file warnings.h */ |
ce716c52 | 361 | |
b7eedb08 | 362 | /* ex: set ro ft=c: */ |