sprintf2.t: mark TODO bad denorm values under g++
[perl.git] / feature.h
1 /* -*- buffer-read-only: t -*-
2    !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
3    This file is built by regen/feature.pl.
4    Any changes made here will be lost!
5  */
6
7
8 #if defined(PERL_CORE) || defined (PERL_EXT)
9
10 #define HINT_FEATURE_SHIFT      26
11
12 #define FEATURE_BUNDLE_DEFAULT  0
13 #define FEATURE_BUNDLE_510      1
14 #define FEATURE_BUNDLE_511      2
15 #define FEATURE_BUNDLE_515      3
16 #define FEATURE_BUNDLE_523      4
17 #define FEATURE_BUNDLE_527      5
18 #define FEATURE_BUNDLE_CUSTOM   (HINT_FEATURE_MASK >> HINT_FEATURE_SHIFT)
19
20 #define CURRENT_HINTS \
21     (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints)
22 #define CURRENT_FEATURE_BUNDLE \
23     ((CURRENT_HINTS & HINT_FEATURE_MASK) >> HINT_FEATURE_SHIFT)
24
25 /* Avoid using ... && Perl_feature_is_enabled(...) as that triggers a bug in
26    the HP-UX cc on PA-RISC */
27 #define FEATURE_IS_ENABLED(name)                                        \
28         ((CURRENT_HINTS                                                  \
29            & HINT_LOCALIZE_HH)                                            \
30             ? Perl_feature_is_enabled(aTHX_ STR_WITH_LEN(name)) : FALSE)
31 /* The longest string we pass in.  */
32 #define MAX_FEATURE_LEN (sizeof("postderef_qq")-1)
33
34 #define FEATURE_FC_IS_ENABLED \
35     ( \
36         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \
37          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
38      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
39          FEATURE_IS_ENABLED("fc")) \
40     )
41
42 #define FEATURE_SAY_IS_ENABLED \
43     ( \
44         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \
45          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
46      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
47          FEATURE_IS_ENABLED("say")) \
48     )
49
50 #define FEATURE_STATE_IS_ENABLED \
51     ( \
52         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \
53          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
54      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
55          FEATURE_IS_ENABLED("state")) \
56     )
57
58 #define FEATURE_SWITCH_IS_ENABLED \
59     ( \
60         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \
61          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
62      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
63          FEATURE_IS_ENABLED("switch")) \
64     )
65
66 #define FEATURE_BITWISE_IS_ENABLED \
67     ( \
68         CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_527 \
69      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
70          FEATURE_IS_ENABLED("bitwise")) \
71     )
72
73 #define FEATURE_EVALBYTES_IS_ENABLED \
74     ( \
75         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \
76          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
77      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
78          FEATURE_IS_ENABLED("evalbytes")) \
79     )
80
81 #define FEATURE_ARYBASE_IS_ENABLED \
82     ( \
83         CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_511 \
84      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
85          FEATURE_IS_ENABLED("arybase")) \
86     )
87
88 #define FEATURE_SIGNATURES_IS_ENABLED \
89     ( \
90         CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
91          FEATURE_IS_ENABLED("signatures") \
92     )
93
94 #define FEATURE___SUB___IS_ENABLED \
95     ( \
96         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \
97          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
98      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
99          FEATURE_IS_ENABLED("__SUB__")) \
100     )
101
102 #define FEATURE_REFALIASING_IS_ENABLED \
103     ( \
104         CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
105          FEATURE_IS_ENABLED("refaliasing") \
106     )
107
108 #define FEATURE_POSTDEREF_QQ_IS_ENABLED \
109     ( \
110         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_523 && \
111          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
112      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
113          FEATURE_IS_ENABLED("postderef_qq")) \
114     )
115
116 #define FEATURE_UNIEVAL_IS_ENABLED \
117     ( \
118         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \
119          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
120      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
121          FEATURE_IS_ENABLED("unieval")) \
122     )
123
124 #define FEATURE_MYREF_IS_ENABLED \
125     ( \
126         CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
127          FEATURE_IS_ENABLED("myref") \
128     )
129
130 #define FEATURE_UNICODE_IS_ENABLED \
131     ( \
132         (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_511 && \
133          CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \
134      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
135          FEATURE_IS_ENABLED("unicode")) \
136     )
137
138
139 #endif /* PERL_CORE or PERL_EXT */
140
141 #ifdef PERL_IN_OP_C
142 PERL_STATIC_INLINE void
143 S_enable_feature_bundle(pTHX_ SV *ver)
144 {
145     SV *comp_ver = sv_newmortal();
146     PL_hints = (PL_hints &~ HINT_FEATURE_MASK)
147              | (
148                   (sv_setnv(comp_ver, 5.027),
149                    vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
150                         ? FEATURE_BUNDLE_527 :
151                   (sv_setnv(comp_ver, 5.023),
152                    vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
153                         ? FEATURE_BUNDLE_523 :
154                   (sv_setnv(comp_ver, 5.015),
155                    vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
156                         ? FEATURE_BUNDLE_515 :
157                   (sv_setnv(comp_ver, 5.011),
158                    vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
159                         ? FEATURE_BUNDLE_511 :
160                   (sv_setnv(comp_ver, 5.009005),
161                    vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
162                         ? FEATURE_BUNDLE_510 :
163                           FEATURE_BUNDLE_DEFAULT
164                ) << HINT_FEATURE_SHIFT;
165     /* special case */
166     assert(PL_curcop == &PL_compiling);
167     if (FEATURE_UNICODE_IS_ENABLED) PL_hints |=  HINT_UNI_8_BIT;
168     else                            PL_hints &= ~HINT_UNI_8_BIT;
169 }
170 #endif /* PERL_IN_OP_C */
171
172 /* ex: set ro: */