| 1 |
|
| /* |
| 2 |
|
| * This file was generated automatically by ExtUtils::ParseXS version 3.63 from the |
| 3 |
|
| * contents of SealRequireHints.xs. Do not edit this file, edit SealRequireHints.xs instead. |
| 4 |
|
| * |
| 5 |
|
| * ANY CHANGES MADE HERE WILL BE LOST! |
| 6 |
|
| * |
| 7 |
|
| */ |
| 8 |
|
| |
| 9 |
|
| #line 1 "lib/Lexical/SealRequireHints.xs" |
| 10 |
|
| #define PERL_NO_GET_CONTEXT 1 |
| 11 |
|
| #include "EXTERN.h" |
| 12 |
|
| #include "perl.h" |
| 13 |
|
| #include "XSUB.h" |
| 14 |
|
| |
| 15 |
|
| #define Q_PERL_VERSION_DECIMAL(r,v,s) ((r)*1000000 + (v)*1000 + (s)) |
| 16 |
|
| #define Q_PERL_DECIMAL_VERSION \ |
| 17 |
|
| Q_PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
| 18 |
|
| #define Q_PERL_VERSION_GE(r,v,s) \ |
| 19 |
|
| (Q_PERL_DECIMAL_VERSION >= Q_PERL_VERSION_DECIMAL(r,v,s)) |
| 20 |
|
| |
| 21 |
|
| #if !Q_PERL_VERSION_GE(5,7,2) |
| 22 |
|
| # undef dNOOP |
| 23 |
|
| # define dNOOP extern int Perl___notused_func(void) |
| 24 |
|
| #endif /* <5.7.2 */ |
| 25 |
|
| |
| 26 |
|
| #ifndef cBOOL |
| 27 |
|
| # define cBOOL(x) ((bool)!!(x)) |
| 28 |
|
| #endif /* !cBOOL */ |
| 29 |
|
| |
| 30 |
|
| #ifndef croak |
| 31 |
|
| # define croak Perl_croak_nocontext |
| 32 |
|
| #endif /* !croak */ |
| 33 |
|
| |
| 34 |
|
| #ifndef hv_existss |
| 35 |
|
| # define hv_existss(hv, key) hv_exists(hv, "" key "", sizeof(key)-1) |
| 36 |
|
| #endif /* !hv_existss */ |
| 37 |
|
| |
| 38 |
|
| #ifndef hv_stores |
| 39 |
|
| # define hv_stores(hv, key, val) hv_store(hv, "" key "", sizeof(key)-1, val, 0) |
| 40 |
|
| #endif /* !hv_stores */ |
| 41 |
|
| |
| 42 |
|
| #define Q_MUST_WORKAROUND (!Q_PERL_VERSION_GE(5,12,0)) |
| 43 |
|
| #define Q_HAVE_COP_HINTS_HASH Q_PERL_VERSION_GE(5,9,4) |
| 44 |
|
| |
| 45 |
|
| #if Q_MUST_WORKAROUND |
| 46 |
|
| |
| 47 |
|
| # if !Q_PERL_VERSION_GE(5,9,3) |
| 48 |
|
| typedef OP *(*Perl_check_t)(pTHX_ OP *); |
| 49 |
|
| # endif /* <5.9.3 */ |
| 50 |
|
| |
| 51 |
|
| # if !Q_PERL_VERSION_GE(5,10,1) |
| 52 |
|
| typedef unsigned Optype; |
| 53 |
|
| # endif /* <5.10.1 */ |
| 54 |
|
| |
| 55 |
|
| # ifndef OpMORESIB_set |
| 56 |
|
| # define OpMORESIB_set(o, sib) ((o)->op_sibling = (sib)) |
| 57 |
|
| # define OpLASTSIB_set(o, parent) ((o)->op_sibling = NULL) |
| 58 |
|
| # define OpMAYBESIB_set(o, sib, parent) ((o)->op_sibling = (sib)) |
| 59 |
|
| # endif /* !OpMORESIB_set */ |
| 60 |
|
| # ifndef OpSIBLING |
| 61 |
|
| # define OpHAS_SIBLING(o) (cBOOL((o)->op_sibling)) |
| 62 |
|
| # define OpSIBLING(o) (0 + (o)->op_sibling) |
| 63 |
|
| # endif /* !OpSIBLING */ |
| 64 |
|
| |
| 65 |
|
| # if Q_PERL_VERSION_GE(5,7,3) |
| 66 |
|
| # define PERL_UNUSED_THX() NOOP |
| 67 |
|
| # else /* <5.7.3 */ |
| 68 |
|
| # define PERL_UNUSED_THX() ((void)(aTHX+0)) |
| 69 |
|
| # endif /* <5.7.3 */ |
| 70 |
|
| |
| 71 |
|
| # ifndef wrap_op_checker |
| 72 |
|
| # define wrap_op_checker(c,n,o) THX_wrap_op_checker(aTHX_ c,n,o) |
| 73 |
|
| static void THX_wrap_op_checker(pTHX_ Optype opcode, |
| 74 |
|
| Perl_check_t new_checker, Perl_check_t *old_checker_p) |
| 75 |
|
| { |
| 76 |
|
| PERL_UNUSED_THX(); |
| 77 |
|
| if(*old_checker_p) return; |
| 78 |
|
| OP_REFCNT_LOCK; |
| 79 |
|
| if(!*old_checker_p) { |
| 80 |
|
| *old_checker_p = PL_check[opcode]; |
| 81 |
|
| PL_check[opcode] = new_checker; |
| 82 |
|
| } |
| 83 |
|
| OP_REFCNT_UNLOCK; |
| 84 |
|
| } |
| 85 |
|
| # endif /* !wrap_op_checker */ |
| 86 |
|
| |
| 87 |
|
| # ifndef SvVOK |
| 88 |
|
| # define SvVOK(sv) 0 |
| 89 |
|
| # endif /* !SvVOK */ |
| 90 |
|
| |
| 91 |
|
| # define refcounted_he_free(he) Perl_refcounted_he_free(aTHX_ he) |
| 92 |
|
| |
| 93 |
|
| # define newDEFSVOP() THX_newDEFSVOP(aTHX) |
| 94 |
|
| static OP *THX_newDEFSVOP(pTHX) |
| 95 |
|
| { |
| 96 |
|
| # if Q_PERL_VERSION_GE(5,9,1) |
| 97 |
|
| /* hope nothing overrides the meaning of defined() */ |
| 98 |
|
| OP *dop = newOP(OP_DEFINED, 0); |
| 99 |
|
| if(dop->op_type == OP_DEFINED && (dop->op_flags & OPf_KIDS)) { |
| 100 |
|
| OP *op = cUNOPx(dop)->op_first; |
| 101 |
|
| if(OpHAS_SIBLING(op)) { |
| 102 |
|
| cUNOPx(dop)->op_first = OpSIBLING(op); |
| 103 |
|
| } else { |
| 104 |
|
| cUNOPx(dop)->op_first = NULL; |
| 105 |
|
| dop->op_flags &= ~OPf_KIDS; |
| 106 |
|
| } |
| 107 |
|
| OpLASTSIB_set(op, NULL); |
| 108 |
|
| op_free(dop); |
| 109 |
|
| return op; |
| 110 |
|
| } |
| 111 |
|
| op_free(dop); |
| 112 |
|
| # endif /* >=5.9.1 */ |
| 113 |
|
| return newSVREF(newGVOP(OP_GV, 0, PL_defgv)); |
| 114 |
|
| } |
| 115 |
|
| |
| 116 |
|
| # define op_scalar(op) THX_op_scalar(aTHX_ op) |
| 117 |
|
| static OP *THX_op_scalar(pTHX_ OP *op) |
| 118 |
|
| { |
| 119 |
|
| OP *sop = newUNOP(OP_SCALAR, 0, op); |
| 120 |
|
| if(!(sop->op_type == OP_SCALAR && (sop->op_flags & OPf_KIDS))) |
| 121 |
|
| return sop; |
| 122 |
|
| op = cUNOPx(sop)->op_first; |
| 123 |
|
| if(OpHAS_SIBLING(op)) { |
| 124 |
|
| cUNOPx(sop)->op_first = OpSIBLING(op); |
| 125 |
|
| } else { |
| 126 |
|
| cUNOPx(sop)->op_first = NULL; |
| 127 |
|
| sop->op_flags &= ~OPf_KIDS; |
| 128 |
|
| } |
| 129 |
|
| OpLASTSIB_set(op, NULL); |
| 130 |
|
| op_free(sop); |
| 131 |
|
| return op; |
| 132 |
|
| } |
| 133 |
|
| |
| 134 |
|
| # define Q_MODGLOBAL_WORKAROUND_KEY \ |
| 135 |
|
| "Lexical::SealRequireHints/applying_workaround" |
| 136 |
|
| |
| 137 |
|
| # define pp_squashhints() THX_pp_squashhints(aTHX) |
| 138 |
|
| static OP *THX_pp_squashhints(pTHX) |
| 139 |
|
| { |
| 140 |
|
| /* |
| 141 |
|
| * SAVEHINTS() won't actually localise %^H unless the |
| 142 |
|
| * HINT_LOCALIZE_HH bit is set. Normally that bit would be set if |
| 143 |
|
| * there were anything in %^H, but when affected by [perl #73174] |
| 144 |
|
| * the core's swash-loading code clears $^H without changing |
| 145 |
|
| * %^H, so we set the bit here. We localise $^H while doing this, |
| 146 |
|
| * in order to not clobber $^H across a normal require where the |
| 147 |
|
| * bit is legitimately clear, except on Perl 5.11, where the bit |
| 148 |
|
| * needs to stay set in order to get proper restoration of %^H. |
| 149 |
|
| */ |
| 150 |
|
| # if !Q_PERL_VERSION_GE(5,11,0) |
| 151 |
|
| SAVEI32(PL_hints); |
| 152 |
|
| # endif /* <5.11.0 */ |
| 153 |
|
| PL_hints |= HINT_LOCALIZE_HH; |
| 154 |
|
| SAVEHINTS(); |
| 155 |
|
| hv_clear(GvHV(PL_hintgv)); |
| 156 |
|
| # if Q_HAVE_COP_HINTS_HASH |
| 157 |
|
| if(PL_compiling.cop_hints_hash) { |
| 158 |
|
| refcounted_he_free(PL_compiling.cop_hints_hash); |
| 159 |
|
| PL_compiling.cop_hints_hash = NULL; |
| 160 |
|
| } |
| 161 |
|
| # endif /* Q_HAVE_COP_HINTS_HASH */ |
| 162 |
|
| return PL_op->op_next; |
| 163 |
|
| } |
| 164 |
|
| |
| 165 |
|
| # define newOP_nullarysquashhints() THX_newOP_nullarysquashhints(aTHX) |
| 166 |
|
| static OP *THX_newOP_nullarysquashhints(pTHX) |
| 167 |
|
| { |
| 168 |
|
| OP *nsh_op = newOP(OP_PUSHMARK, 0); |
| 169 |
|
| nsh_op->op_type = OP_RAND; |
| 170 |
|
| nsh_op->op_ppaddr = THX_pp_squashhints; |
| 171 |
|
| return nsh_op; |
| 172 |
|
| } |
| 173 |
|
| |
| 174 |
|
| # define newOP_unarysquashhints(argop) THX_newOP_unarysquashhints(aTHX_ argop) |
| 175 |
|
| static OP *THX_newOP_unarysquashhints(pTHX_ OP *argop) |
| 176 |
|
| { |
| 177 |
|
| OP *ush_op = newUNOP(OP_NULL, 0, argop); |
| 178 |
|
| ush_op->op_type = OP_RAND; |
| 179 |
|
| ush_op->op_ppaddr = THX_pp_squashhints; |
| 180 |
|
| return ush_op; |
| 181 |
|
| } |
| 182 |
|
| |
| 183 |
|
| # define pp_maybesquashhints() THX_pp_maybesquashhints(aTHX) |
| 184 |
|
| static OP *THX_pp_maybesquashhints(pTHX) |
| 185 |
|
| { |
| 186 |
|
| dSP; |
| 187 |
|
| SV *arg = TOPs; |
| 188 |
|
| return SvNIOKp(arg) || (Q_PERL_VERSION_GE(5,9,2) && SvVOK(arg)) ? |
| 189 |
|
| PL_op->op_next : pp_squashhints(); |
| 190 |
|
| } |
| 191 |
|
| |
| 192 |
|
| # define newOP_maybesquashhints(argop) THX_newOP_maybesquashhints(aTHX_ argop) |
| 193 |
|
| static OP *THX_newOP_maybesquashhints(pTHX_ OP *argop) |
| 194 |
|
| { |
| 195 |
|
| OP *msh_op = newUNOP(OP_NULL, 0, argop); |
| 196 |
|
| msh_op->op_type = OP_RAND; |
| 197 |
|
| msh_op->op_ppaddr = THX_pp_maybesquashhints; |
| 198 |
|
| return msh_op; |
| 199 |
|
| } |
| 200 |
|
| |
| 201 |
|
| static OP *(*THX_nxck_require)(pTHX_ OP *op); |
| 202 |
|
| |
| 203 |
|
| static OP *THX_myck_require(pTHX_ OP *op) |
| 204 |
|
| { |
| 205 |
|
| OP *argop; |
| 206 |
|
| if(!hv_existss(PL_modglobal, Q_MODGLOBAL_WORKAROUND_KEY)) |
| 207 |
|
| return THX_nxck_require(aTHX_ op); |
| 208 |
|
| if(!(op->op_flags & OPf_KIDS)) { |
| 209 |
|
| /* |
| 210 |
|
| * We need to expand the implicit-parameter case |
| 211 |
|
| * to an explicit parameter that we can operate on. |
| 212 |
|
| * This duplicates what ck_fun() would do, including |
| 213 |
|
| * its invocation of a fresh chain of op checkers. |
| 214 |
|
| */ |
| 215 |
|
| op_free(op); |
| 216 |
|
| return newUNOP(OP_REQUIRE, 0, newDEFSVOP()); |
| 217 |
|
| } |
| 218 |
|
| argop = cUNOPx(op)->op_first; |
| 219 |
|
| if(argop->op_type == OP_CONST && (argop->op_private & OPpCONST_BARE)) { |
| 220 |
|
| /* |
| 221 |
|
| * Bareword argument gets special handling in standard |
| 222 |
|
| * checker, which we'd rather not interfere with by the |
| 223 |
|
| * process that we'd need to use a maybesquashhints op. |
| 224 |
|
| * Fortunately, we don't need access to the runtime |
| 225 |
|
| * argument in this case: we know it must be a module |
| 226 |
|
| * name, so we definitely want to squash hints at runtime. |
| 227 |
|
| * So build op tree with an unconditional squashhints op. |
| 228 |
|
| */ |
| 229 |
|
| op = THX_nxck_require(aTHX_ op); |
| 230 |
|
| op = append_list(OP_LINESEQ, |
| 231 |
|
| (LISTOP*)newOP_nullarysquashhints(), (LISTOP*)op); |
| 232 |
|
| } else { |
| 233 |
|
| /* |
| 234 |
|
| * Whether we want to squash hints depends on whether |
| 235 |
|
| * the argument at runtime is a version number or not. |
| 236 |
|
| * So we wrap the argument op, separating it from the |
| 237 |
|
| * require op. |
| 238 |
|
| */ |
| 239 |
|
| OP *standinop = newOP(OP_NULL, 0); |
| 240 |
|
| OP *sib = OpSIBLING(argop); |
| 241 |
|
| OpLASTSIB_set(argop, NULL); |
| 242 |
|
| OpMAYBESIB_set(standinop, sib, op); |
| 243 |
|
| cUNOPx(op)->op_first = standinop; |
| 244 |
|
| argop = newOP_maybesquashhints(op_scalar(argop)); |
| 245 |
|
| OpLASTSIB_set(standinop, NULL); |
| 246 |
|
| OpMAYBESIB_set(argop, sib, op); |
| 247 |
|
| cUNOPx(op)->op_first = argop; |
| 248 |
|
| op_free(standinop); |
| 249 |
|
| } |
| 250 |
|
| op = prepend_elem(OP_LINESEQ, newOP(OP_ENTER, 0), op); |
| 251 |
|
| op->op_type = OP_LEAVE; |
| 252 |
|
| op->op_ppaddr = PL_ppaddr[OP_LEAVE]; |
| 253 |
|
| op->op_flags |= OPf_PARENS; |
| 254 |
|
| return op; |
| 255 |
|
| } |
| 256 |
|
| |
| 257 |
|
| static OP *(*THX_nxck_dofile)(pTHX_ OP *op); |
| 258 |
|
| |
| 259 |
|
| static OP *THX_myck_dofile(pTHX_ OP *op) |
| 260 |
|
| { |
| 261 |
|
| OP *argop, *standinop, *sib; |
| 262 |
|
| if(!hv_existss(PL_modglobal, Q_MODGLOBAL_WORKAROUND_KEY)) |
| 263 |
|
| return THX_nxck_dofile(aTHX_ op); |
| 264 |
|
| if(!(op->op_flags & OPf_KIDS)) |
| 265 |
|
| return THX_nxck_dofile(aTHX_ op); |
| 266 |
|
| argop = cUNOPx(op)->op_first; |
| 267 |
|
| standinop = newOP(OP_NULL, 0); |
| 268 |
|
| sib = OpSIBLING(argop); |
| 269 |
|
| OpLASTSIB_set(argop, NULL); |
| 270 |
|
| OpMAYBESIB_set(standinop, sib, op); |
| 271 |
|
| cUNOPx(op)->op_first = standinop; |
| 272 |
|
| argop = newOP_unarysquashhints(op_scalar(argop)); |
| 273 |
|
| OpLASTSIB_set(standinop, NULL); |
| 274 |
|
| OpMAYBESIB_set(argop, sib, op); |
| 275 |
|
| cUNOPx(op)->op_first = argop; |
| 276 |
|
| op_free(standinop); |
| 277 |
|
| op = prepend_elem(OP_LINESEQ, newOP(OP_ENTER, 0), op); |
| 278 |
|
| op->op_type = OP_LEAVE; |
| 279 |
|
| op->op_ppaddr = PL_ppaddr[OP_LEAVE]; |
| 280 |
|
| op->op_flags |= OPf_PARENS; |
| 281 |
|
| return op; |
| 282 |
|
| } |
| 283 |
|
| |
| 284 |
|
| static OP *(*THX_nxck_entersub)(pTHX_ OP *op); |
| 285 |
|
| |
| 286 |
|
| static OP *THX_myck_entersub(pTHX_ OP *op) |
| 287 |
|
| { |
| 288 |
|
| OP *pushop, *argop, *cvop, *gvop, *standinop; |
| 289 |
|
| GV *gv; |
| 290 |
|
| char *name; |
| 291 |
|
| pushop = cUNOPx(op)->op_first; |
| 292 |
|
| if(!OpHAS_SIBLING(pushop)) pushop = cUNOPx(pushop)->op_first; |
| 293 |
|
| if(!((argop = OpSIBLING(pushop)) && (cvop = OpSIBLING(argop)) && |
| 294 |
|
| !OpHAS_SIBLING(cvop) && cvop->op_type == OP_RV2CV && |
| 295 |
|
| !(cvop->op_private & OPpENTERSUB_AMPER) && |
| 296 |
|
| (cvop->op_flags & OPf_KIDS) && |
| 297 |
|
| (gvop = cUNOPx(cvop)->op_first, |
| 298 |
|
| gvop->op_type == OP_GV) && |
| 299 |
|
| (gv = cGVOPx_gv(gvop), |
| 300 |
|
| SvTYPE((SV*)gv) == SVt_PVGV) && |
| 301 |
|
| GvSTASH(gv) == PL_globalstash && GvNAMELEN(gv) == 2 && |
| 302 |
|
| (name = GvNAME(gv), name[0] == 'd' && name[1] == 'o'))) |
| 303 |
|
| return THX_nxck_entersub(aTHX_ op); |
| 304 |
|
| standinop = newOP(OP_NULL, 0); |
| 305 |
|
| OpLASTSIB_set(argop, NULL); |
| 306 |
|
| OpMORESIB_set(standinop, cvop); |
| 307 |
|
| OpMORESIB_set(pushop, standinop); |
| 308 |
|
| argop = newOP_unarysquashhints(op_scalar(argop)); |
| 309 |
|
| OpLASTSIB_set(standinop, NULL); |
| 310 |
|
| OpMORESIB_set(argop, cvop); |
| 311 |
|
| OpMORESIB_set(pushop, argop); |
| 312 |
|
| op_free(standinop); |
| 313 |
|
| op = prepend_elem(OP_LINESEQ, newOP(OP_ENTER, 0), op); |
| 314 |
|
| op->op_type = OP_LEAVE; |
| 315 |
|
| op->op_ppaddr = PL_ppaddr[OP_LEAVE]; |
| 316 |
|
| op->op_flags |= OPf_PARENS; |
| 317 |
|
| return op; |
| 318 |
|
| } |
| 319 |
|
| |
| 320 |
|
| #endif /* Q_MUST_WORKAROUND */ |
| 321 |
|
| |
| 322 |
|
| #line 323 "lib/Lexical/SealRequireHints.c" |
| 323 |
|
| #ifndef PERL_UNUSED_VAR |
| 324 |
|
| # define PERL_UNUSED_VAR(var) if (0) var = var |
| 325 |
|
| #endif |
| 326 |
|
| |
| 327 |
|
| #ifndef dVAR |
| 328 |
|
| # define dVAR dNOOP |
| 329 |
|
| #endif |
| 330 |
|
| |
| 331 |
|
| |
| 332 |
|
| /* This stuff is not part of the API! You have been warned. */ |
| 333 |
|
| #ifndef PERL_VERSION_DECIMAL |
| 334 |
|
| # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) |
| 335 |
|
| #endif |
| 336 |
|
| #ifndef PERL_DECIMAL_VERSION |
| 337 |
|
| # define PERL_DECIMAL_VERSION \ |
| 338 |
|
| PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
| 339 |
|
| #endif |
| 340 |
|
| #ifndef PERL_VERSION_GE |
| 341 |
|
| # define PERL_VERSION_GE(r,v,s) \ |
| 342 |
|
| (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) |
| 343 |
|
| #endif |
| 344 |
|
| #ifndef PERL_VERSION_LE |
| 345 |
|
| # define PERL_VERSION_LE(r,v,s) \ |
| 346 |
|
| (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) |
| 347 |
|
| #endif |
| 348 |
|
| |
| 349 |
|
| /* XS_INTERNAL is the explicit static-linkage variant of the default |
| 350 |
|
| * XS macro. |
| 351 |
|
| * |
| 352 |
|
| * XS_EXTERNAL is the same as XS_INTERNAL except it does not include |
| 353 |
|
| * "static", ie. it exports XSUB symbols. You probably don't want that |
| 354 |
|
| * for anything but the BOOT XSUB. |
| 355 |
|
| * |
| 356 |
|
| * See XSUB.h in core! |
| 357 |
|
| */ |
| 358 |
|
| |
| 359 |
|
| |
| 360 |
|
| /* TODO: This might be compatible further back than 5.10.0. */ |
| 361 |
|
| #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) |
| 362 |
|
| # undef XS_EXTERNAL |
| 363 |
|
| # undef XS_INTERNAL |
| 364 |
|
| # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) |
| 365 |
|
| # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) |
| 366 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 367 |
|
| # endif |
| 368 |
|
| # if defined(__SYMBIAN32__) |
| 369 |
|
| # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) |
| 370 |
|
| # define XS_INTERNAL(name) EXPORT_C static XSPROTO(name) |
| 371 |
|
| # endif |
| 372 |
|
| # ifndef XS_EXTERNAL |
| 373 |
|
| # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) |
| 374 |
|
| # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) |
| 375 |
|
| # define XS_INTERNAL(name) static void name(pTHX_ CV* cv __attribute__unused__) |
| 376 |
|
| # else |
| 377 |
|
| # ifdef __cplusplus |
| 378 |
|
| # define XS_EXTERNAL(name) extern "C" XSPROTO(name) |
| 379 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 380 |
|
| # else |
| 381 |
|
| # define XS_EXTERNAL(name) XSPROTO(name) |
| 382 |
|
| # define XS_INTERNAL(name) static XSPROTO(name) |
| 383 |
|
| # endif |
| 384 |
|
| # endif |
| 385 |
|
| # endif |
| 386 |
|
| #endif |
| 387 |
|
| |
| 388 |
|
| /* perl >= 5.10.0 && perl <= 5.15.1 */ |
| 389 |
|
| |
| 390 |
|
| |
| 391 |
|
| /* The XS_EXTERNAL macro is used for functions that must not be static |
| 392 |
|
| * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL |
| 393 |
|
| * macro defined, the best we can do is assume XS is the same. |
| 394 |
|
| * Dito for XS_INTERNAL. |
| 395 |
|
| */ |
| 396 |
|
| #ifndef XS_EXTERNAL |
| 397 |
|
| # define XS_EXTERNAL(name) XS(name) |
| 398 |
|
| #endif |
| 399 |
|
| #ifndef XS_INTERNAL |
| 400 |
|
| # define XS_INTERNAL(name) XS(name) |
| 401 |
|
| #endif |
| 402 |
|
| |
| 403 |
|
| /* Now, finally, after all this mess, we want an ExtUtils::ParseXS |
| 404 |
|
| * internal macro that we're free to redefine for varying linkage due |
| 405 |
|
| * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use |
| 406 |
|
| * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! |
| 407 |
|
| */ |
| 408 |
|
| |
| 409 |
|
| #undef XS_EUPXS |
| 410 |
|
| #if defined(PERL_EUPXS_ALWAYS_EXPORT) |
| 411 |
|
| # define XS_EUPXS(name) XS_EXTERNAL(name) |
| 412 |
|
| #else |
| 413 |
|
| /* default to internal */ |
| 414 |
|
| # define XS_EUPXS(name) XS_INTERNAL(name) |
| 415 |
|
| #endif |
| 416 |
|
| |
| 417 |
|
| #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
| 418 |
|
| #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) |
| 419 |
|
| |
| 420 |
|
| /* prototype to pass -Wmissing-prototypes */ |
| 421 |
|
| static void |
| 422 |
|
| S_croak_xs_usage(const CV *const cv, const char *const params); |
| 423 |
|
| |
| 424 |
|
| static void |
| 425 |
|
| S_croak_xs_usage(const CV *const cv, const char *const params) |
| 426 |
|
| { |
| 427 |
|
| const GV *const gv = CvGV(cv); |
| 428 |
|
| |
| 429 |
|
| PERL_ARGS_ASSERT_CROAK_XS_USAGE; |
| 430 |
|
| |
| 431 |
|
| if (gv) { |
| 432 |
|
| const char *const gvname = GvNAME(gv); |
| 433 |
|
| const HV *const stash = GvSTASH(gv); |
| 434 |
|
| const char *const hvname = stash ? HvNAME(stash) : NULL; |
| 435 |
|
| |
| 436 |
|
| if (hvname) |
| 437 |
|
| Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); |
| 438 |
|
| else |
| 439 |
|
| Perl_croak_nocontext("Usage: %s(%s)", gvname, params); |
| 440 |
|
| } else { |
| 441 |
|
| /* Pants. I don't think that it should be possible to get here. */ |
| 442 |
|
| Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); |
| 443 |
|
| } |
| 444 |
|
| } |
| 445 |
|
| #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
| 446 |
|
| |
| 447 |
|
| #define croak_xs_usage S_croak_xs_usage |
| 448 |
|
| |
| 449 |
|
| #endif |
| 450 |
|
| |
| 451 |
|
| /* NOTE: the prototype of newXSproto() is different in versions of perls, |
| 452 |
|
| * so we define a portable version of newXSproto() |
| 453 |
|
| */ |
| 454 |
|
| #ifdef newXS_flags |
| 455 |
|
| #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) |
| 456 |
|
| #else |
| 457 |
|
| #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) |
| 458 |
|
| #endif /* !defined(newXS_flags) */ |
| 459 |
|
| |
| 460 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 461 |
|
| # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) |
| 462 |
|
| #else |
| 463 |
|
| # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) |
| 464 |
|
| #endif |
| 465 |
|
| |
| 466 |
|
| /* simple backcompat versions of the TARGx() macros with no optimisation */ |
| 467 |
|
| #ifndef TARGi |
| 468 |
|
| # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv) |
| 469 |
|
| # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv) |
| 470 |
|
| # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv) |
| 471 |
|
| #endif |
| 472 |
|
| |
| 473 |
|
| #line 474 "lib/Lexical/SealRequireHints.c" |
| 474 |
|
| |
| 475 |
|
| XS_EUPXS(XS_Lexical__SealRequireHints__install_compilation_workaround); /* prototype to pass -Wmissing-prototypes */ |
| 476 |
0 |
| XS_EUPXS(XS_Lexical__SealRequireHints__install_compilation_workaround) |
| 477 |
|
| { |
| 478 |
0 |
| dVAR; dXSARGS; |
| 479 |
0 |
▶ | if (items != 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (items != 0) |
0 |
0 |
0 |
|
| 480 |
0 |
| croak_xs_usage(cv, ""); |
| 481 |
|
| { |
| 482 |
|
| #line 320 "lib/Lexical/SealRequireHints.xs" |
| 483 |
|
| #if Q_MUST_WORKAROUND |
| 484 |
|
| wrap_op_checker(OP_REQUIRE, THX_myck_require, &THX_nxck_require); |
| 485 |
|
| wrap_op_checker(OP_DOFILE, THX_myck_dofile, &THX_nxck_dofile); |
| 486 |
|
| wrap_op_checker(OP_ENTERSUB, THX_myck_entersub, &THX_nxck_entersub); |
| 487 |
|
| (void) hv_stores(PL_modglobal, Q_MODGLOBAL_WORKAROUND_KEY, &PL_sv_yes); |
| 488 |
|
| #endif /* Q_MUST_WORKAROUND */ |
| 489 |
|
| #line 490 "lib/Lexical/SealRequireHints.c" |
| 490 |
|
| } |
| 491 |
0 |
| XSRETURN_EMPTY; |
| 492 |
|
| } |
| 493 |
|
| |
| 494 |
|
| #ifdef __cplusplus |
| 495 |
|
| extern "C" { |
| 496 |
|
| #endif |
| 497 |
|
| XS_EXTERNAL(boot_Lexical__SealRequireHints); /* prototype to pass -Wmissing-prototypes */ |
| 498 |
0 |
| XS_EXTERNAL(boot_Lexical__SealRequireHints) |
| 499 |
|
| { |
| 500 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 501 |
|
| dVAR; dXSARGS; |
| 502 |
|
| #else |
| 503 |
0 |
| dVAR; dXSBOOTARGSXSAPIVERCHK; |
| 504 |
|
| #endif |
| 505 |
|
| #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */ |
| 506 |
|
| char* file = __FILE__; |
| 507 |
|
| #else |
| 508 |
0 |
| const char* file = __FILE__; |
| 509 |
|
| #endif |
| 510 |
|
| |
| 511 |
|
| PERL_UNUSED_VAR(file); |
| 512 |
|
| |
| 513 |
|
| PERL_UNUSED_VAR(cv); /* -W */ |
| 514 |
|
| PERL_UNUSED_VAR(items); /* -W */ |
| 515 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 516 |
|
| XS_VERSION_BOOTCHECK; |
| 517 |
|
| # ifdef XS_APIVERSION_BOOTCHECK |
| 518 |
|
| XS_APIVERSION_BOOTCHECK; |
| 519 |
|
| # endif |
| 520 |
|
| #endif |
| 521 |
|
| |
| 522 |
0 |
| newXS_deffile("Lexical::SealRequireHints::_install_compilation_workaround", XS_Lexical__SealRequireHints__install_compilation_workaround); |
| 523 |
|
| #if PERL_VERSION_LE(5, 21, 5) |
| 524 |
|
| # if PERL_VERSION_GE(5, 9, 0) |
| 525 |
|
| if (PL_unitcheckav) |
| 526 |
|
| call_list(PL_scopestack_ix, PL_unitcheckav); |
| 527 |
|
| # endif |
| 528 |
|
| XSRETURN_YES; |
| 529 |
|
| #else |
| 530 |
0 |
| Perl_xs_boot_epilog(aTHX_ ax); |
| 531 |
|
| #endif |
| 532 |
0 |
| } |
| 533 |
|
| |
| 534 |
|
| #ifdef __cplusplus |
| 535 |
|
| } |
| 536 |
|
| #endif |