summaryrefslogtreecommitdiff
path: root/ext
Commit message (Collapse)AuthorAgeFilesLines
* Test uninit warnings for undef XS cmp retvalsFather Chrysostomos2011-10-152-1/+15
|
* Make XS sort routines work againFather Chrysostomos2011-10-152-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These stopped working when the CvROOT and CvXSUB fields were merged in 5.10.0: $ perl5.8.9 -le 'print sort utf8::is_utf8 2,1' Usage: utf8::is_utf8(sv) at -e line 1. $ perl5.10.0 -le 'print sort utf8::is_utf8 2,1' 12 (In the latter case, the utf8::is_utf8 routine is not being called.) pp_sort has this: if (!(cv && CvROOT(cv))) { if (cv && CvISXSUB(cv)) { But CvROOT is the same as CvXSUB, so that block is never entered for XSUBs, so this piece of code later on: if (is_xsub) PL_sortcop = (OP*)cv; else PL_sortcop = CvSTART(cv); sets PL_sortcop to CvSTART for XSUBs, but CvSTART is NULL. Later on, this if condition fails: if (PL_sortcop) { so the XSUB is treated as being absent.
* APItest: put mro stuff in a new BOOT blockFather Chrysostomos2011-10-151-6/+8
| | | | | | I added it to an existing block without realising that it was for a separate package and that the standard convention throughout APItest.xs is to use a separate BOOT block for every tested feature.
* APItest: Move PERL_UNUSED_ARG after declFather Chrysostomos2011-10-121-1/+1
|
* [perl #6828] Set $AUTOLOAD once more for XS autoloadingFather Chrysostomos2011-10-112-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 5.6.0, XS autoloading worked. $AUTOLOAD would be set, as with a Perl sub. Commit ed850460 (5.6.1) allowed ‘sub AUTOLOAD;’ to prevent autoload inheritance. But the code to check for that mistakenly equated an XSUB with a forward declaration. So XS autoloading simply did not work any more. Then someone found it didn’t work and introduced it as a ‘new’ feature in 5.8.0, with commit adb5a9ae. For efficiency’s sake, instead of joining the package name and sub name together, only to have the XSUB do the same, it set the CvSTASH and SvPVX fields of the SV. SvPVX was already being used for the sub’s prototype, so 8fa6a409 (just recently) made the autoloaded sub name and the prototype play along nicely together, with a few fix-up commits (05b525f4, 3d5f9785 and 74ee33f2). It was only after that that I find out that $AUTOLOAD used to be set for XSUBs. See the discussion at these two links http://www.nntp.perl.org/group/perl.perl5.porters/;msgid=4E9468E8.8050206@cpan.org https://rt.perl.org/rt3/Ticket/Display.html?id=72708 This commit restores the original behaviour of setting $AUTOLOAD for XSUBs, while retaining the CvSTASH+SvPVX method as well, as it has been documented for a while. Steffen Müller’s AUTOLOAD tests that I committed recently (120b7a08) needed to be adjusted a bit. The test count was off, which was my fault (I *thought* I had checked that.) The test XSUB was using get_sv("AUTOLOAD"), which ended up fetching the caller’s $AUTOLOAD. It was also using SvPV_set on an undefined scalar, which does not turn the SvPOK flag on.
* TODO test for $AUTOLOAD with XS AUTOLOADSteffen Mueller2011-10-113-3/+101
| | | | | | | | | | If an AUTOLOAD sub is an XSUB, $AUTOLOAD won't be set. This is intended as an optimization, but $AUTOLOAD *was* set back in 5.6.0, so this is a regression. Committer’s note: I modified the commit message and the comments, as the original author did not know about the autoload mechanism setting CvSTASH. For that matter, neither did I till yesterday.
* Make sv_set[ps]v(cv...) set prototypeFather Chrysostomos2011-10-112-1/+24
| | | | | | | | | | | | | | | | | | | | The SvPVX slot of a CV is used both for the prototype and for the sub name passed to an XS AUTOLOAD sub. It used to be that such AUTOLOADing would clobber the prototype. Commit 8fa6a4095 made the two uses of SvPVX try to play along nicely with each other, so the prototype comes after the sub name if both need to be present. It added the CvPROTO macro to account for that. Some CPAN modules expect to be able to set the prototype with sv_set[ps]v. So this commit makes that work as expected, by turn- ing off the flag that says the prototype comes after the auto- loaded sub name. Anyone using Scalar::Util::set_prototype to work around the proto- type-clobbering bug can now continue to do so, without triggering a new bug.
* XS::APItest: s/justinc/justisa/Father Chrysostomos2011-10-102-2/+2
| | | | | | I meant to call this mro ‘just @ISA’, because it just uses @ISA and no super-superclasses. But I misnamed it. It has nothing to do with @INC.
* Also add repaired variants for CV and SVREF typemapsSteffen Mueller2011-10-114-3/+65
|
* A repaired, properly refcounting AV&HV typemapSteffen Mueller2011-10-114-2/+76
| | | | | | The T_AVREF_REFCOUNT_FIXED and T_HVREF_REFCOUNT_FIXED can be used in place of T_AVREF/T_HVREF. They do away with having to remember to decrement refcounts manually.
* [perl #94306] Do not skip first elem of linear isaFather Chrysostomos2011-10-102-0/+34
| | | | | | | | | | Perl has assumed up till now that the first element of an isa linear- isation is the name of the class itself. That is true for dfs and c3, but not requiring that makes it easier for plugin authors. Since various parts of the mro code make that assumption, this commit copies the AV returned by mro_alg.resolve to a new one beginning with the class’s own name, if the original AV did not include it.
* Fix cv-to-gv assignment to use CvPROTOFather Chrysostomos2011-10-101-1/+5
| | | | | | | | | | The SvPVX field of a XS AUTOLOAD sub can contain both the prototype and the name of an AUTOLOADed sub. The CvPROTO macro knows where in the buffer to find the prototype. All code that reads the prototype should use it. When I introduced it with commit 8fa6a4095, one code path was missed: *regular_prototyped_sub = \&prototyped_XS_AUTOLOAD was using the sub name of the rhs, instead of the prototype, in the prototype check.
* Resolve XS AUTOLOAD-prototype conflictFather Chrysostomos2011-10-092-1/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Did you know that a subroutine’s prototype can be modified with s///? Don’t look: *AUTOLOAD = *Internals'SvREFCNT; my $f = "Just another "; eval{main->$f}; print prototype AUTOLOAD; $f =~ s/Just another /Perl hacker,\n/; print prototype AUTOLOAD; You did look, didn’t you? You must admit that’s creepy. The problem goes back to this: commit adb5a9ae91a0bed93d396bb0abda99831f9e2e6f Author: Doug MacEachern <dougm@covalent.net> Date: Sat Jan 6 01:30:05 2001 -0800 [patch] xsub AUTOLOAD fix/optimization Message-ID: <Pine.LNX.4.10.10101060924280.24460-100000@mojo.covalent.net> Allow AUTOLOAD to be an xsub and allow such xsubs to avoid use of $AUTOLOAD. p4raw-id: //depot/perl@8362 which includes this: + if (CvXSUB(cv)) { + /* rather than lookup/init $AUTOLOAD here + * only to have the XSUB do another lookup for $AUTOLOAD + * and split that value on the last '::', + * pass along the same data via some unused fields in the CV + */ + CvSTASH(cv) = stash; + SvPVX(cv) = (char *)name; /* cast to loose constness warning */ + SvCUR(cv) = len; + return gv; + } That ‘unused’ field is not unused. It’s where the prototype is stored. So, not only is it clobbering the prototype, it’s also leak- ing it by assigning over the top of SvPVX. Furthermore, it’s blindly assigning someone else’s string, which could be freed before it’s even used. Since it has been documented for a long time that SvPVX contains the name of the AUTOLOADed sub, and since the use of SvPVX for prototypes is documented nowhere, we have to preserve the former. So this commit makes the prototype and the sub name share the same buffer, in a manner resembling that which CvFILE used before I changed it with bad4ae38. There are two new internal macros, CvPROTO and CvPROTOLEN for retriev- ing the prototype.
* Tests for XS AUTOLOAD routinesFather Chrysostomos2011-10-093-0/+26
|
* Cast to signed before negating, to avoid compiler warningsBrian Fraser2011-10-061-1/+1
|
* Increase $DynaLoader'VERSION from 1.13 to 1.14,Father Chrysostomos2011-10-061-1/+1
| | | | in view of 2e3468793982.
* Increase $mro::VERSION from 1.08 to 1.09Father Chrysostomos2011-10-061-1/+1
|
* Increase $attributes::VERSION from 0.16 to 0.17Father Chrysostomos2011-10-061-1/+1
|
* Increase $XS::APItest::VERSION from 0.31 to 0.32Father Chrysostomos2011-10-061-1/+1
|
* whichsig nul-cleanup.Brian Fraser2011-10-062-0/+51
| | | | | This adds _pv, _pvn, and _pv versions of whichsig() in mg.c, which get both kill "NAME" and %SIG lookup nul-clean.
* toke.c, ext/attributes/attributes.xs: Make attributes UTF-8 clean.Brian Fraser2011-10-061-2/+2
|
* mro.(c|xs): Make warnings utf8-cleanBrian Fraser2011-10-061-8/+17
|
* mro.c: Correct utf8 and bytes concatenationFather Chrysostomos2011-10-062-0/+44
| | | | | | | | | | | | | | | | | | | The previous commit introduced some code that concatenates a pv on to an sv and then does SvUTF8_on on the sv if the pv was utf8. That can’t work if the sv was in Latin-1 (or single-byte) encoding and contained extra-ASCII characters. Nor can it work if bytes are appended to a utf8 sv. Both produce mangled utf8. There is apparently no function apart from sv_catsv that handle this. So I’ve modified sv_catpvn_flags to handle this if passed the SV_CATUTF8 (concatenating a utf8 pv) or SV_CATBYTES (cancatenating a byte pv) flag. This avoids the overhead of creating a new sv (in fact, sv_catsv even copies its rhs in some cases, so that would mean creating two new svs). It might even be worthwhile to redefine sv_catsv in terms of this....
* mro UTF8 cleanup.Brian Fraser2011-10-061-3/+8
| | | | | | | | | | | This patch also duplicates existing mro tests with copies that use Unicode in identifiers, to test the mro code. Since those tests trigger it, it also fixes a bug in the parsing of *{...}: If the first character inside the braces is a non-ASCII Unicode identifier character, the inside is now implicitly quoted if it is just an identifier (just as it is with ASCII identifiers), instead of being parsed as a bareword that would violate strict subs.
* gv.c: gv_fetchmethod_(flags|autoload) UTF8 cleanup.Brian Fraser2011-10-061-6/+5
|
* gv.c: gv_fetchmeth_pvn_autoload UTF8 cleanup.Brian Fraser2011-10-061-1/+34
| | | | As with the previous commit, no Perl-level visible changes.
* gv.c: gv_fetchmeth_pvn UTF8 cleanup.Brian Fraser2011-10-061-2/+31
| | | | | | | Since gv_fetchmeth_pvn is primarily used from within gv.c, and not much of anything is passing in the flag yet, this has no visible changes on the Perl level; So tests remain entirely in XS::APItest for the time being.
* gv.c: gv_autoload4 is now UTF-8 clean.Brian Fraser2011-10-061-3/+1
| | | | This also uncomments the UTF-8 tests in XS::APItest.
* op.c: newCONSTSUB and newXS UTF8 cleanup.Brian Fraser2011-10-062-0/+45
| | | | | | | | newXS was merged into newXS_flags; added a line in the docs recommeding using that instead. newCONSTSUB got a _flags version, which generates the CV in the right glob if passed the UTF-8 flag.
* Merge multi and flags params to gv_init_*Father Chrysostomos2011-10-061-3/+4
| | | | | Since multi is a boolean (even though it’s typed as an int), there is no need to have a separate parameter. We can just use a flag bit.
* gv.c: Initial gv_fetchpvn_flags and gv_stashpvn UTF8 cleanupBrian Fraser2011-10-061-2/+2
| | | | | | | | | Now that a glob can be initialized and fetched in UTF-8, the next commit will introduce some changes in toke.c to actually test this. Committer’s note: To keep tests passing I had to incorporate the toke.c:S_pending_ident changes in the same patch.
* gv.c: gv_name_set and gv_init_(etc) now initialize the GV's name as UTF-8 if ↵Brian Fraser2011-10-061-3/+9
| | | | | | | | | | | | | | | passed the UTF8 flag. newCONSTSUB is still unclean however, so constant subs are still generated under a wrong name. gv_fullname4 is also UTF-8 aware now; While that should've gotten it's own commit and tests, it's not possible to test the UTF-8 part without the gv_init changes, and it's not possible to test the gv_init changes without gv_fullname4. Chicken and egg, as it were. So let's compromise and wait for the relevant tests once globs can be intiialized as UTF-8 from the Perl level without XS magic.
* Remove method param from gv_autoload_*Father Chrysostomos2011-10-062-13/+13
| | | | | | | | method is a boolean flag (typed I32, but used as a boolean) added by commit 54310121b442. These new gv_autoload_* functions have a flags parameter, so there’s no reason for this extra effective bool. We can just use a flag bit.
* Remove 4 from new gv_autoload4_(sv|pvn?) functionsFather Chrysostomos2011-10-062-16/+16
| | | | | | | | | | | | The 4 was added in commit 54310121b442 (inseparable changes during 5.003/4 developement), presumably the ‘Don't look up &AUTOLOAD in @ISA when calling plain function’ part. Before that, gv_autoload had three arguments, so the 4 indicated the new version (with the method argument). Since these new functions don’t all have four arguments, and since they have a new naming convention, there is not reason for the 4.
* gv.c: Added gv_autoload4_(sv|pv|pvn)Brian Fraser2011-10-062-0/+91
|
* gv.c: Added gv_fetchmethod_(sv|pv|pvn)_flags.Brian Fraser2011-10-062-0/+81
| | | | | | In addition from taking a flags parameter, it also takes the length of the method; This will eventually make method lookup nul-clean.
* Minor correction to gv_fetchmeth_autoload.tFather Chrysostomos2011-10-061-1/+3
| | | | It was not doing the sanity check for all three functions.
* gv.c: Added gv_fetchmeth_(sv|pv|pvn)_autoload.Brian Fraser2011-10-062-0/+75
|
* Minor correction to gv_fetchmeth.tFather Chrysostomos2011-10-061-1/+3
| | | | | It wasn’t doing the XS::APItest::gv_fetchmeth_type sanity check for all three gv_fetchmeth* functions.
* gv.c: Added gv_fetchmeth_(sv|pv|pvn).Brian Fraser2011-10-062-0/+64
| | | | | I'm probably pushing this too early. Can't do the Perl-level tests because of that. TODO.
* gv.c: Added gv_init_(sv|pv|pvn), renamed gv_init_sv as gv_init_svtype.Brian Fraser2011-10-062-0/+44
| | | | | | | | | gv_init_pvn() is the same as the old gv_init(), but takes a flags parameter, which will be used for the UTF-8 cleanup. The old gv_init() is now implemeneted as a macro in gv.h. Also included is some minimal testing in XS::APItest.
* Export DynaLoader symbols from libperl againReini Urban2011-09-301-0/+1
| | | | | | With 5.15.2 and the new xubpp, DynaLoader symbols were XS_INTERNAL, before they were effectively XS_EXTERNAL. This broke B::C and possibly other embedded apps which link to DynaLoader functions.
* Correct punctuation in some POSIX error messagesFather Chrysostomos2011-09-172-39/+39
| | | | | | | | | | | Commit fa22ee54 changed some of the POSIX error messages to be more consistent, but in doing so made many of them grammatically incorrect. It is almost always incorrect in English to join two independent clauses with a comma. I don’t think it’s particularly important that error messages be gram- matical; I just don’t want them getting worse over time. Hence, I have not touched those that were already ungrammatical.
* POSIX::access() doesn't do ENOTDIR on VMS.Craig A. Berry2011-09-171-1/+1
| | | | Even though the underlying error is RMS$_DNF. Go figure.
* Tests for goto &xsub and lexical hintsFather Chrysostomos2011-09-162-0/+25
| | | | | This new script tests that goto &xsub causes the sub to see the hints, not of the subroutine it replaces, but of that subroutine’s caller.
* update B::Concise test for B::Deparse changeZefram2011-09-161-0/+1
|
* Assorted File::Glob test fix-ups following 528bd3ce85.Craig A. Berry2011-09-161-24/+32
| | | | | | | | | | - Avoid list assignment to %ENV, which fails at compile time on VMS. - Use consistent indentation for readability. - Mark bsd_glob('~') tests TODO on VMS. The HOME path is successfully retrieved, but it normally contains square brackets, which confuse glob, because it thinks the directory portion of the path contained within brackets is a pattern. The path probably needs to be converted to Unix syntax first.
* Change POSIX::Termios::setattr() to default to TCASNOW, not 0.Nicholas Clark2011-09-131-1/+8
| | | | | | | | 0 isn't valid on all operating systems. TCASNOW has the value 0 on most operating systems, but on Solaris (at least) TCASNOW, TCSADRAIN and TCSAFLUSH have the same values as the equivalent ioctls, TCSETS, TCSETSW and TCSETSF. Solaris faults 0, setting errno to EINVAL. This isn't useful as a default behaviour.
* Remove unneeded fallback definitions of dNOOP, dVAR etc from POSIX.xsNicholas Clark2011-09-131-20/+0
| | | | | | As POSIX.xs is not dual life, we can always rely on these macros being defined for us in perl.h. (And these days, dual life XS code should let Devel::PPPort take care of this sort of thing.)
* Merge the implementations of POSIX::{asctime,mktime} using ALIAS.Nicholas Clark2011-09-131-34/+18
| | | | | | This shares identical code marshaling 6 to 9 input arguments into a struct tm. However, as the return types differ we have to explicitly code pushing the return value onto perl's stack.