hax/newOP_CUSTOM.c.inc

filter: Statementstmt 28.5% 8 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 28.5% 8 / 28 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« hax/lexer-additions.c.inc ↑ Summary hax/forbid_outofblock_ops.c.inc »
1 /* vi: set ft=c : */
2  
3 /* Before perl 5.22 under -DDEBUGGING, various new*OP() functions throw assert
4 * failures on OP_CUSTOM.
5 * https://rt.cpan.org/Ticket/Display.html?id=128562
6 */
7  
8 #define newOP_CUSTOM(func, flags) S_newOP_CUSTOM(aTHX_ func, flags)
9 #define newUNOP_CUSTOM(func, flags, first) S_newUNOP_CUSTOM(aTHX_ func, flags, first)
10 #define newUNOP_AUX_CUSTOM(func, flags, first, aux) S_newUNOP_AUX_CUSTOM(aTHX_ func, flags, first, aux)
11 #define newSVOP_CUSTOM(func, flags, sv) S_newSVOP_CUSTOM(aTHX_ func, flags, sv)
12 #define newBINOP_CUSTOM(func, flags, first, last) S_newBINOP_CUSTOM(aTHX_ func, flags, first, last)
13 #define newLISTOP_CUSTOM(func, flags, first, last) S_newLISTOP_CUSTOM(aTHX_ func, flags, first, last)
14 #define newLOGOP_CUSTOM(func, flags, first, other) S_newLOGOP_CUSTOM(aTHX_ func, flags, first, other)
15  
16 92 static OP *S_newOP_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags)
17 {
18 92 OP *op = newOP(OP_CUSTOM, flags);
19 92 op->op_ppaddr = func;
20 92 return op;
21 }
22  
23 0 static OP *S_newUNOP_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, OP *first)
24 {
25 UNOP *unop;
26 0 unop = (UNOP *)newUNOP(OP_CUSTOM, flags, first);
27 0 unop->op_ppaddr = func;
28 0 return (OP *)unop;
29 }
30  
31 0 static OP *S_newUNOP_AUX_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, OP *first, UNOP_AUX_item *aux)
32 {
33 UNOP_AUX *unop;
34 0 unop = (UNOP_AUX *)newUNOP_AUX(OP_CUSTOM, flags, first, aux);
35 0 unop->op_ppaddr = func;
36 0 return (OP *)unop;
37 }
38  
39 1 static OP *S_newSVOP_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, SV *sv)
40 {
41 SVOP *svop;
42 1 svop = (SVOP *)newSVOP(OP_CUSTOM, flags, sv);
43 1 svop->op_ppaddr = func;
44 1 return (OP *)svop;
45 }
46  
47 0 static OP *S_newBINOP_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, OP *first, OP *last)
48 {
49 BINOP *binop;
50 0 binop = (BINOP *)newBINOP(OP_CUSTOM, flags, first, last);
51 0 binop->op_ppaddr = func;
52 0 return (OP *)binop;
53 }
54  
55 0 static OP *S_newLISTOP_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, OP *first, OP *last)
56 {
57 LISTOP *listop;
58 0 listop = (LISTOP *)newLISTOP(OP_CUSTOM, flags, first, last);
59 0 listop->op_ppaddr = func;
60 0 return (OP *)listop;
61 }
62  
63 0 static OP *S_newLOGOP_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, OP *first, OP *other)
64 {
65 OP *o;
66 0 o = newLOGOP(OP_CUSTOM, flags, first, other);
67  
68 /* the returned op is actually an UNOP that's either NULL or NOT; the real
69 * logop is the op_next of it
70 */
71 0 cUNOPx(o)->op_first->op_ppaddr = func;
72  
73 0 return o;
74 }
« hax/lexer-additions.c.inc ↑ Summary hax/forbid_outofblock_ops.c.inc »