This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make S_gen_constant_list() void return
authorDavid Mitchell <davem@iabyn.com>
Fri, 17 May 2019 12:01:35 +0000 (13:01 +0100)
committerDavid Mitchell <davem@iabyn.com>
Mon, 24 Jun 2019 10:40:06 +0000 (11:40 +0100)
Its gen_constant_list(o) returns an OP*, but the thing it returns is
currently always o.

So just assume it returns it arg.

This will shortly make making Perl_list() non-recursive easier.

embed.fnc
op.c
proto.h

index b8d429a..0cd0917 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -636,7 +636,7 @@ Afpd        |char*  |form           |NN const char* pat|...
 Ap     |char*  |vform          |NN const char* pat|NULLOK va_list* args
 Ap     |void   |free_tmps
 #if defined(PERL_IN_OP_C)
-S      |OP*    |gen_constant_list|NULLOK OP* o
+S      |void   |gen_constant_list|NULLOK OP* o
 #endif
 #if !defined(HAS_GETENV_LEN)
 : Used in hv.c
diff --git a/op.c b/op.c
index d781de7..b5da98d 100644 (file)
--- a/op.c
+++ b/op.c
@@ -2356,7 +2356,8 @@ Perl_list(pTHX_ OP *o)
         /* possibly flatten 1..10 into a constant array */
        if (!o->op_next && cUNOPo->op_first->op_type == OP_FLOP) {
            list(cBINOPo->op_first);
-           return gen_constant_list(o);
+           gen_constant_list(o);
+           return o;
        }
        listkids(o);
        break;
@@ -5755,7 +5756,7 @@ S_fold_constants(pTHX_ OP *const o)
  * the constant value being an AV holding the flattened range.
  */
 
-static OP *
+static void
 S_gen_constant_list(pTHX_ OP *o)
 {
     dVAR;
@@ -5774,7 +5775,7 @@ S_gen_constant_list(pTHX_ OP *o)
 
     list(o);
     if (PL_parser && PL_parser->error_count)
-       return o;               /* Don't attempt to run with errors */
+       return;         /* Don't attempt to run with errors */
 
     curop = LINKLIST(o);
     old_next = o->op_next;
@@ -5841,7 +5842,7 @@ S_gen_constant_list(pTHX_ OP *o)
         delete_eval_scope();
     }
     if (ret)
-       return o;
+       return;
 
     OpTYPE_set(o, OP_RV2AV);
     o->op_flags &= ~OPf_REF;   /* treat \(1..2) like an ordinary list */
@@ -5861,7 +5862,8 @@ S_gen_constant_list(pTHX_ OP *o)
            SvREADONLY_on(*svp);
        }
     LINKLIST(o);
-    return list(o);
+    list(o);
+    return;
 }
 
 /*
diff --git a/proto.h b/proto.h
index 0fc2adc..9359016 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5050,7 +5050,7 @@ STATIC OP*        S_force_list(pTHX_ OP* arg, bool nullit);
 STATIC void    S_forget_pmop(pTHX_ PMOP *const o);
 #define PERL_ARGS_ASSERT_FORGET_PMOP   \
        assert(o)
-STATIC OP*     S_gen_constant_list(pTHX_ OP* o);
+STATIC void    S_gen_constant_list(pTHX_ OP* o);
 STATIC void    S_inplace_aassign(pTHX_ OP* o);
 #define PERL_ARGS_ASSERT_INPLACE_AASSIGN       \
        assert(o)