summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2020-02-08 10:51:48 +0100
committerKarl Williamson <khw@cpan.org>2020-03-12 22:34:26 -0600
commit6b32f57da89de094200b8259611c0f2c80aeeef2 (patch)
tree7a4fc78778f900e069279744b74f86cfce5332e0 /op.c
parent4bd78a4962edb4f91c34534af5ee89fe47594c18 (diff)
downloadperl-6b32f57da89de094200b8259611c0f2c80aeeef2.tar.gz
op.c: change Optype to I32 for cmpchain functions
Optype appears to be almost completely unused, and on Win32 builds we saw warnings from the cmpchain patches: perly.y(1063) : warning C4244: 'function' : conversion from 'I32' to 'Optype', possible loss of data perly.y(1065) : warning C4244: 'function' : conversion from 'I32' to 'Optype', possible loss of data perly.y(1079) : warning C4244: 'function' : conversion from 'I32' to 'Optype', possible loss of data perly.y(1081) : warning C4244: 'function' : conversion from 'I32' to 'Optype', possible loss of data Reviewing the code I noticed that functions like Perl_newBINOP() have an I32 type argument, and functions like OpTYPE_set() coerce such arguments into type OPCODE: #define OpTYPE_set(o,type) \ STMT_START { \ o->op_type = (OPCODE)type; \ o->op_ppaddr = PL_ppaddr[type]; \ } STMT_END this patch changes the signature to the new cmpchain functions so that they do they same, and change the type for storage for op_type values to also use OPCODE like most of the other op.c code.
Diffstat (limited to 'op.c')
-rw-r--r--op.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/op.c b/op.c
index 46685dc79e..954bb32f57 100644
--- a/op.c
+++ b/op.c
@@ -5500,7 +5500,7 @@ Perl_invert(pTHX_ OP *o)
}
OP *
-Perl_cmpchain_start(pTHX_ Optype type, OP *left, OP *right)
+Perl_cmpchain_start(pTHX_ I32 type, OP *left, OP *right)
{
BINOP *bop;
OP *op;
@@ -5525,7 +5525,7 @@ Perl_cmpchain_start(pTHX_ Optype type, OP *left, OP *right)
}
OP *
-Perl_cmpchain_extend(pTHX_ Optype type, OP *ch, OP *right)
+Perl_cmpchain_extend(pTHX_ I32 type, OP *ch, OP *right)
{
BINOP *bop;
OP *op;
@@ -5568,7 +5568,7 @@ Perl_cmpchain_finish(pTHX_ OP *ch)
{
PERL_ARGS_ASSERT_CMPCHAIN_FINISH;
if (ch->op_type != OP_NULL) {
- Optype cmpoptype = ch->op_type;
+ OPCODE cmpoptype = ch->op_type;
ch = CHECKOP(cmpoptype, ch);
if(!ch->op_next && ch->op_type == cmpoptype)
ch = fold_constants(op_integerize(op_std_init(ch)));
@@ -5581,7 +5581,7 @@ Perl_cmpchain_finish(pTHX_ OP *ch)
while (1) {
OP *cmpop = cUNOPx(ch)->op_first;
OP *leftarg = OpSIBLING(cmpop);
- Optype cmpoptype = cmpop->op_type;
+ OPCODE cmpoptype = cmpop->op_type;
OP *nextrightarg;
bool is_last;
is_last = !(cUNOPx(ch)->op_first = OpSIBLING(leftarg));