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