summaryrefslogtreecommitdiff
path: root/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm
Commit message (Collapse)AuthorAgeFilesLines
* perl.c - move PL_restartop assert out of perl_run()Yves Orton2022-11-301-2/+23
| | | | | | | | | | | | | | | | | | | | | | | In dd66b1d793 we added an assert to perl_run() that PL_restartop should never be true when perl_run() is called after perl_parse(). Looked at from the point of the internals, which calls perl_parse() and perl_run() exactly once, this made sense. It turns out however that there is at least one XS module out there that expects to be able to set PL_restartop and then call perl_run(). If that works out for them then we shouldn't block it, as we aren't really trying to say "perl_run() should never be called with PL_restartop set" (at least this assert wasn't trying to say that really), we are trying to assert "between the top level transition from perl_parse() to perl_run() we shouldnt leak any PL_restartop". One could argue the assert maybe should go at the end of perl_parse(), but I chose to put it in Miniperl.pm and thus into perlmain.c and miniperlmain.c as I am not certain that perl_parse() should never be called with PL_restartop set already, and putting it in the main code really does more closely reflect the intent of this assert anyway. This was reported as Blead Breaks CPAN Github Issue #20557.
* make PERL_USE_SAFE_PUTENV the default and the only optionTomasz Konojacki2022-05-291-17/+1
| | | | | | | Now environ isn't owned by Perl and calling setenv/putenv in XS code will no longer result in memory corruption. Fixes #19399
* Remove inheritance from Exporter in ext/ modulesMax Maischein2021-06-251-3/+2
| | | | | | | | | | | | | | | | | Inheriting from Exporter adds several subroutines that are not really needed by these modules. The remaining uses of inheritance from Exporter are: re.pm - this uses export_to_level(), which really, really wants the inheritance # Conflicts: # ext/File-Find/lib/File/Find.pm # ext/File-Glob/Glob.pm # ext/GDBM_File/GDBM_File.pm # ext/Opcode/Opcode.pm # ext/Pod-Html/lib/Pod/Html.pm
* Remove PERL_GLOBAL_STRUCTDagfinn Ilmari Mannsåker2020-07-201-32/+1
| | | | | | | | This was originally added for MinGW, which no longer needs it, and only still used by Symbian, which is now removed. This also leaves perlapi.[ch] empty, but we keep the header for CPAN backwards compatibility.
* get MakeMaker to play under PERL_GLOBAL_STRUCTDavid Mitchell2019-02-191-2/+7
| | | | | | | | | | | | | Under PERL_GLOBAL_STRUCT (well, actually I've only tried under PERL_GLOBAL_STRUCT_PRIVATE), cpan/ExtUtils-MakeMaker/t/03-xsstatic.t was failing some tests. This was because it was creating a statically-linked perl binary, but wasn't compiling perlmain.c with -DPERL_CORE. Usually this doesn't matter, but under PERL_GLOBAL_STRUCT it needed a definition of aTHX which it was pulling from XSUB.h rather than perl.h, causing a SEGV. Until a proper fix makes it way into MakeMaker, explicitly define PERL_CORE in perlmain.c
* fix up faulty perl embeddingsZefram2017-12-211-3/+2
| | | | | | | | | | | | Some platform-specific embeddings of perl were misusing the return values from perl_parse() and perl_run(), in some cases causing failure due to exit(0) combined with the recent changes in commit 0301e899536a22752f40481d8a1d141b7a7dda82. Commit d4a50999a5525c2681d59cae5fcd94f94ff897fd partially fixed a Windows embedding. More fully fix that, along with NetWare and OS/2. Even in embeddings with correct logic, stop using a variable named "exitstatus" to hold the result of perl_parse() or perl_run(), to avoid misleading people who copy the code.
* Replace multiple 'use vars' by 'our' in extNicolas R2017-11-111-5/+3
| | | | | | | | Using vars pragma is discouraged and has been superseded by 'our' declarations available in Perl v5.6.0 or later. This commit is about replacing the usage of 'vars' pragma by 'our' in 'ext' directory.
* better document Miniperl.pm, (mini)perlmain.cDavid Mitchell2016-06-171-10/+20
| | | | | | | | ExtUtils::Miniperl is used to generate both miniperlmain.c and perlmain.c, but in different ways (via regen and via make respectively). Update the pod in Miniperl.pm to explain this more clearly, and imporve the header comment it emits in miniperlmain.c and perlmain.c.
* Replace common Emacs file-local variables with dir-localsDagfinn Ilmari Mannsåker2015-03-221-7/+1
| | | | | | | | | | | | | | | | An empty cpan/.dir-locals.el stops Emacs using the core defaults for code imported from CPAN. Committer's work: To keep t/porting/cmp_version.t and t/porting/utils.t happy, $VERSION needed to be incremented in many files, including throughout dist/PathTools. perldelta entry for module updates. Add two Emacs control files to MANIFEST; re-sort MANIFEST. For: RT #124119.
* ExtUtils::Miniperl - Restore a missing line of PODSteve Hay2015-01-291-0/+1
| | | | This seems to have been accidentally deleted by commit a06cd52b4e.
* Corrections to spelling and grammatical errors.Lajos Veres2015-01-281-2/+2
| | | | Extracted from patch submitted by Lajos Veres in RT #123693.
* Tru64: introduce PERL_SYS_FPU_INIT, use it.Jarkko Hietaniemi2014-09-261-1/+3
| | | | | | | In Tru64 the cc -ieee enables the IEEE math but disables traps. We need to reenable the "invalid" trap because otherwise generation of NaN values leaves the IEEE fp flags in bad state, leaving any further fp ops behaving strangely (Inf + 1 resulting in zero, for example).
* Some low-hanging -Wunreachable-code fruits.Jarkko Hietaniemi2014-06-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | - after return/croak/die/exit, return/break are pointless (break is not a terminator/separator, it's a goto) - after goto, another goto (!) is pointless - in some cases (usually function ends) introduce explicit NOT_REACHED to make the noreturn nature clearer (do not do this everywhere, though, since that would mean adding NOT_REACHED after every croak) - for the added NOT_REACHED also add /* NOTREACHED */ since NOT_REACHED is for gcc (and VC), while the comment is for linters - declaring variables in switch blocks is just too fragile: it kind of works for narrowing the scope (which is nice), but breaks the moment there are initializations for the variables (the initializations will be skipped since the flow will bypass the start of the block); in some easy cases simply hoist the declarations out of the block and move them earlier Note 1: Since after this patch the core is not yet -Wunreachable-code clean, not enabling that via cflags.SH, one needs to -Accflags=... it. Note 2: At least with the older gcc 4.4.7 there are far too many "unreachable code" warnings, which seem to go away with gcc 4.8, maybe better flow control analysis. Therefore, the warning should eventually be enabled only for modernish gccs (what about clang and Intel cc?)
* Revert "Some low-hanging -Wunreachable-code fruits."Jarkko Hietaniemi2014-06-131-0/+1
| | | | | | | This reverts commit 8c2b19724d117cecfa186d044abdbf766372c679. I don't understand - smoke-me came back happy with three separate reports... oh well, some other time.
* Some low-hanging -Wunreachable-code fruits.Jarkko Hietaniemi2014-06-131-1/+0
| | | | | | | | | | | | | | | | | | - after croak/die/exit (or return), break (or return!) are pointless (break is not a terminator/separator, it's a promise of a jump) - after goto, another goto (!) is pointless - in some cases (usually function ends) introduce explicit NOT_REACHED to make the noreturn nature clearer (do not do this everywhere, though, since that would mean adding NOT_REACHED after every croak) - for the added NOT_REACHED also add /* NOTREACHED */ since NOT_REACHED is for gcc (and VC), while the comment is for linters - declaring variables in switch blocks is just too fragile: it kind of works for narrowing the scope (which is nice), but breaks the moment there are initializations for the variables (they will be skipped!); in some easy cases simply hoist the declarations out of the block and move them earlier There are still a few places left.
* my_plvarsp nulling and PERL_GLOBAL_STRUCT_PRIVATEDavid Mitchell2014-04-241-2/+8
| | | | | | | | | | | | | | | | | | | With PERL_GLOBAL_STRUCT_PRIVATE, all "global" vars are in a malloc()d structure pointed to by the static var my_plvarsp. At exit, this struct is freed and my_plvarsp is set to NULL. My previous commit c1181d2b skipped the free if PL_veto_cleanup is set (as it would be if other threads are still running for example), but still left my_plvarsp getting set to NULL. Thus other threads could still deref a null pointer if they accessed a "global" var just as the main thread was exiting. This commit makes the veto skip the NULLing in addition to the freeing. This commit is quite late into the code freeze, but it's a follow-up to the earlier attempt to get smokes not to fail, and all the affected code is within #ifdef PERL_GLOBAL_STRUCT_PRIVATE, so it shouldn't affect mainstream builds at all. (Famous last words.)
* For -DPERL_GLOBAL_STRUCT, eliminate local variable plvarsp in main().Nicholas Clark2013-07-121-4/+3
|
* Fix SEGVs and test failures for -DPERL_GLOBAL_STRUCT_PRIVATENicholas Clark2013-07-121-0/+6
| | | | | | | | | | | | | With PERL_GLOBAL_STRUCT_PRIVATE "global" variables are in a structure in malloc()ed memory, not in global static variables or a global static structure. Hence no global variables are implicitly initialised to zero. * PL_curinterp and PL_op_sequence need initialising to NULL * The global structure is free()d before handlers registered with atexit() run, so be defensive about this. * Some C code checks SvOK(PL_sv_placeholder) so ensure that its SvFLAGS() are 0. * Zero PL_hash_seed
* Specify the versions of ExtUtils::MiniPerl and ExtUtils::Embed needed.Nicholas Clark2013-07-121-1/+1
| | | | | Without this, regen/miniperlmain.pl could end up finding versions which are out of date, and silently generate an incorrect miniperlmain.c
* ExtUtils::Miniperl::writemain()'s first argument can also be a filename.Nicholas Clark2013-07-091-5/+27
| | | | | | Treat a reference to a scalar as the name of a file to open for output. Any other reference is used as an output filehandle. Otherwise the default remains to write to STDOUT.
* Refactor ExtUtils::Miniperl to use ExtUtils::Embed.Nicholas Clark2013-07-091-61/+4
| | | | | | | | There is now only one copy of Perl code to generate the C for an xsinit() function. This also eliminates ExtUtils::Miniperl::canon(), which was not exported, and is no longer needed.
* ExtUtils::Miniperl: Remove pod repeated phraseKarl Williamson2013-07-071-1/+1
|
* Move the "editor block" from miniperlmain.c to ExtUtils::MiniperlNicholas Clark2013-07-071-10/+8
| | | | | | | As miniperlmain.c is now generated by ExtUtils::Miniperl (and not the other way round), there's no reason to have an editor block in the generated file, as it's not intended to be edited. Instead, add the "generated from" and read-only headers to miniperlmain.c
* Clean up ExtUtils::MiniperlNicholas Clark2013-07-071-67/+64
| | | | | | | | | Give it a $VERSION. Bring the joy of strict (and warnings) to it. Inline the C code into writemain() instead of using $head, $tail and a regex to split the $tail into $tail1, $tail2 and $tail3. Tweak the NAME section so that ABSTRACT_FROM parses it. Document the updated functionality of writemain().
* Invert the build logic for miniperlmain.c and ExtUtils::MiniperlNicholas Clark2013-07-071-0/+285
Now ExtUtils::Miniperl has the master version of {mini,}perlmain.c and is checked into the repository. miniperlmain.c is now generated by a script in regen/ which uses ExtUtils::Miniperl. Tweak ExtUtils::Miniperl::writemain() to take an optional first argument, a reference to a file handle. This permits the regen script to use the regen_lib.pl functions for file opening/closing/renaming and TAP generation. For now check in ExtUtils::Miniperl minimally modified from the version generated by the former minimod.pl. The next commit will tidy it up.