This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
various tweaks; result passes all tests for normal build on Solaris;
[perl5.git] / warning.h
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            (PL_curcop->cop_warnings != WARN_ALL &&                      \
23             PL_curcop->cop_warnings != WARN_NONE &&                     \
24             IsSet(SvPVX(PL_curcop->cop_warnings), 2*x+1))
25
26 #define ckWARN(x)                                                       \
27         ( (PL_curcop->cop_warnings &&                                   \
28               (PL_curcop->cop_warnings == WARN_ALL ||                   \
29                IsSet(SvPVX(PL_curcop->cop_warnings), 2*x) ) )           \
30           || (PL_dowarn & G_WARN_ON) )
31
32 #define ckWARN2(x,y)                                                    \
33           ( (PL_curcop->cop_warnings &&                                 \
34               (PL_curcop->cop_warnings == WARN_ALL ||                   \
35                 IsSet(SvPVX(PL_curcop->cop_warnings), 2*x)  ||          \
36                 IsSet(SvPVX(PL_curcop->cop_warnings), 2*y) ) )          \
37             ||  (PL_dowarn & G_WARN_ON) )
38
39 #else
40
41 #define ckDEAD(x)                                                       \
42            (PL_curcop->cop_warnings != WARN_ALL &&                      \
43             PL_curcop->cop_warnings != WARN_NONE &&                     \
44             SvPVX(PL_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           PL_curcop->cop_warnings &&                                    \
49           ( PL_curcop->cop_warnings == WARN_ALL ||                      \
50             SvPVX(PL_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           PL_curcop->cop_warnings &&                                    \
55           ( PL_curcop->cop_warnings == WARN_ALL ||                      \
56             SvPVX(PL_curcop->cop_warnings)[Off(2*x)] & Bit(2*x) ||      \
57             SvPVX(PL_curcop->cop_warnings)[Off(2*y)] & Bit(2*y) ) ) ) 
58
59 #endif
60
61 #define WARN_NONE               NULL
62 #define WARN_ALL                (&PL_sv_yes)
63
64 #define WARN_DEFAULT            0
65 #define WARN_IO                 1
66 #define WARN_CLOSED             2
67 #define WARN_EXEC               3
68 #define WARN_NEWLINE            4
69 #define WARN_PIPE               5
70 #define WARN_UNOPENED           6
71 #define WARN_MISC               7
72 #define WARN_NUMERIC            8
73 #define WARN_ONCE               9
74 #define WARN_RECURSION          10
75 #define WARN_REDEFINE           11
76 #define WARN_SYNTAX             12
77 #define WARN_AMBIGUOUS          13
78 #define WARN_DEPRECATED         14
79 #define WARN_OCTAL              15
80 #define WARN_PARENTHESIS        16
81 #define WARN_PRECEDENCE         17
82 #define WARN_PRINTF             18
83 #define WARN_RESERVED           19
84 #define WARN_SEMICOLON          20
85 #define WARN_UNINITIALIZED      21
86 #define WARN_UNSAFE             22
87 #define WARN_CLOSURE            23
88 #define WARN_SIGNAL             24
89 #define WARN_SUBSTR             25
90 #define WARN_TAINT              26
91 #define WARN_UNTIE              27
92 #define WARN_UTF8               28
93 #define WARN_VOID               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