diff --git a/cop.h b/cop.h index 0c2f07950fcc..33463a0ab27a 100644 --- a/cop.h +++ b/cop.h @@ -1094,10 +1094,15 @@ struct context { #define CXINC (cxstack_ix < cxstack_max ? ++cxstack_ix : (cxstack_ix = cxinc())) -#define G_SCALAR 2 -#define G_ARRAY 3 -#define G_VOID 1 -#define G_WANT 3 +#define G_SCALAR 2 +#define G_LIST 3 +#define G_VOID 1 +#define G_WANT 3 + +#ifndef PERL_CORE + /* name prior to 5.31.1 */ +# define G_ARRAY G_LIST +#endif /* extra flags for Perl_call_* routines */ #define G_DISCARD 0x4 /* Call FREETMPS. diff --git a/ext/File-Glob/Glob.pm b/ext/File-Glob/Glob.pm index b7e71abcd3fd..29025208d93b 100644 --- a/ext/File-Glob/Glob.pm +++ b/ext/File-Glob/Glob.pm @@ -35,7 +35,7 @@ $EXPORT_TAGS{bsd_glob} = [@{$EXPORT_TAGS{glob}}]; @EXPORT_OK = (@{$EXPORT_TAGS{'glob'}}, 'csh_glob'); -$VERSION = '1.33'; +$VERSION = '1.34'; sub import { require Exporter; diff --git a/ext/File-Glob/Glob.xs b/ext/File-Glob/Glob.xs index 9779d54ca6a7..4e1ae80b7221 100644 --- a/ext/File-Glob/Glob.xs +++ b/ext/File-Glob/Glob.xs @@ -108,7 +108,7 @@ iterate(pTHX_ bool(*globber)(pTHX_ AV *entries, const char *pat, STRLEN len, boo } if (!IS_SAFE_SYSCALL(pat, len, "pattern", "glob")) { - if (gimme != G_ARRAY) + if (gimme != G_LIST) PUSHs(&PL_sv_undef); PUTBACK; return; @@ -120,7 +120,7 @@ iterate(pTHX_ bool(*globber)(pTHX_ AV *entries, const char *pat, STRLEN len, boo } /* chuck it all out, quick or slow */ - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { if (!on_stack && AvFILLp(entries) + 1) { EXTEND(SP, AvFILLp(entries)+1); Copy(AvARRAY(entries), SP+1, AvFILLp(entries)+1, SV *); @@ -286,7 +286,7 @@ csh_glob(pTHX_ AV *entries, const char *pat, STRLEN len, bool is_utf8) dMARK; dORIGMARK; /* short-circuit here for a fairly common case */ - if (!patav && gimme == G_ARRAY) { PUTBACK; return TRUE; } + if (!patav && gimme == G_LIST) { PUTBACK; return TRUE; } while (++MARK <= SP) av_push(entries, SvREFCNT_inc_simple_NN(*MARK)); @@ -323,7 +323,7 @@ doglob_iter_wrapper(pTHX_ AV *entries, const char *pattern, STRLEN len, bool is_ { dMARK; dORIGMARK; - if (GIMME_V == G_ARRAY) { PUTBACK; return TRUE; } + if (GIMME_V == G_LIST) { PUTBACK; return TRUE; } sv_upgrade((SV *)entries, SVt_PVAV); while (++MARK <= SP) av_push(entries, SvREFCNT_inc_simple_NN(*MARK)); diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index 0501fb8f396d..bb4b74d8e582 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -6,7 +6,7 @@ use strict; our($VERSION, @ISA, @EXPORT_OK); -$VERSION = "1.50"; +$VERSION = "1.51"; use Carp; use Exporter (); diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index 3fb1116f9ce2..f574ca2cd7a2 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -536,7 +536,7 @@ CODE: void opcodes() PPCODE: - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { croak("opcodes in list context not yet implemented"); /* XXX */ } else { diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 0fab00952593..27ba2dc45919 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -3505,7 +3505,7 @@ strtod(str) num = strtod(str, &unparsed); RESTORE_LC_NUMERIC(); PUSHs(sv_2mortal(newSVnv(num))); - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { EXTEND(SP, 1); if (unparsed) PUSHs(sv_2mortal(newSViv(strlen(unparsed)))); @@ -3527,7 +3527,7 @@ strtold(str) num = strtold(str, &unparsed); RESTORE_LC_NUMERIC(); PUSHs(sv_2mortal(newSVnv(num))); - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { EXTEND(SP, 1); if (unparsed) PUSHs(sv_2mortal(newSViv(strlen(unparsed)))); @@ -3553,7 +3553,7 @@ strtol(str, base = 0) else #endif PUSHs(sv_2mortal(newSViv((IV)num))); - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { EXTEND(SP, 1); if (unparsed) PUSHs(sv_2mortal(newSViv(strlen(unparsed)))); @@ -3563,7 +3563,7 @@ strtol(str, base = 0) } else { SETERRNO(EINVAL, LIB_INVARG); PUSHs(&PL_sv_undef); - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { EXTEND(SP, 1); PUSHs(&PL_sv_undef); } @@ -3587,7 +3587,7 @@ strtoul(str, base = 0) else #endif PUSHs(sv_2mortal(newSViv((IV)num))); - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { EXTEND(SP, 1); if (unparsed) PUSHs(sv_2mortal(newSViv(strlen(unparsed)))); @@ -3597,7 +3597,7 @@ strtoul(str, base = 0) } else { SETERRNO(EINVAL, LIB_INVARG); PUSHs(&PL_sv_undef); - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { EXTEND(SP, 1); PUSHs(&PL_sv_undef); } diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm index 08986d26577d..8305c3014a60 100644 --- a/ext/POSIX/lib/POSIX.pm +++ b/ext/POSIX/lib/POSIX.pm @@ -4,7 +4,7 @@ use warnings; our ($AUTOLOAD, %SIGRT); -our $VERSION = '1.97'; +our $VERSION = '1.98'; require XSLoader; diff --git a/ext/XS-APItest/APItest.pm b/ext/XS-APItest/APItest.pm index e331bb18a1ea..6082d7f7db3e 100644 --- a/ext/XS-APItest/APItest.pm +++ b/ext/XS-APItest/APItest.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Carp; -our $VERSION = '1.16'; +our $VERSION = '1.17'; require XSLoader; @@ -226,7 +226,7 @@ arg is passed as the args to the called function. They return whatever the C function itself pushed onto the stack, plus the return value from the function; for example - call_sv( sub { @_, 'c' }, G_ARRAY, 'a', 'b'); + call_sv( sub { @_, 'c' }, G_LIST, 'a', 'b'); # returns 'a', 'b', 'c', 3 call_sv( sub { @_ }, G_SCALAR, 'a', 'b'); # returns 'b', 1 diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index 0b2fc46e4583..c6561f8b44de 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -3202,7 +3202,7 @@ test_op_contextualize() op_free(o); o = newSVOP(OP_CONST, 0, newSViv(0)); o->op_flags &= ~OPf_WANT; - o = op_contextualize(o, G_ARRAY); + o = op_contextualize(o, G_LIST); if (o->op_type != OP_CONST || (o->op_flags & OPf_WANT) != OPf_WANT_LIST) croak_fail(); @@ -3947,7 +3947,7 @@ CODE: av_push(av, SvREFCNT_inc(TOPs)); break; - case G_ARRAY: + case G_LIST: for (p = PL_stack_base + 1; p <= SP; p++) av_push(av, SvREFCNT_inc(*p)); break; diff --git a/ext/XS-APItest/Makefile.PL b/ext/XS-APItest/Makefile.PL index 3fe5e397a8b4..c075db20d835 100644 --- a/ext/XS-APItest/Makefile.PL +++ b/ext/XS-APItest/Makefile.PL @@ -22,7 +22,7 @@ WriteMakefile( my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV - G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS + G_SCALAR G_LIST G_VOID G_DISCARD G_EVAL G_NOARGS G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL G_RETHROW GV_NOADD_NOINIT IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX @@ -30,7 +30,7 @@ my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE IS_NUMBER_NAN IS_NUMBER_TRAILING PERL_SCAN_TRAILING PERL_LOADMOD_DENY PERL_LOADMOD_NOIMPORT PERL_LOADMOD_IMPORT_OPS ), - {name=>"G_WANT", default=>["IV", "G_ARRAY|G_VOID"]}); + {name=>"G_WANT", default=>["IV", "G_LIST|G_VOID"]}); open my $fh, '<', '../../overload.h' or die "Can't open ../../overload.h: $!"; while (<$fh>) { diff --git a/ext/XS-APItest/t/call.t b/ext/XS-APItest/t/call.t index e4228077cbdc..390ed8de9387 100644 --- a/ext/XS-APItest/t/call.t +++ b/ext/XS-APItest/t/call.t @@ -60,8 +60,8 @@ for my $test ( [ G_VOID, [ qw(a p q) ], [ 0 ], '3 args, G_VOID' ], [ G_SCALAR, [ ], [ qw(y 1) ], '0 args, G_SCALAR' ], [ G_SCALAR, [ qw(a p q) ], [ qw(y 1) ], '3 args, G_SCALAR' ], - [ G_ARRAY, [ ], [ qw(x 1) ], '0 args, G_ARRAY' ], - [ G_ARRAY, [ qw(a p q) ], [ qw(b p x 3) ], '3 args, G_ARRAY' ], + [ G_LIST, [ ], [ qw(x 1) ], '0 args, G_LIST' ], + [ G_LIST, [ qw(a p q) ], [ qw(b p x 3) ], '3 args, G_LIST' ], [ G_DISCARD, [ ], [ qw(0) ], '0 args, G_DISCARD' ], [ G_DISCARD, [ qw(a p q) ], [ qw(0) ], '3 args, G_DISCARD' ], ) @@ -89,7 +89,7 @@ for my $test ( ok(eq_array( [ call_method('meth', $flags, $obj, @$args) ], $expected), "$description call_method('meth')"); - my $returnval = ((($flags & G_WANT) == G_ARRAY) || ($flags & G_DISCARD)) + my $returnval = ((($flags & G_WANT) == G_LIST) || ($flags & G_DISCARD)) ? [0] : [ undef, 1 ]; for my $keep (0, G_KEEPERR) { my $desc = $description . ($keep ? ' G_KEEPERR' : ''); @@ -313,12 +313,12 @@ for my $fn_type (qw(eval_pv eval_sv call_sv)) { } } elsif ($fn_type eq 'eval_sv') { - $desc = "eval_sv('$code', G_ARRAY|$keep_desc)"; - @ret = eval_sv($code, G_ARRAY|$keep); + $desc = "eval_sv('$code', G_LIST|$keep_desc)"; + @ret = eval_sv($code, G_LIST|$keep); } elsif ($fn_type eq 'call_sv') { - $desc = "call_sv('$code', G_EVAL|G_ARRAY|$keep_desc)"; - @ret = call_sv($code, G_EVAL|G_ARRAY|$keep); + $desc = "call_sv('$code', G_EVAL|G_LIST|$keep_desc)"; + @ret = call_sv($code, G_EVAL|G_LIST|$keep); } is(scalar @ret, ($expect_success && $fn_type ne 'eval_pv') ? 2 : 1, "$desc - number of returned args"); diff --git a/ext/XS-APItest/t/multicall.t b/ext/XS-APItest/t/multicall.t index 8630df751fec..65d3ff00b769 100644 --- a/ext/XS-APItest/t/multicall.t +++ b/ext/XS-APItest/t/multicall.t @@ -75,7 +75,7 @@ use XS::APItest; { package Ret; - use XS::APItest qw(multicall_return G_VOID G_SCALAR G_ARRAY); + use XS::APItest qw(multicall_return G_VOID G_SCALAR G_LIST); # Helper function for the block that follows: # check that @$got matches what would be expected if a function returned @@ -93,11 +93,11 @@ use XS::APItest; "G_SCALAR: $desc: correct arg"); } else { - ::is (join('-',@$got), join('-', @$args), "G_ARRAY: $desc"); + ::is (join('-',@$got), join('-', @$args), "G_LIST: $desc"); } } - for my $gimme (G_VOID, G_SCALAR, G_ARRAY) { + for my $gimme (G_VOID, G_SCALAR, G_LIST) { my @a; # zero args diff --git a/gv.c b/gv.c index 10b729bf0266..fcde2123c0dd 100644 --- a/gv.c +++ b/gv.c @@ -3630,7 +3630,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) case G_VOID: myop.op_flags |= OPf_WANT_VOID; break; - case G_ARRAY: + case G_LIST: if (flags & AMGf_want_list) { myop.op_flags |= OPf_WANT_LIST; break; @@ -3679,7 +3679,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) res = &PL_sv_undef; SP = PL_stack_base + oldmark; break; - case G_ARRAY: + case G_LIST: if (flags & AMGf_want_list) { res = sv_2mortal((SV *)newAV()); av_extend((AV *)res, nret); diff --git a/op.c b/op.c index 27d2de0bd9e6..c17d1b07d2a7 100644 --- a/op.c +++ b/op.c @@ -1663,7 +1663,7 @@ Perl_alloc_LOGOP(pTHX_ I32 type, OP *first, OP* other) =for apidoc op_contextualize Applies a syntactic context to an op tree representing an expression. -C is the op tree, and C must be C, C, +C is the op tree, and C must be C, C, or C to specify the context to apply. The modified op tree is returned. @@ -1676,7 +1676,7 @@ Perl_op_contextualize(pTHX_ OP *o, I32 context) PERL_ARGS_ASSERT_OP_CONTEXTUALIZE; switch (context) { case G_SCALAR: return scalar(o); - case G_ARRAY: return list(o); + case G_LIST: return list(o); case G_VOID: return scalarvoid(o); default: Perl_croak(aTHX_ "panic: op_contextualize bad context %ld", @@ -5843,7 +5843,7 @@ Perl_newPROG(pTHX_ OP *o) if ((cx->blk_gimme & G_WANT) == G_VOID) scalarvoid(PL_eval_root); - else if ((cx->blk_gimme & G_WANT) == G_ARRAY) + else if ((cx->blk_gimme & G_WANT) == G_LIST) list(PL_eval_root); else scalar(PL_eval_root); @@ -18650,7 +18650,7 @@ const_av_xsub(pTHX_ CV* cv) #endif if (SvRMAGICAL(av)) Perl_croak(aTHX_ "Magical list constants are not supported"); - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { EXTEND(SP, 1); ST(0) = sv_2mortal(newSViv((IV)AvFILLp(av)+1)); XSRETURN(1); diff --git a/op.h b/op.h index cd3926ddc566..827304da0d1f 100644 --- a/op.h +++ b/op.h @@ -74,12 +74,12 @@ typedef PERL_BITFIELD16 Optype; =for apidoc Amn|U32|GIMME_V The XSUB-writer's equivalent to Perl's C. Returns C, -C or C for void, scalar or list context, +C or C for void, scalar or list context, respectively. See L for a usage example. =for apidoc AmnD|U32|GIMME A backward-compatible version of C which can only return -C or C; in a void context, it returns C. +C or C; in a void context, it returns C. Deprecated. Use C instead. =cut @@ -160,7 +160,7 @@ Deprecated. Use C instead. # define GIMME \ (PL_op->op_flags & OPf_WANT \ ? ((PL_op->op_flags & OPf_WANT) == OPf_WANT_LIST \ - ? G_ARRAY \ + ? G_LIST \ : G_SCALAR) \ : dowantarray()) #endif diff --git a/os2/os2.c b/os2/os2.c index ebe58b058b6d..7c4b6dd7da67 100644 --- a/os2/os2.c +++ b/os2/os2.c @@ -1990,7 +1990,7 @@ XS(XS_OS2_perfSysCall) if (total) { int i,j; - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { PUSHn(u[0][0]); /* Total ticks on the first processor */ XSRETURN(1); } diff --git a/perl.c b/perl.c index a84a26a1ba01..2c0ca42e4561 100644 --- a/perl.c +++ b/perl.c @@ -3100,7 +3100,7 @@ Perl_call_sv(pTHX_ SV *sv, volatile I32 flags) goto redo_body; } PL_stack_sp = PL_stack_base + oldmark; - if ((flags & G_WANT) == G_ARRAY) + if ((flags & G_WANT) == G_LIST) retval = 0; else { retval = 1; @@ -3227,7 +3227,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags) } PL_stack_sp = PL_stack_base + oldmark; - if ((flags & G_WANT) == G_ARRAY) + if ((flags & G_WANT) == G_LIST) retval = 0; else { retval = 1; diff --git a/pod/perlcall.pod b/pod/perlcall.pod index 44203e5fa846..b20bbdf4d9c5 100644 --- a/pod/perlcall.pod +++ b/pod/perlcall.pod @@ -122,7 +122,7 @@ been warned. =head1 FLAG VALUES The C parameter in all the I functions is one of C, -C, or C, which indicate the call context, OR'ed together +C, or C, which indicate the call context, OR'ed together with a bit mask of any combination of the other G_* symbols defined below. =head2 G_VOID @@ -194,11 +194,12 @@ I function. The section L shows an example of this behavior. -=head2 G_ARRAY +=head2 G_LIST -=for apidoc AmnUh||G_ARRAY +=for apidoc AmnUh||G_LIST -Calls the Perl subroutine in a list context. +Calls the Perl subroutine in a list context. Prior to Perl version +5.35.1 this was called C. As with G_SCALAR, this flag has 2 effects: @@ -224,7 +225,7 @@ If 0, then you have specified the G_DISCARD flag. If not 0, then it will be a count of the number of items returned by the subroutine. These items will be stored on the Perl stack. The section L gives an example of using the -G_ARRAY flag and the mechanics of accessing the returned items from the +G_LIST flag and the mechanics of accessing the returned items from the Perl stack. =head2 G_DISCARD @@ -235,7 +236,7 @@ By default, the I functions place the items returned from by the Perl subroutine on the stack. If you are not interested in these items, then setting this flag will make Perl get rid of them automatically for you. Note that it is still possible to indicate a -context to the Perl subroutine by using either G_SCALAR or G_ARRAY. +context to the Perl subroutine by using either G_SCALAR or G_LIST. If you do not set this flag then it is I important that you make sure that any temporaries (i.e., parameters passed to the Perl @@ -314,7 +315,7 @@ If G_DISCARD is specified, the return value will always be 0. =item * -If G_ARRAY is specified I an error has occurred, the return value +If G_LIST is specified I an error has occurred, the return value will always be 0. =item * @@ -372,7 +373,7 @@ use of this flag. As mentioned above, you can determine the context of the currently executing subroutine in Perl with I. The equivalent test can be made in C by using the C macro, which returns -C if you have been called in a list context, C if +C if you have been called in a list context, C if in a scalar context, or C if in a void context (i.e., the return value will not be used). An older version of this macro is called C; in a void context it returns C instead of @@ -750,7 +751,7 @@ and this is the C function PUSHs(sv_2mortal(newSViv(b))); PUTBACK; - count = call_pv("AddSubtract", G_ARRAY); + count = call_pv("AddSubtract", G_LIST); SPAGAIN; @@ -780,7 +781,7 @@ Notes =item 1. -We wanted list context, so G_ARRAY was used. +We wanted list context, so G_LIST was used. =item 2. @@ -1867,7 +1868,7 @@ of Values> recoded to use C instead of C. PUSHs(sv_2mortal(newSViv(b))); PUTBACK; - count = call_pv("AddSubtract", G_ARRAY); + count = call_pv("AddSubtract", G_LIST); SPAGAIN; SP -= count; @@ -1963,7 +1964,7 @@ The pattern of macro calls is like this: dMULTICALL; /* Declare local variables */ U8 gimme = G_SCALAR; /* context of the call: G_SCALAR, - * G_ARRAY, or G_VOID */ + * G_LIST, or G_VOID */ PUSH_MULTICALL(cv); /* Set up the context for calling cv, and set local vars appropriately */ diff --git a/pp.c b/pp.c index 4a2f67046809..f70d832cf273 100644 --- a/pp.c +++ b/pp.c @@ -230,7 +230,7 @@ Perl_softref2xv(pTHX_ SV *const sv, const char *const what, Perl_die(aTHX_ PL_no_usym, what); if (ckWARN(WARN_UNINITIALIZED)) report_uninit(sv); - if (type != SVt_PV && GIMME_V == G_ARRAY) { + if (type != SVt_PV && GIMME_V == G_LIST) { (*spp)--; return NULL; } @@ -423,7 +423,7 @@ PP(pp_srefgen) PP(pp_refgen) { dSP; dMARK; - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { if (++MARK <= SP) *MARK = *SP; else @@ -1669,7 +1669,7 @@ PP(pp_repeat) bool infnan = FALSE; const U8 gimme = GIMME_V; - if (gimme == G_ARRAY && PL_op->op_private & OPpREPEAT_DOLIST) { + if (gimme == G_LIST && PL_op->op_private & OPpREPEAT_DOLIST) { /* TODO: think of some way of doing list-repeat overloading ??? */ sv = POPs; SvGETMAGIC(sv); @@ -1734,7 +1734,7 @@ PP(pp_repeat) "Negative repeat count does nothing"); } - if (gimme == G_ARRAY && PL_op->op_private & OPpREPEAT_DOLIST) { + if (gimme == G_LIST && PL_op->op_private & OPpREPEAT_DOLIST) { dMARK; const SSize_t items = SP - MARK; const U8 mod = PL_op->op_flags & OPf_MOD; @@ -4951,7 +4951,7 @@ PP(pp_aslice) *MARK = svp ? *svp : &PL_sv_undef; } } - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { MARK = ORIGMARK; *++MARK = SP > ORIGMARK ? *SP : &PL_sv_undef; SP = MARK; @@ -4996,7 +4996,7 @@ PP(pp_kvaslice) } *++MARK = svp ? *svp : &PL_sv_undef; } - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { MARK = SP - items*2; *++MARK = items > 0 ? *SP : &PL_sv_undef; SP = MARK; @@ -5023,7 +5023,7 @@ PP(pp_aeach) EXTEND(SP, 2); mPUSHi(current); - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { SV **const element = av_fetch(array, current, 0); PUSHs(element ? *element : &PL_sv_undef); } @@ -5043,7 +5043,7 @@ PP(pp_akeys) dTARGET; PUSHi(av_count(array)); } - else if (gimme == G_ARRAY) { + else if (gimme == G_LIST) { if (UNLIKELY(PL_op->op_private & OPpMAYBE_LVSUB)) { const I32 flags = is_lvalue_sub(); if (flags && !(flags & OPpENTERSUB_INARGS)) @@ -5091,7 +5091,7 @@ PP(pp_each) if (entry) { SV* const sv = hv_iterkeysv(entry); PUSHs(sv); - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { SV *val; val = hv_iterval(hash, entry); PUSHs(val); @@ -5375,7 +5375,7 @@ PP(pp_hslice) } *MARK = svp && *svp ? *svp : &PL_sv_undef; } - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { MARK = ORIGMARK; *++MARK = SP > ORIGMARK ? *SP : &PL_sv_undef; SP = MARK; @@ -5396,7 +5396,7 @@ PP(pp_kvhslice) if (!(flags & OPpENTERSUB_INARGS)) /* diag_listed_as: Can't modify %s in %s */ Perl_croak(aTHX_ "Can't modify key/value hash slice in %s assignment", - GIMME_V == G_ARRAY ? "list" : "scalar"); + GIMME_V == G_LIST ? "list" : "scalar"); lval = flags; } } @@ -5425,7 +5425,7 @@ PP(pp_kvhslice) } *++MARK = svp && *svp ? *svp : &PL_sv_undef; } - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { MARK = SP - items*2; *++MARK = items > 0 ? *SP : &PL_sv_undef; SP = MARK; @@ -5438,7 +5438,7 @@ PP(pp_kvhslice) PP(pp_list) { I32 markidx = POPMARK; - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { /* don't initialize mark here, EXTEND() may move the stack */ SV **mark; dSP; @@ -5466,7 +5466,7 @@ PP(pp_lslice) const I32 max = lastrelem - lastlelem; SV **lelem; - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { if (lastlelem < firstlelem) { EXTEND(SP, 1); *firstlelem = &PL_sv_undef; @@ -5630,7 +5630,7 @@ PP(pp_splice) } MARK = ORIGMARK + 1; - if (GIMME_V == G_ARRAY) { /* copy return vals to stack */ + if (GIMME_V == G_LIST) { /* copy return vals to stack */ const bool real = cBOOL(AvREAL(ary)); MEXTEND(MARK, length); if (real) @@ -5728,7 +5728,7 @@ PP(pp_splice) } MARK = ORIGMARK + 1; - if (GIMME_V == G_ARRAY) { /* copy return vals to stack */ + if (GIMME_V == G_LIST) { /* copy return vals to stack */ if (length) { const bool real = cBOOL(AvREAL(ary)); if (real) @@ -5864,7 +5864,7 @@ PP(pp_reverse) { dSP; dMARK; - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { if (PL_op->op_private & OPpREVERSE_INPLACE) { AV *av; @@ -6407,7 +6407,7 @@ PP(pp_split) SPAGAIN; } - if (gimme != G_ARRAY) { + if (gimme != G_LIST) { /* SP points to the final SV* pushed to the stack. But the SV* */ /* are not going to be used from the stack. Point SP to below */ /* the first of these SV*. */ @@ -6425,7 +6425,7 @@ PP(pp_split) LEAVE_with_name("call_PUSH"); SPAGAIN; - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { SSize_t i; /* EXTEND should not be needed - we just popped them */ EXTEND_SKIP(SP, iters); @@ -6438,7 +6438,7 @@ PP(pp_split) } } - if (gimme != G_ARRAY) { + if (gimme != G_LIST) { GETTARGET; XPUSHi(iters); } diff --git a/pp.h b/pp.h index cea956db4078..d773e3f1723b 100644 --- a/pp.h +++ b/pp.h @@ -612,7 +612,7 @@ Does not use C. See also C>, C> and C>. if (gimme == G_VOID) { \ NOOP; \ } \ - else if (gimme == G_ARRAY) { \ + else if (gimme == G_LIST) { \ SSize_t i; \ SSize_t len; \ assert(SvTYPE(tmpsv) == SVt_PVAV); \ diff --git a/pp_ctl.c b/pp_ctl.c index 6a373b3e5d04..566353460f98 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -63,7 +63,7 @@ PP(pp_wantarray) } switch (cx->blk_gimme) { - case G_ARRAY: + case G_LIST: RETPUSHYES; case G_SCALAR: RETPUSHNO; @@ -1055,7 +1055,7 @@ PP(pp_mapwhile) } /* copy the new items down to the destination list */ dst = PL_stack_base + (PL_markstack_ptr[-2] += items) - 1; - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { /* add returned items to the collection (making mortal copies * if necessary), then clear the current temps stack frame * *except* for those items. We do this splicing the items @@ -1121,7 +1121,7 @@ PP(pp_mapwhile) dTARGET; XPUSHi(items); } - else if (gimme == G_ARRAY) + else if (gimme == G_LIST) SP += items; RETURN; } @@ -1148,7 +1148,7 @@ PP(pp_mapwhile) PP(pp_range) { dTARG; - if (GIMME_V == G_ARRAY) + if (GIMME_V == G_LIST) return NORMAL; GETTARGET; if (SvTRUE_NN(targ)) @@ -1161,7 +1161,7 @@ PP(pp_flip) { dSP; - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { RETURNOP(((LOGOP*)cUNOP->op_first)->op_other); } else { @@ -1219,7 +1219,7 @@ PP(pp_flop) { dSP; - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { dPOPPOPssrl; SvGETMAGIC(left); @@ -1941,7 +1941,7 @@ PP(pp_caller) cx = caller_cx(count + !!(PL_op->op_private & OPpOFFBYONE), &dbcx); if (!cx) { - if (gimme != G_ARRAY) { + if (gimme != G_LIST) { EXTEND(SP, 1); RETPUSHUNDEF; } @@ -1953,7 +1953,7 @@ PP(pp_caller) stash_hek = SvTYPE(CopSTASH(cx->blk_oldcop)) == SVt_PVHV ? HvNAME_HEK((HV*)CopSTASH(cx->blk_oldcop)) : NULL; - if (gimme != G_ARRAY) { + if (gimme != G_LIST) { EXTEND(SP, 1); if (!stash_hek) PUSHs(&PL_sv_undef); @@ -2001,7 +2001,7 @@ PP(pp_caller) if (gimme == G_VOID) PUSHs(&PL_sv_undef); else - PUSHs(boolSV((gimme & G_WANT) == G_ARRAY)); + PUSHs(boolSV((gimme & G_WANT) == G_LIST)); if (CxTYPE(cx) == CXt_EVAL) { /* eval STRING */ if (CxOLD_OP_TYPE(cx) == OP_ENTEREVAL) { @@ -2105,7 +2105,7 @@ PP(pp_dbstate) { dSP; PERL_CONTEXT *cx; - const U8 gimme = G_ARRAY; + const U8 gimme = G_LIST; GV * const gv = PL_DBgv; CV * cv = NULL; @@ -2444,7 +2444,7 @@ PP(pp_leavesublv) } } else { - assert(gimme == G_ARRAY); + assert(gimme == G_LIST); assert (!(lval & OPpDEREF)); if (is_lval) { @@ -2564,7 +2564,7 @@ PP(pp_return) if (oldsp != MARK) { SSize_t nargs = SP - MARK; if (nargs) { - if (cx->blk_gimme == G_ARRAY) { + if (cx->blk_gimme == G_LIST) { /* shift return args to base of call stack frame */ Move(MARK + 1, oldsp + 1, nargs, SV*); PL_stack_sp = oldsp + nargs; @@ -3587,7 +3587,7 @@ S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV *hh) if (!*(SvPV_nolen_const(errsv))) sv_setpvs(errsv, "Compilation error"); - if (gimme != G_ARRAY) PUSHs(&PL_sv_undef); + if (gimme != G_LIST) PUSHs(&PL_sv_undef); PUTBACK; return FALSE; } @@ -4049,9 +4049,9 @@ S_require_file(pTHX_ SV *sv) loader = l; } if (sv_isobject(loader)) - count = call_method("INC", G_ARRAY); + count = call_method("INC", G_LIST); else - count = call_sv(loader, G_ARRAY); + count = call_sv(loader, G_LIST); SPAGAIN; if (count > 0) { diff --git a/pp_hot.c b/pp_hot.c index 642e3f0d4289..c693b301bb54 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1787,7 +1787,7 @@ S_padhv_rv2hv_common(pTHX_ HV *hv, U8 gimme, bool is_keys, bool has_targ) assert(PL_op->op_type == OP_PADHV || PL_op->op_type == OP_RV2HV); - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { hv_pushkv(hv, 3); return NORMAL; } @@ -1879,7 +1879,7 @@ PP(pp_padav) } gimme = GIMME_V; - if (gimme == G_ARRAY) + if (gimme == G_LIST) return S_pushav(aTHX_ (AV*)TARG); if (gimme == G_SCALAR) { @@ -1979,7 +1979,7 @@ PP(pp_rv2av) else if (UNLIKELY(PL_op->op_private & OPpMAYBE_LVSUB)) { const I32 flags = is_lvalue_sub(); if (flags && !(flags & OPpENTERSUB_INARGS)) { - if (gimme != G_ARRAY) + if (gimme != G_LIST) goto croak_cant_return; SETs(sv); RETURN; @@ -1989,7 +1989,7 @@ PP(pp_rv2av) if (is_pp_rv2av) { AV *const av = MUTABLE_AV(sv); - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { SP--; PUTBACK; return S_pushav(aTHX_ av); @@ -2367,7 +2367,7 @@ PP(pp_aassign) * (or pass through where we can optimise away the copy) */ if (UNLIKELY(alias)) { - U32 lval = (gimme == G_ARRAY) + U32 lval = (gimme == G_LIST) ? (PL_op->op_flags & OPf_MOD || LVRET) : 0; for (svp = relem; svp <= lastrelem; svp++) { SV *rsv = *svp; @@ -2540,7 +2540,7 @@ PP(pp_aassign) /* possibly protect keys */ - if (UNLIKELY(gimme == G_ARRAY)) { + if (UNLIKELY(gimme == G_LIST)) { /* handle e.g. * @a = ((%h = ($$r, 1)), $r = "x"); * $_++ for %h = (1,2,3,4); @@ -2588,7 +2588,7 @@ PP(pp_aassign) dirty_tmps = FALSE; - if (UNLIKELY(gimme == G_ARRAY)) { + if (UNLIKELY(gimme == G_LIST)) { /* @a = (%h = (...)) etc */ SV **svp; SV **topelem = relem; @@ -3047,7 +3047,7 @@ PP(pp_match) * only on the first iteration. Therefore we need to copy $' as well * as $&, to make the rest of the string available for captures in * subsequent iterations */ - if (! (global && gimme == G_ARRAY)) + if (! (global && gimme == G_LIST)) r_flags |= REXEC_COPY_SKIP_POST; }; #ifdef PERL_SAWAMPERSAND @@ -3080,7 +3080,7 @@ PP(pp_match) /* update pos */ - if (global && (gimme != G_ARRAY || (dynpm->op_pmflags & PMf_CONTINUE))) { + if (global && (gimme != G_LIST || (dynpm->op_pmflags & PMf_CONTINUE))) { if (!mg) mg = sv_magicext_mglob(TARG); MgBYTEPOS_set(mg, TARG, truebase, RXp_OFFS(prog)[0].end); @@ -3090,7 +3090,7 @@ PP(pp_match) mg->mg_flags &= ~MGf_MINMATCH; } - if ((!RXp_NPARENS(prog) && !global) || gimme != G_ARRAY) { + if ((!RXp_NPARENS(prog) && !global) || gimme != G_LIST) { LEAVE_SCOPE(oldsave); RETPUSHYES; } @@ -3145,7 +3145,7 @@ PP(pp_match) mg->mg_len = -1; } LEAVE_SCOPE(oldsave); - if (gimme == G_ARRAY) + if (gimme == G_LIST) RETURN; RETPUSHNO; } @@ -3342,7 +3342,7 @@ Perl_do_readline(pTHX) f < (U8*)SvEND(sv) ? *f : 0); } } - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { if (SvLEN(sv) - SvCUR(sv) > 20) { SvPV_shrink_to_cur(sv); } @@ -4579,7 +4579,7 @@ PP(pp_grepwhile) PUSHi(items); } } - else if (gimme == G_ARRAY) + else if (gimme == G_LIST) SP += items; RETURN; } @@ -4672,7 +4672,7 @@ Perl_leave_adjust_stacks(pTHX_ SV **from_sp, SV **to_sp, U8 gimme, int pass) TAINT_NOT; - if (gimme == G_ARRAY) { + if (gimme == G_LIST) { nargs = SP - from_sp; from_sp++; } @@ -4692,7 +4692,7 @@ Perl_leave_adjust_stacks(pTHX_ SV **from_sp, SV **to_sp, U8 gimme, int pass) } } - /* common code for G_SCALAR and G_ARRAY */ + /* common code for G_SCALAR and G_LIST */ tmps_base = PL_tmps_floor + 1; diff --git a/pp_sort.c b/pp_sort.c index 253c2977d0fe..adb2fee6b1de 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -716,7 +716,7 @@ PP(pp_sort) if ((priv & OPpSORT_UNSTABLE) != 0) sort_flags |= SORTf_UNSTABLE; - if (gimme != G_ARRAY) { + if (gimme != G_LIST) { SP = MARK; EXTEND(SP,1); RETPUSHUNDEF; diff --git a/pp_sys.c b/pp_sys.c index 7d0af1f43e5c..9d5d3909ded2 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -1280,7 +1280,7 @@ PP(pp_sselect) } PUSHi(nfound); - if (GIMME_V == G_ARRAY && tbuf) { + if (GIMME_V == G_LIST && tbuf) { value = (NV)(timebuf.tv_sec) + (NV)(timebuf.tv_usec) / 1000000.0; mPUSHn(value); @@ -2906,7 +2906,7 @@ PP(pp_stat) } gimme = GIMME_V; - if (gimme != G_ARRAY) { + if (gimme != G_LIST) { if (gimme != G_VOID) XPUSHs(boolSV(max)); RETURN; @@ -4038,9 +4038,9 @@ PP(pp_readdir) if (!(IoFLAGS(io) & IOf_UNTAINT)) SvTAINTED_on(sv); mXPUSHs(sv); - } while (gimme == G_ARRAY); + } while (gimme == G_LIST); - if (!dp && gimme != G_ARRAY) + if (!dp && gimme != G_LIST) RETPUSHUNDEF; RETURN; @@ -4048,7 +4048,7 @@ PP(pp_readdir) nope: if (!errno) SETERRNO(EBADF,RMS_ISI); - if (gimme == G_ARRAY) + if (gimme == G_LIST) RETURN; else RETPUSHUNDEF; @@ -4673,7 +4673,7 @@ PP(pp_tms) (void)PerlProc_times(×buf); mPUSHn(((NV)timesbuf.tms_utime)/(NV)PL_clocktick); - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { mPUSHn(((NV)timesbuf.tms_stime)/(NV)PL_clocktick); mPUSHn(((NV)timesbuf.tms_cutime)/(NV)PL_clocktick); mPUSHn(((NV)timesbuf.tms_cstime)/(NV)PL_clocktick); @@ -4683,7 +4683,7 @@ PP(pp_tms) dSP; mPUSHn(0.0); EXTEND(SP, 4); - if (GIMME_V == G_ARRAY) { + if (GIMME_V == G_LIST) { mPUSHn(0.0); mPUSHn(0.0); mPUSHn(0.0); @@ -4766,7 +4766,7 @@ PP(pp_gmtime) "%s(%.0" NVff ") failed", opname, when); } - if (GIMME_V != G_ARRAY) { /* scalar context */ + if (GIMME_V != G_LIST) { /* scalar context */ EXTEND(SP, 1); if (err == NULL) RETPUSHUNDEF; @@ -5017,7 +5017,7 @@ PP(pp_ghostent) } #endif - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { PUSHs(sv = sv_newmortal()); if (hent) { if (which == OP_GHBYNAME) { @@ -5104,7 +5104,7 @@ PP(pp_gnetent) #endif EXTEND(SP, 4); - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { PUSHs(sv = sv_newmortal()); if (nent) { if (which == OP_GNBYNAME) @@ -5168,7 +5168,7 @@ PP(pp_gprotoent) #endif EXTEND(SP, 3); - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { PUSHs(sv = sv_newmortal()); if (pent) { if (which == OP_GPBYNAME) @@ -5234,7 +5234,7 @@ PP(pp_gservent) #endif EXTEND(SP, 4); - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { PUSHs(sv = sv_newmortal()); if (sent) { if (which == OP_GSBYNAME) { @@ -5470,7 +5470,7 @@ PP(pp_gpwent) } EXTEND(SP, 10); - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { PUSHs(sv = sv_newmortal()); if (pwent) { if (which == OP_GPWNAM) @@ -5612,7 +5612,7 @@ PP(pp_ggrent) #endif EXTEND(SP, 4); - if (GIMME_V != G_ARRAY) { + if (GIMME_V != G_LIST) { SV * const sv = sv_newmortal(); PUSHs(sv); diff --git a/regcomp.c b/regcomp.c index e6ca7800c87c..512e6a165b3a 100644 --- a/regcomp.c +++ b/regcomp.c @@ -25279,7 +25279,7 @@ S_handle_names_wildcard(pTHX_ const char * wname, /* wildcard name to match */ /* Special _charnames entry point that returns the info this routine * requires */ - call_sv(MUTABLE_SV(get_names_info), G_ARRAY); + call_sv(MUTABLE_SV(get_names_info), G_LIST); SPAGAIN ; diff --git a/scope.c b/scope.c index acbc8e987949..8119c4ac632e 100644 --- a/scope.c +++ b/scope.c @@ -1519,7 +1519,7 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx) case G_SCALAR: gimme_text = "SCALAR"; break; - case G_ARRAY: + case G_LIST: gimme_text = "LIST"; break; default: diff --git a/t/op/aassign.t b/t/op/aassign.t index 41d7c829855b..7ba95918210b 100644 --- a/t/op/aassign.t +++ b/t/op/aassign.t @@ -386,9 +386,9 @@ SKIP: { # both keys and values stealable @a = (%h = (split /-/, "abc-def")[0,1,0,1]); - is (join(':', keys %h), "abc", "NOSTEAL split G_ARRAY keys"); - is (join(':', values %h), "def", "NOSTEAL split G_ARRAY values"); - is (join(':', @a), "abc:def", "NOSTEAL split G_ARRAY result"); + is (join(':', keys %h), "abc", "NOSTEAL split list-context keys"); + is (join(':', values %h), "def", "NOSTEAL split list-context values"); + is (join(':', @a), "abc:def", "NOSTEAL split list-context result"); } { diff --git a/universal.c b/universal.c index 5932767bdf3a..cce2a87d1cde 100644 --- a/universal.c +++ b/universal.c @@ -997,7 +997,7 @@ XS(XS_re_regexp_pattern) /* Houston, we have a regex! */ SV *pattern; - if ( gimme == G_ARRAY ) { + if ( gimme == G_LIST ) { STRLEN left = 0; char reflags[sizeof(INT_PAT_MODS) + MAX_CHARSET_NAME_LENGTH]; const char *fptr; @@ -1044,7 +1044,7 @@ XS(XS_re_regexp_pattern) } } else { /* It ain't a regexp folks */ - if ( gimme == G_ARRAY ) { + if ( gimme == G_LIST ) { /* return the empty list */ XSRETURN_EMPTY; } else {