This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
lexical warnings; tweaks to places that didn't apply correctly
[perl5.git] / warning.h
CommitLineData
599cee73
PM
1/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
2 This file is built by warning.pl
3 Any changes made here will be lost!
4*/
5
6
7#define Off(x) ((x) / 8)
8#define Bit(x) (1 << ((x) % 8))
9#define IsSet(a, x) ((a)[Off(x)] & Bit(x))
10
11#define G_WARN_OFF 0 /* $^W == 0 */
12#define G_WARN_ON 1 /* $^W != 0 */
13#define G_WARN_ALL_ON 2 /* -W flag */
14#define G_WARN_ALL_OFF 4 /* -X flag */
15#define G_WARN_ALL_MASK (G_WARN_ALL_ON|G_WARN_ALL_OFF)
16
17#if 1
18
19/* Part of the logic below assumes that WARN_NONE is NULL */
20
21#define ckDEAD(x) \
22 (curcop->cop_warnings != WARN_ALL && \
23 curcop->cop_warnings != WARN_NONE && \
24 IsSet(SvPVX(curcop->cop_warnings), 2*x+1))
25
26#define ckWARN(x) \
27 ( (curcop->cop_warnings && \
28 (curcop->cop_warnings == WARN_ALL || \
29 IsSet(SvPVX(curcop->cop_warnings), 2*x) ) ) \
30 || (PL_dowarn & G_WARN_ON) )
31
32#define ckWARN2(x,y) \
33 ( (curcop->cop_warnings && \
34 (curcop->cop_warnings == WARN_ALL || \
35 IsSet(SvPVX(curcop->cop_warnings), 2*x) || \
36 IsSet(SvPVX(curcop->cop_warnings), 2*y) ) ) \
37 || (PL_dowarn & G_WARN_ON) )
38
39#else
40
41#define ckDEAD(x) \
42 (curcop->cop_warnings != WARN_ALL && \
43 curcop->cop_warnings != WARN_NONE && \
44 SvPVX(curcop->cop_warnings)[Off(2*x+1)] & Bit(2*x+1) )
45
46#define ckWARN(x) \
47 ( (PL_dowarn & G_WARN_ON) || ( (PL_dowarn & G_WARN_DISABLE) && \
48 curcop->cop_warnings && \
49 ( curcop->cop_warnings == WARN_ALL || \
50 SvPVX(curcop->cop_warnings)[Off(2*x)] & Bit(2*x) ) ) )
51
52#define ckWARN2(x,y) \
53 ( (PL_dowarn & G_WARN_ON) || ( (PL_dowarn & G_WARN_DISABLE) && \
54 curcop->cop_warnings && \
55 ( curcop->cop_warnings == WARN_ALL || \
56 SvPVX(curcop->cop_warnings)[Off(2*x)] & Bit(2*x) || \
57 SvPVX(curcop->cop_warnings)[Off(2*y)] & Bit(2*y) ) ) )
58
59#endif
60
61#define WARN_NONE NULL
62#define WARN_ALL (&sv_yes)
63
64#define WARN_REDEFINE 0
65#define WARN_VOID 1
66#define WARN_UNSAFE 2
67#define WARN_TAINT 3
68#define WARN_SUBSTR 4
69#define WARN_CLOSURE 5
70#define WARN_UNTIE 6
71#define WARN_SIGNAL 7
72#define WARN_UTF8 8
73#define WARN_NUMERIC 9
74#define WARN_DEFAULT 10
75#define WARN_ONCE 11
76#define WARN_SYNTAX 12
77#define WARN_RESERVED 13
78#define WARN_DEPRECATED 14
79#define WARN_SEMICOLON 15
80#define WARN_PRINTF 16
81#define WARN_OCTAL 17
82#define WARN_AMBIGUOUS 18
83#define WARN_PARENTHESIS 19
84#define WARN_PRECEDENCE 20
85#define WARN_IO 21
86#define WARN_NEWLINE 22
87#define WARN_CLOSED 23
88#define WARN_EXEC 24
89#define WARN_UNOPENED 25
90#define WARN_PIPE 26
91#define WARN_UNINITIALIZED 27
92#define WARN_RECURSION 28
93#define WARN_MISC 29
94
95#define WARNsize 8
96#define WARN_ALLstring "\125\125\125\125\125\125\125\125"
97#define WARN_NONEstring "\0\0\0\0\0\0\0\0"
98
99/* end of file warning.h */
100