summaryrefslogtreecommitdiff
path: root/t
Commit message (Collapse)AuthorAgeFilesLines
* dual-life CarpZefram2011-09-041-0/+1
| | | | | | | | | Make Carp portable to older Perl versions: * check minimum Perl version (5.6) at load time * use || instead of // * attempt downgrading to avoid loading Unicode tables when that might fail * check whether utf8::is_utf8() exists before calling it * lower IPC::Open3 version requirement in Carp tests
* Call get-magic once for CV-to-GV assignmentFather Chrysostomos2011-09-031-1/+10
| | | | | | | pp_rv2gv has already called get-magic, so pp_sassign should not do it at all. This is a regression from 5.8.8.
* utf8_heavy: Correctly handle \p{L_}Karl Williamson2011-09-021-0/+5
| | | | | | | | | | | L_ is an old, discouraged but not deprecated, synonym for LC, cased letters. It was improperly being converted to simply L, all letters, because it is supposed to match loosely, and the trailing underscore was being stripped. It needs a special case. Tests passed for this, as the machine generated test case happened to choose code points that are in both L and LC. Also some tests were testing L instead of LC because of a similar flaw.
* Unicode::UCD: fix pod verbatim line lengthKarl Williamson2011-09-021-1/+0
|
* Fix two \&$tied regressionsFather Chrysostomos2011-09-011-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the tied variable holds a reference, but changes to something else when FETCH is called, perl crashes, as of commit 9d0f7ed75 (5.10.1/5.12.0): sub ::72 { 73 }; sub TIESCALAR {bless[]} sub STORE{} sub FETCH { 72 } tie my $x, "main"; $x = \$y; \&$x; That’s because commit 7a5fd60d4 caused double magic for one branch of an if/else chain in sv_2cv (by using gv_fetchsv), so commit 9d0f7ed75 removed the SvGETMAGIC preceding the if/else, putting it inside each branch. That meant that the type would be checked before get-magic was called. So the type could change unexpectedly. Due to another bug, this did not affect globs returned from tied array elements, which got stringified, and hence worked in sv_2cv. But that bug was fixed in 5.14.0 by commit 13be902ce, which allowed typeglobs to be returned unflattened through elements of tied aggregates, caus- ing this to stop working (‘Not a CODE reference’ instead of 73): sub ::72 { 73 }; sub TIEARRAY {bless[]} sub STORE{} sub FETCH { 72 } tie my @x, "main"; my $elem = \$x[0]; $$elem = *bar; print &{\&$$elem}, "\n"; This commit fixes both issues by putting the SvGETMAGIC call back where it belongs, above the if/else chain, and by using SvPV_nomg_const and gv_fetchpvn_flags instead of gv_fetchsv, to avoid an extra magic call.
* regen known_pod_issues.datFather Chrysostomos2011-09-011-6/+3
|
* Use OPpDEREF for lvalue sub, such that the flags contains the deref type, ↵Gerard Goossen2011-09-011-1/+4
| | | | | | | instead of deriving it from the opchain. Also contains a test where using the opchain to determine the deref type fails.
* [perl #97492] Tests & delta for defined ${"::!"}Father Chrysostomos2011-09-011-2/+2
|
* [perl #97484] Make defined &{...} vivify CORE subsFather Chrysostomos2011-09-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | Magical variables usually get autovivified, even in rvalue context, because Perl is trying to pretend they have been there all along. That means defined(${"."}) will autovivify $. and return true. Until CORE subs were introduced, there were no subroutines that popped into existence when looked at. This commit makes rv_2cv use the GV_ADDMG flag added in commit 23496c6ea. When this flag is passed, gv_fetchpvn_flags creates a GV but does not add it to the stash until it finds out that it is creat- ing a magical one. The CORE sub code calls newATTRSUB, which expects to add the CV to the stash itself. So the gv has to be added there and then. So gv_fetchpvn_flags is also adjusted to add the gv to the stash right before calling newATTRSUB, and to tell itself that the GV_ADDMG flag is actually off. It might be better to move the CV-creation code into op.c and inline parts of newATTRSUB, to avoid fiddling with the addmg variable (and avoid prototype checks on CORE subs), but that refactoring should probably come in separate commits.
* Make switchC.t pass if the environment variable PERL_UNICODE contains "S"Rafael Garcia-Suarez2011-08-311-6/+11
| | | | | (actually doing so the quick way, by skipping the last test, that tests for -CS on the shebang line)
* Eliminate is_gv_magical_svFather Chrysostomos2011-08-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This resolves perl bug #97978. Many built-in variables, like $], are actually created on the fly when first accessed. Perl likes to pretend that these variables have always existed, so it autovivifies the *] glob even in rvalue context (e.g., defined *{"]"}, close "]"). The list of variables that were autovivified was maintained separ- ately (in is_gv_magical_sv) from the code that actually creates them (gv_fetchpvn_flags). ‘Maintained’ is not actually precise: it *wasn’t* being maintained, and there were new variables that never got added to is_gv_magical_sv and one deleted variable that was never removed. There are only two pieces of code that call is_gv_magical_sv, both in pp.c: S_rv2gv (called by *{} and also the implicit *{} that functions like close() provide) and Perl_softrefxv (called by ${}, @{}, %{}). In both cases, the glob is immediately autovivified if is_gv_magical_sv returns true. So this commit eliminates the extra maintenance burden by extirpat- ing is_gv_magical_sv altogether, and replacing it with a new flag to gv_fetchpvn_flags, GvADDMG, which will autovivify a glob *if* it’s a magical one. It does make defined(*{"frobbly"}) slightly slower, in that it creates a temporary glob and then frees it when it sees nothing magical has been done with it. But this case is rare enough it should not matter. At least I got rid of the bugginess.
* &CORE::write()Father Chrysostomos2011-08-291-0/+6
| | | | | | This commit allows &CORE::write to be called through references and via ampersand syntax. No change to pp_enterwrite was necessary, as it can already handle nulls.
* &CORE::unpack()Father Chrysostomos2011-08-291-1/+18
| | | | | | | | | | | This commit allows &CORE::unpack to be called through references and via ampersand syntax. It moves the $_-handling code in pp_coreargs inside the parameter loop, so it can apply to the second parameter, not just the first. Consequently, a mkdir test has been added that ensures implicit $_ is not used for mkdir’s second argument; i.e., that the $_-handling code’s if() condition is correct.
* &CORE::umask()Father Chrysostomos2011-08-291-0/+5
| | | | | | | | This commit allows &CORE::umask to be called through references and via ampersand syntax. pp_umask is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell umask how many arguments it’s actually getting. See commit 0163043a for details.
* &CORE::foo() for tie functionsFather Chrysostomos2011-08-291-12/+43
| | | | | | | This commit allows the tie, tied and untie subroutines in the CORE namespace to be called through references and via &ampersand() syntax. pp_coreargs is modified to handle the functions with \[$@%*] in their prototypes (which happen to be just the tie functions).
* &CORE::tell()Father Chrysostomos2011-08-291-0/+10
| | | | | | | | This commit allows &CORE::tell to be called through references and via ampersand syntax. pp_tell is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell pp_tell how many arguments it’s actually getting. See commit 0163043a for details.
* &CORE::setpgrp()Father Chrysostomos2011-08-291-1/+12
| | | | | | | | This commit allows &CORE::setpgrp to be called through references and via ampersand syntax. pp_setpgrp is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell setpgrp how many arguments it’s actually getting. See commit 0163043a for details.
* Make setpgrp($x) equivalent to setpgrp($x,0)Father Chrysostomos2011-08-291-1/+3
| | | | | Prior to this commit, setpgrp(27) was equivalent to (27, setpgrp), because it ignored the argument on the stack when there was only one.
* make setpgrpstack.t use skip_all_without_configFather Chrysostomos2011-08-291-6/+3
|
* For s///r, don't call SvPV_force() on the original value. Resolves #97954.Nicholas Clark2011-08-291-1/+33
| | | | | | | | 8ca8a454f60a417f optimised the implementation of s///r by avoiding an unconditional copy of the original value. However, it introduced a behaviour regression where if original value happened to be one of a few particular types, it could be modified by being forced to a string using SvPV_force(). The substitution was (correctly) performed on a copy of this string.
* Remove some resolved pod issuesFlorian Ragwitz2011-08-291-7/+0
|
* &CORE::sysopen()Father Chrysostomos2011-08-281-0/+9
| | | | | | | | This commit allows &CORE::sysopen to be called through references and via ampersand syntax. pp_sysopen is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell sysopen how many arguments it’s actually getting. See commit 0163043a for details.
* Make tie_fetch_count.t pass with PERL_UNICODE setFather Chrysostomos2011-08-281-4/+4
|
* Make coreamp.t pass with PERL_UNICODE setFather Chrysostomos2011-08-281-1/+9
|
* &CORE::substr()Father Chrysostomos2011-08-271-0/+10
| | | | | | | | | | | | | | | | | | This commit makes &CORE::substr callable through references and via &ampersand syntax. It’s a bit awkward, as we need a substr op that is flagged as hav- ing 4 arguments *and* possibly returning an lvalue. The code in op_lvalue_flags wasn’t really set up for that, so I needed to flag the op with OPpMAYBE_LVSUB in coresub_op before it gets passed to op_lvalue_flags. It turned out that only that was necessary, as op_lvalue_flags does an op_private == 4 check (rather than (op_private & 7) == 4 or some such) when checking for the 4-arg case and croak- ing. When the op arrives in op_lvalue_flags, it’s already flagged OPpMAYBE_LVSUB|4 which != 4. pp_substr is also modified to check for nulls and, if necessary, adjust its count of how many arguments were actually passed.)
* &CORE::srand()Father Chrysostomos2011-08-271-0/+6
| | | | | | | | This commit allows &CORE::srand to be called through references and via ampersand syntax. pp_srand is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell srand how many arguments it’s actually getting. See commit 0163043a for details.
* &CORE::sleep()Father Chrysostomos2011-08-271-0/+1
| | | | | | | | | | | This commit allows &CORE::sleep to be called through references and via ampersand syntax. pp_sleep is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell sleep how many arguments it’s actually getting. See commit 0163043a for details. Unfortunately, sleep with no args is nearly impossible to test porta- bly. But I have checked that it works.
* &CORE::send() and &CORE::syswrite()Father Chrysostomos2011-08-271-0/+3
| | | | | | | | This commit makes &CORE::send and &CORE::syswrite callable through references and & syntax. All this commit has to do is remove them from the exception list in gv.c, as previous commits happen to have made them work. (I didn’t realise originally that these use pushmark.)
* &CORE::select()Father Chrysostomos2011-08-271-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit allows CORE::select to be called through references and via &ampersand syntax. This is a tricky case, as the select keyword represents two distinct operators. ck_select replaces the OP_SELECT with an OP_SSELECT if there is more that one argument. So what we do here is create an if(@_>1)/else block with the usual op-with-coreargs-child inside each branch. The op tree looks like this: $ ./perl -Ilib -mO=Concise,CORE::select -e 'BEGIN{\&CORE::select} ' CORE::select: 8 <1> leavesub[1 ref] K/REFC,1 ->(end) - <1> null K/1 ->8 5 <|> cond_expr(other->6) K/1 ->9 4 <2> gt sK/2 ->5 2 <1> rv2av[t4] sK/1 ->3 1 <#> gv[*_] s ->2 3 <$> const[IV 1] s ->4 7 <@> sselect[t2] K ->8 - <0> ex-pushmark s ->6 6 <$> coreargs(IV 218) ->7 a <@> select[t1] sK/1 ->8 - <0> ex-pushmark s ->9 9 <$> coreargs(IV 219) s/DREF1 ->a -e syntax OK There was no need to modify pp_select to handle a null when there is no argument, as it can already handle it.
* Get coreamp.t passing on VMS.Craig A. Berry2011-08-271-2/+6
| | | | | | | | | | | | The last record in a file ends with a newline willy nilly, so we might as well write (and test for) one explicitly. The name of a directory file ends with .DIR, so we need to allow for that. File::Temp panics when trying to delete the directory that is the current working directory, so save where we were and restore to it before clean-up.
* Make pod2html a regular script without substitutionsFlorian Ragwitz2011-08-271-0/+2
| | | | | | This will make the CPAN dist easier. For the perl core, we still need substitutions to get the right she-bang as we don't go through EU::MM to fix it for us. For that, we add utils/pod2html.PL.
* &CORE::reset()Father Chrysostomos2011-08-261-0/+14
| | | | | | | | This commit allows &CORE::reset to be called through references and via ampersand syntax. pp_reset is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell reset how many arguments it’s actually getting. See commit 0163043a for details.
* GVs of localised arrays and hashes should be refcountedFather Chrysostomos2011-08-261-3/+7
| | | | | | | | | | Otherwise the GV can be freed before the scope-popping code can put the old entry back in it: $ perl -le 'local @{"x"}; delete $::{x}' Bus error $ perl -le 'local %{"x"}; delete $::{x}' Bus error
* &CORE::foo() for (sys)read and recvFather Chrysostomos2011-08-261-0/+40
| | | | | | | | | | | | | | These are grouped together because they all have \$ in their prototypes. This commit allows the subs in the CORE package under those names to be called through references and via &ampersand syntax. The coreargs op in the subroutine is marked with the OPpSCALARMOD flag. (scalar_mod_type in op.c returns true for these three ops, indicating that the OA_SCALARREF parameter is \$, not \[$@%(&)*].) pp_coreargs uses that flag to decide what arguments to reject.
* Update the comments at the top of t/op/core*.tFather Chrysostomos2011-08-262-7/+4
|
* Rename t/op/core*.tFather Chrysostomos2011-08-263-793/+793
| | | | | | | | Originally, coresubs.t was going to be for generic tests and coreinline.t was going to be for inlining. But the latter ended up testing other things than inlining, the former testing just &ampersand() calls. So this commits renames coresubs.t to coreamp.t and coreinline.t to coresubs.t.
* &CORE::rand()Father Chrysostomos2011-08-261-0/+7
| | | | | | | | This commit allows &CORE::rand to be called through references and via ampersand syntax. pp_rand is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell rand how many arguments it’s actually getting. See commit 0163043a for details.
* &CORE::open()Father Chrysostomos2011-08-261-2/+21
| | | | | | This commit allows &CORE::open to be called through references or with ampersand syntax. It modifies pp_coreargs not to push nulls for ops that require a pushmark.
* Reverse the order of two tests in gv.tFather Chrysostomos2011-08-261-1/+1
| | | | | | so that the first does not make the second always pass. The bug that 99fc7eca4 fixed would never had occurred if they had been that way to begin with.
* &CORE::mkdir()Father Chrysostomos2011-08-261-0/+23
| | | | | | | | This commit allows &CORE::mkdir to be called through references and via ampersand syntax. pp_mkdir is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell mkdir how many arguments it’s actually getting.
* &CORE::lock()Father Chrysostomos2011-08-261-0/+33
| | | | | | | | | | | | | This commit allows &CORE::lock to be called through references and via ampersand syntax. It adds code to pp_coreargs for handling the OA_SCALARREF case, though what it adds is currently lock-specific. (Subsequent commits will address that.) Since lock returns the scalar passed to it, not a copy, &CORE::lock needs to use op_leavesublv, rather than op_leavesub. But it can’t be an lvalue sub, as &CORE::lock = 3 should be disallowed. So we use the sneaky trick of turning on the lvalue flag before attaching the op tree to the sub (which causes newATTRSUB to use op_leavesublv), and then turning it off afterwards.
* &CORE::index() and &CORE::rindex()Father Chrysostomos2011-08-261-0/+14
| | | | | | | | This commit allows &CORE::index and &CORE::rindex to be called through references and via ampersand syntax. pp_index is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell pp_index how many arguments it’s actually getting. See commit 0163043a for details.
* &CORE::gmtime() and &CORE::localtime()Father Chrysostomos2011-08-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit allows &CORE::gmtime and &CORE::localtime to be called through references and via ampersand syntax. pp_gmtime is modified to take into account the nulls pushed on to the stack in pp_coreargs, which happens because pp_coreargs has no other way to tell pp_gmtime how many arguments it’s actually getting. I was going to say ‘see commit f6a1686942 for more details’, but found out, to my horror, that most of the commit message was cut off. I don’t know which commit-munging part of git is responsible, but I’ve had similar problems with git am and git commit --amend. But, then, this could have been sloppy copy and paste. Anyway, here is the missing part: Usually, an op that has optional arguments has the number of arguments indicated with flags on the op itself: $ ./perl -Ilib -MO=Concise -e 'binmode 1' 6 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 5 <@> binmode vK/1 ->6 - <0> ex-pushmark s ->3 4 <1> rv2gv sK*/1 ->5 3 <$> gv(*1) s ->4 -e syntax OK $ ./perl -Ilib -MO=Concise -e 'binmode 1,2' 7 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 6 <@> binmode vK/2 ->7 - <0> ex-pushmark s ->3 4 <1> rv2gv sK*/1 ->5 3 <$> gv(*1) s ->4 5 <$> const(IV 2) s ->6 -e syntax OK Notice the /1 vs /2 on the binmode op. With a CORE sub, we have a single op for both cases. So, what this commit does is set the number of arguments to the maximum, push nulls on to the stack in pp_coreargs (actually, it was already set up to do it, so there is no change there), and have the pp_ functions for each op that has optional arguments do a null check after popping the stack. pp_binmode already does a null check, but other pp_ functions will need to be modified. Since each one is different, those will come in separate commits. This is what &CORE::binmode’s op tree looks like: $ ./perl -Ilib -MO=Concise,CORE::binmode -e 'BEGIN{\&CORE::binmode}' CORE::binmode: 3 <1> leavesub[1 ref] K/REFC,1 ->(end) 2 <@> binmode sK/2 ->3 - <0> ex-pushmark s ->1 1 <$> coreargs(IV 212) s ->2 -e syntax OK
* Make *{undef} self-consistentFather Chrysostomos2011-08-262-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Commit afd1915d made filehandle vivification work on hash and array elements, but in doing so it accidentally changed *{;undef} = 3; to do the same thing as *{""} = 3; while leaving *{$some_undefined_variable} an error. This commit adjusts the if() conditions in S_rv2gv (formerly in pp_rv2gv) in pp.c to make PL_sv_undef follow the same path as before. It also removes the uninit tests from lib/warnings/pp, since they are now errors. The uninit warning in rv2gv is only triggered now when it is implicit, as in close(). That is already tested in lib/warnings/9uninit.
* &CORE::getpgrp()Father Chrysostomos2011-08-251-1/+9
| | | | | | | This commit allows &CORE::getpgrp to be called through references and via ampersand syntax. pp_getpgrp is modified to take into account the nulls pushed on to the stack in pp_coreargs, since pp_coreargs has no other way to tell getpgrp how many arguments it’s actually getting.
* &CORE::exit()Father Chrysostomos2011-08-251-0/+5
| | | | | | | This commit allows &CORE::exit to be called through references and via ampersand syntax. pp_exit is modified to take into account the nulls pushed on to the stack in pp_coreargs, since pp_coreargs has no other way to tell exit how many arguments it’s actually getting.
* &CORE::foo() for dbmopen and dbmcloseFather Chrysostomos2011-08-251-0/+32
| | | | | | | | | | This commit allows the subs in the CORE package for close, getc and readline to be called through references and via ampersand syntax. A special case for each of them is added to pp_coreargs to deal with calls with no arguments. Pushing a null on to the stack (which I’m doing for other ops) won’t work, as a null already means something for these cases: close($f) won’t vivify a typeglob if $f is a string, so the implicit rv2gv pushes a null on to the stack.
* &CORE::foo() for close, getc and readlineFather Chrysostomos2011-08-251-1/+76
| | | | | | | This commit allows the subs in the CORE package for close, getc and readline to be called through references and via ampersand syntax. The pp functions are modified to take into account the nulls that coreargs pushes on to the stack to indicate that there is no argument.
* &CORE::foo() for @ and $@ prototypes, except unlinkFather Chrysostomos2011-08-251-0/+82
| | | | | | | | | | | | | | This commit allows the CORE subroutines for functions with @ and $@ prototypes to be called through references and via amper- sand syntax. unlink is not included in this commit, as it requires special casing due to its use of implicit $_. Since these functions require a pushmark, and since it has to come between two things that pp_coreargs does, it’s easiest to flag the coreargs op (with the OPpCOREARGS_PUSHMARK flag added in the previous commit) and call pp_pushmark directly from pp_coreargs.
* &CORE::caller()Father Chrysostomos2011-08-251-0/+19
| | | | | | | | | | | | | | This commit allows &CORE::caller to be called through references and via ampersand syntax. pp_caller is modified to take into account two things: 1) pp_coreargs pushes a null on to the stack, since it has no other way to tell caller whether it has an argument. 2) The value coming from pp_coreargs (when not null) is off by one. The OPpOFFYBONE flag was added in commit 93f0bc4935 for this purpose. pp_coreargs is also modified, since it assumed till now that an optional first argument was an implicit $_.