File Coverage

feature.h
Criterion Covered Total %
statement 11 11 100.0
branch 7 24 29.2
condition n/a
subroutine n/a
total 18 35 51.4


line stmt bran cond sub time code
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_CUSTOM (HINT_FEATURE_MASK >> HINT_FEATURE_SHIFT)
17            
18           #define CURRENT_HINTS \
19           (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints)
20           #define CURRENT_FEATURE_BUNDLE \
21           ((CURRENT_HINTS & HINT_FEATURE_MASK) >> HINT_FEATURE_SHIFT)
22            
23           /* Avoid using ... && Perl_feature_is_enabled(...) as that triggers a bug in
24           the HP-UX cc on PA-RISC */
25           #define FEATURE_IS_ENABLED(name) \
26           ((CURRENT_HINTS \
27           & HINT_LOCALIZE_HH) \
28           ? Perl_feature_is_enabled(aTHX_ STR_WITH_LEN(name)) : FALSE)
29           /* The longest string we pass in. */
30           #define MAX_FEATURE_LEN (sizeof("evalbytes")-1)
31            
32           #define FEATURE_FC_IS_ENABLED \
33           ( \
34           CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \
35           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
36           FEATURE_IS_ENABLED("fc")) \
37           )
38            
39           #define FEATURE_SAY_IS_ENABLED \
40           ( \
41           (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \
42           CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_515) \
43           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
44           FEATURE_IS_ENABLED("say")) \
45           )
46            
47           #define FEATURE_STATE_IS_ENABLED \
48           ( \
49           (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \
50           CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_515) \
51           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
52           FEATURE_IS_ENABLED("state")) \
53           )
54            
55           #define FEATURE_SWITCH_IS_ENABLED \
56           ( \
57           (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \
58           CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_515) \
59           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
60           FEATURE_IS_ENABLED("switch")) \
61           )
62            
63           #define FEATURE_EVALBYTES_IS_ENABLED \
64           ( \
65           CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \
66           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
67           FEATURE_IS_ENABLED("evalbytes")) \
68           )
69            
70           #define FEATURE_ARYBASE_IS_ENABLED \
71           ( \
72           CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_511 \
73           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
74           FEATURE_IS_ENABLED("arybase")) \
75           )
76            
77           #define FEATURE___SUB___IS_ENABLED \
78           ( \
79           CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \
80           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
81           FEATURE_IS_ENABLED("__SUB__")) \
82           )
83            
84           #define FEATURE_LEXSUBS_IS_ENABLED \
85           ( \
86           CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
87           FEATURE_IS_ENABLED("lexsubs") \
88           )
89            
90           #define FEATURE_UNIEVAL_IS_ENABLED \
91           ( \
92           CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \
93           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
94           FEATURE_IS_ENABLED("unieval")) \
95           )
96            
97           #define FEATURE_UNICODE_IS_ENABLED \
98           ( \
99           (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_511 && \
100           CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_515) \
101           || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \
102           FEATURE_IS_ENABLED("unicode")) \
103           )
104            
105            
106           #endif /* PERL_CORE or PERL_EXT */
107            
108           #ifdef PERL_IN_OP_C
109           PERL_STATIC_INLINE void
110           S_enable_feature_bundle(pTHX_ SV *ver)
111           {
112 81194         SV *comp_ver = sv_newmortal();
113 162388         PL_hints = (PL_hints &~ HINT_FEATURE_MASK)
114 243286         | (
115 81194         (sv_setnv(comp_ver, 5.015),
116 81194         vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
117           ? FEATURE_BUNDLE_515 :
118 81148         (sv_setnv(comp_ver, 5.011),
119 81148         vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
120           ? FEATURE_BUNDLE_511 :
121 80944         (sv_setnv(comp_ver, 5.009005),
122 80944         vcmp(ver, upg_version(comp_ver, FALSE)) >= 0)
123           ? FEATURE_BUNDLE_510 :
124           FEATURE_BUNDLE_DEFAULT
125           ) << HINT_FEATURE_SHIFT;
126           /* special case */
127           assert(PL_curcop == &PL_compiling);
128 81194 50       if (FEATURE_UNICODE_IS_ENABLED) PL_hints |= HINT_UNI_8_BIT;
    100        
    0        
    50        
    50        
    0        
    50        
    50        
    0        
    0        
    0        
    0        
129 80944         else PL_hints &= ~HINT_UNI_8_BIT;
130           }
131           #endif /* PERL_IN_OP_C */
132            
133           /* ex: set ro: */