summaryrefslogtreecommitdiff
path: root/perl.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove explicit support for pre-7.0 VMS and pre-6.0 DEC C.Craig A. Berry2011-12-101-3/+0
| | | | | | | | | | | | | | | | | | | OpenVMS v7.0 was released in 1995. There have been no reports of recent releases of Perl building on versions that far back, yet we still have quite a bit of code that explicitly supports versions *prior* to v7.0. There is a similar story for DEC C v6.0. It was released in 1998, and has been superceded by numerous subsequent versions. Yet the VMS-specific code in the core is littered with workarounds and hacks that defend against deficiencies in very old compiler versions. This code is for all practical purposes no longer maintained or maintainable, so the best path forward seems to be to remove it. Anyone able and willing to commit to long-term support of it could argue for its restoration, assuming Perl 5.14.x is not adequate.
* Simplify S_parse_body() by calling S_usage() and S_minus_v() directly.Nicholas Clark2011-12-041-9/+6
| | | | | | | | | | Previously the code for "--help" and "--version" set a local variable to a string corresponding to the single character option ("h" or "v" respectively), then restarted the option parsing code, which would then call into Perl_moreswitches(), which would then use a switch statement to dispatch to the final code. This is not as clear as it could be.
* Break the -v code out from Perl_moreswitches() into S_minus_v().Nicholas Clark2011-12-041-43/+50
|
* Refactor S_usage() to take 0 parameters and exit directly().Nicholas Clark2011-12-041-6/+4
| | | | | This simplifies the code, as it's only called from one spot, in Perl_moreswitches().
* Remove the VMS-specific private len in S_mayberelocate.Craig A. Berry2011-12-031-2/+1
| | | | | | | | | | | | | This particular C<STRLEN len;> came along almost 15 years ago, way back in aa6893958c2b. Back then it was a plain and simple block scope variable. But now this code lives in a function that takes as an argument a variable of the same name and having the same meaning (i.e., the length of the directory name to be added to @INC). Someone looking only at the argument list might reasonably expect to be able to use len (though luckily there are no subsequent uses of it currently). So we really ought to update that len rather than create our own when we hijack the directory name to make our unixified version of it.
* VMS-specific scope fix for S_mayberelocate.Craig A. Berry2011-12-031-0/+2
| | | | | | | | | | | | | Back in 3185893b8dec106 I moved some code from the beginning of one block to the middle of a different block. Bad me. The compiler has been lax about allowing declarations in the middle of a block, so we haven't noticed. But as of c29067d7797853039, the code moved to a new function while leaving the block it was in behind and we end up with conflicting declarations of len. Making our own block seems like the safest thing to do. The indentation in this section of code is a bit wacky -- I chose the least intrusive alternative for clearer blame logs.
* Small tidyups in S_incpush() and S_mayberelocate()Nicholas Clark2011-12-031-8/+2
| | | | | | | | Following commit 816005240f1a3b99, which moved VMS-specific code, we can now assign to subdir at the point of declaration. After the refactoring that moved code into S_mayberelocate(), we can assign to libdir at the point of declaration. In turn, this allows the merging of two #ifndef PERL_IS_MINIPERL blocks. Remove a blank line from S_mayberelocate().
* Avoid attacks on sitecustomize by using NUL delimiters to wrap filenames.Nicholas Clark2011-12-031-3/+9
| | | | | | | | | | | | Previously the generated code used regular '' strings, which meant that a crafted pathname containing ' characters could be used to inject code. Until the previous commit, this was only a problem if building in or Configuring to install to such a directory. Which, hopefully, would be "obviously wrong" to anyone capable of building Perl from source. However, fixing the bug that prevented sitecustomize being subject to relocatable include now means that for a relocatable pearl, an end-user controlled path can now reach the sitecusomize code.
* Make sitecustomize relocatableinc awareCarl Hayter2011-12-031-39/+62
| | | | | | | | | | When -Dusesitecustomize is used with -Duserelocatableinc, SITELIB_EXP/sitecustomize.pl is not found due to SITELIB_EXP having a '.../..' relocation path. This patch refactors the path relocation code from S_incpush() into S_mayberelocate() so that it can be used in both S_incpush() and in usesitecustomize's use of SITELIB_EXP.
* In Perl_moreswitches(), merge the cases for 't' and 'T'.Nicholas Clark2011-11-221-6/+2
| | | | | Both bodies were the same, aside from hardcoded 't' and 'T', which can be replaced with a variable.
* [perl #101486] Make PL_curstash refcountedFather Chrysostomos2011-10-221-9/+16
| | | | | | | | | | This stops PL_curstash from pointing to a freed-and-reused scalar in cases like ‘package Foo; BEGIN {*Foo:: = *Bar::}’. In such cases, another BEGIN block, or any subroutine definition, would cause a crash. Now it just happily proceeds. newATTRSUB and newXS have been modified not to call mro_method_changed_in in such cases, as it doesn’t make sense.
* Remove unused variable from S_set_caret_XFather Chrysostomos2011-10-021-1/+0
|
* Don't use swash to find cntrlsKarl Williamson2011-10-011-2/+0
| | | | | | | | | Unicode stability policy guarantees that no code points will ever be added to the control characters beyond those already in it. All such characters are in the Latin1 range, and so the Perl core already knows which ones those are, and so there is no need to go out to disk and create a swash for these.
* No need for swashes for computing if ASCIIKarl Williamson2011-10-011-2/+0
| | | | | This information is trivially computed via the macro, no need to go out to disk and store a swash for this.
* Where available, use _NSGetExecutablePath() to make $^X absolute.Nicholas Clark2011-09-271-0/+24
| | | | | | | | | In Configure, check whether _NSGetExecutablePath() can be used to find the absolute pathname of the executable. If so, set usensgetexecutablepath in config.sh and USE_NSGETEXECUTABLEPATH in config.h. If this is set, then use this approach in S_set_caret_X() to canonicalise $^X as an absolute path. This approach works on OS X, and possible on other platforms that use dyld.
* Where available, use sysctl() with KERN_PROC_PATHNAME to make $^X absolute.Nicholas Clark2011-09-271-1/+25
| | | | | | | | | | In Configure, check whether sysctl() and KERN_PROC_PATHNAME can be used to find the absolute pathname of the executable. If so, set usekernprocpathname in config.sh and USE_KERN_PROC_PATHNAME in config.h. If this is set, then use this approach in S_set_caret_X() to canonicalise $^X as an absolute path. This approach works on (at least) FreeBSD, and doesn't rely on the /proc filesystem existing, or /proc/curproc/file being present.
* Don't #include headers already included by perl.hNicholas Clark2011-09-151-8/+0
| | | | | | | | | 097ee67dff1c60f2 didn't need to include <locale.h> in locale.c (then util.c) because it had been included by perl.h since 5.002 beta 1 3f270f98f9305540 missed removing the include of <unistd.h> from perl.c or perlio.c de8ca8af19546d49 changed perl.h to also include <sys/wait.h>, but didn't notice that it code therefore be removed from perl.c, pp_sys.c and util.c
* Simplify S_set_caret_X() by returning early if we set caret_x.Nicholas Clark2011-09-141-9/+7
| | | | This avoids duplicating the fallback code to set caret_x to PL_origargv[0].
* Inline S_procself_val() into S_set_caret_x().Nicholas Clark2011-09-141-36/+25
| | | | | | | | Possibly this should have been done as part of commit 3aa90d208c3bbfc1, which broke S_set_caret_X() out from S_init_postdump_symbols(). [S_procself_val() was not inlined into S_init_postdump_symbols() because Nick Ing-Simmons thought it unwise to hold on to MAXPATHLEN bytes of stack longer than necessary.]
* In S_set_caret_X(), use GvSV() consistently in all conditional code.Nicholas Clark2011-09-131-3/+4
| | | | | | | Commit c69033f2a6291605 was inconsistent, in that it changed two instances of GvSV() to GvSVn(), but not the third. The expansion of GvSV() is simpler, and is appropriate here. Hoist the call to GvSV() out of the conditional code.
* Add HOMEGROWN_POSIX_SIGNALS to PL_non_bincompat_options, and hence -V output.Nicholas Clark2011-09-101-0/+3
| | | | HOMEGROWN_POSIX_SIGNALS is only relevant on VMS.
* Convert some files from Latin-1 to UTF-8Keith Thompson2011-09-071-1/+1
|
* SVTYPEMASK must be cast to (svtype) when comparing to SvTYPE()Chip Salzenberg2011-08-231-1/+1
|
* [perl #97020] Carp (actually caller) leaking memoryFather Chrysostomos2011-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit eff7e72c3 (Detect incomplete caller overrides in Carp) used this little trick for detecting a @DB::args that an overridden caller() failed to set: + @args = \$i; # A sentinal, which no-one else has the address of But there is a bug in caller(). The first time caller tries to write to @DB::args, it calls Perl_init_dbargs first. That function checks whether @DB::args is AvREAL, in case someone has assigned to it, and takes appropriate measures. But caller doesn’t bother calling Perl_init_dbargs more than once. So manually-assigned items in @DB::args would leak, starting with the *second* call to caller. Commit eff7e72c3 triggered that bug, resulting in a regression in Carp, in that it started leaking. eff7e72c3 was backported to 5.12.2 with commit 97705941a4, so in both 5.12 and 5.14 Carp is affected. This bug (the caller bug, not Carp’s triggering thereof) also affects any caller overrides that set @DB::args themselves, if there are alternate calls to the overridden caller and CORE::caller. This commit fixes that by changing the if (!PL_dbargs) condition in pp_caller to if (!PL_dbargs || AvREAL(PL_dbargs)). I.e., if @args is either uninitialised or AvREAL then call Perl_init_dbargs. Perl_init_dbargs also has a bug in it, that this fixes: The array not only needs AvREAL turned off, but also AvREIFY turned on, so that assignments to it that occur after its initialisation turn AvREAL back on again. (In fact, Larry Wall added a comment suggesting this back in perl 5.000.)
* Simplify embedvar.h, removing a level of macro indirection for PL_* variables.Nicholas Clark2011-08-111-10/+10
| | | | | | | For the default (non-multiplicity) configuration, PERLVAR*() macros now directly expand their arguments to tokens such as C<PL_defgv>, instead of expanding to C<PL_Idefgv>. This removes over 350 lines from F<embedvar.h>, which defined macros to map from C<PL_Idefgv> to C<PL_defgv> and so forth.
* Add UNLINK_ALL_VERSIONS to PL_non_bincompat_options, and hence -V output.Nicholas Clark2011-07-241-0/+3
| | | | UNLINK_ALL_VERSIONS only makes sense for VMS.
* perlapi.pod EnhancementsShlomi Fish2011-07-181-3/+9
| | | | | This is a patch to enhance perlapi.pod by providing Perl equivalents and clarifying documentation where appropriate.
* PL_bincompat_options was missing options that affect the interpreter struct.Nicholas Clark2011-07-181-6/+0
| | | | | It had most, but not all, C pre-processor options that change the size of the interpreter struct.
* Factor out a PERL_SET_PHASE macroShawn M Moore2011-07-111-8/+8
| | | | This is the first step in adding a dtrace probe for global phase change
* Store C<study>'s data in in mg_ptr instead of interpreter variables.Nicholas Clark2011-07-011-6/+0
| | | | | This allows more than one C<study> to be active at the same time. It eliminates PL_screamfirst, PL_lastscream, PL_maxscream.
* Merge PL_scream{first,next} into one allocated buffer.Nicholas Clark2011-07-011-2/+0
| | | | | Effectively, PL_screamnext is now PL_screamfirst + 256. The actual interpreter variable PL_screamnext is eliminated.
* Turn $$ into a magical readonly variable that always fetches getpid() ↵Max Maischein2011-05-221-5/+0
| | | | | | | | | | | instead of caching it The intent is that by not caching $$, we eliminate one opportunity for bugs: If one embeds Perl or uses XS and calls fork(3) from C, Perls notion of $$ may go out of sync with what getpid() returns. By always fetching the value of $$ via getpid(), this bug opportunity is eliminated. The overhead of always fetching $$ should be small and is likely only used for tempfile creation, which should be dwarfed by file system accesses.
* Add USE_LOCALE{,_COLLATE,_CTYPE,_NUMERIC} to the output of perl -VNicholas Clark2011-05-201-0/+12
| | | | | | These 4 compile-time options should be reported, as they have affect the behaviour of the interpreter binary (albeit only in a small area). They don't affect binary compatibility.
* #81026: Perl binary no longer relocatableJan Dubois2011-03-171-0/+8
| | | | | | | | | | | | Provide a preprocessor macro PERL_RELOCATABLE_INCPUSH to tell incpush_use_sep() to ignore the passed in len argument. This enables relocatable Perl distributions that patch the various paths at install time. Core Perl neither provides actual relocation scripts/programs, nor endorses this practise as being "supported"; this patch only makes it possible to create such tools. It is therefore undocumented outside the source level comments.
* Add PERL_PRESERVE_IVUV to non_bincompat_options.Nicholas Clark2011-03-121-0/+3
| | | | | | It's actually the default, but as all the C code is conditionally (not) compiled on the basis of that pre-processor macro, seems that it is the one that needs to be reported.
* 59d6f6a4c05afa7f was too aggressive, as it disabled #! line -I on miniperlNicholas Clark2011-03-051-1/+5
| | | | | Restore -I processing on the #! line for miniperl. This gets t/run/switchI.t and t/run/switchd-78586.t passing again under minitest.
* Avoid miniperl SEGVing when processing -I on the #! lineNicholas Clark2011-03-051-5/+10
| | | | | | | | | | | | | | | | | | A side-effect of change 3185893b8dec1062 was to force av in S_incpush() to be NULL, whilst other flag variables were still set as if it were non-NULL, for certain cases, only when compiled with -DPERL_IS_MINIPERL The "obvious" fix is to also set all the flag variables to 0 under -DPERL_IS_MINIPERL, to make everything consistent. However, this confuses (at least) the local version of gcc, which issues warnings about passing a NULL value (av, known always to be NULL) as a not-NULL parameter, despite the fact that all the relevant calls are inside blocks which are actually dead code, due to the if() conditions being const variables set to 0 under -DPERL_IS_MINIPERL. So to avoid future bug reports about compiler warnings, the least worst thing to do seems to be to use #ifndef to use the pre-processor to eliminate the dead code, and related variables.
* In S_incpush, unixify libdir earlier.Craig A. Berry2011-03-041-16/+15
| | | | | | | | | This allows, for example, -I[.lib] to have Unix format appendages added, such as "/buildcustomize.pl", "/sitecustomize.pl", etc. It was previously only being converted to Unix syntax to allow the addition of subdirectories, but the number of things that want to glue pieces onto lib/ have multiplied over the years.
* In S_incpush, omit subdirs when PERL_IS_MINIPERL.Craig A. Berry2011-03-041-0/+4
| | | | | | | | | | The new logic in S_parse_body that loads lib/buildcustomize.pl in miniperl relies on lib being in $INC[0], which it won't be if we've loaded version- and architecture-specific directories before lib. Since miniperl isn't installed and can't do dynamic loading, it doesn't really need those subdirectories, so skip loading them for miniperl.
* For miniperl, use the USE_SITECUSTOMIZE feature to load the build-time @INCNicholas Clark2011-02-151-3/+18
| | | | | | For miniperl (only), always enable USE_SITECUSTOMIZE, but change it to load a buildcustomize.pl file from $INC[0], if present. The default @INC for miniperl is '.', so by default this does nothing.
* Bump the perl -V copyright message, as it's now 2011Jesse Vincent2011-01-201-3/+3
|
* Fix typos (spelling errors) in Perl sources.Peter J. Acklam) (via RT2011-01-071-2/+2
| | | | | | | | | # New Ticket Created by (Peter J. Acklam) # Please include the string: [perl #81904] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 > Signed-off-by: Abigail <abigail@abigail.be>
* Extend -d:foo=bar to make -d:-foo expand to C<no foo>, consistent with -M-fooNicholas Clark2010-11-251-4/+14
|
* Eliminate PL_dirtyFlorian Ragwitz2010-11-141-1/+0
| | | | | It now only exists as a compatibility macro for extensions that want to introspect it.
* Add ${^GLOBAL_PHASE}Florian Ragwitz2010-11-141-7/+24
| | | | This exposes the current top-level interpreter phase to perl space.
* regexec.c: Don't give up on fold matching earlyKarl Williamson2010-11-071-0/+2
| | | | | | | | | | | | | | | | | | | | As noted in the comments of the code, "a" =~ /[A]/i doesn't work currently (except that regcomp.c knows about the ASCII characters and corrects for it, but not always, for example in cases like "a" =~ /\p{Upper}/i. This patch catches all those). It works by computing a list of all characters that (singly) fold to another one, and then checking each of those. The maximum length of the list is 3 in the current Unicode standard. I believe that a better long-term solution is to do this at compile rather than execution time, by generating a closure of everything matched. But this can't be done now because the data structure would need to be extensively revamped to list all non-byte characters, and user-defined \p{} matches are not known at compile-time. And it doesn't handle the multi-char folds. There is a separate ticket for those.
* full API for cop hint hashesZefram2010-10-211-2/+2
| | | | | | | | | | | | | Expose cop hint hashes as a type COPHH, with a cophh_* API which is a macro layer over the refcounted_he_* API. The documentation for cophh_* describes purely API-visible behaviour, whereas the refcounted_he_* documentation describes the functions mainly in terms of the implementation. Revise the cop_hints_* API, using the flags parameter consistently and reimplementing in terms of cophh_*. Use the cophh_* and cop_hints_* functions consistently where appropriate. [Modified by the committer to update two calls to Perl_refcounted_he_fetch recently added to newPMOP.]
* add lex_start to the APIZefram2010-10-211-1/+1
| | | | | lex_start() is added to the API, marked experimental, and documented. It also gains a flags parameter for foreseeable future use.
* replace PL_doextract with better kinds of variableZefram2010-10-211-18/+15
| | | | | | | | PL_doextract had two unrelated jobs, neither best served by an interpreter global variable. The first was to track the -x command-line switch. That is replaced with a local variable in S_parse_body(). The second was to track whether the lexer is in the middle of a =pod section. That is replaced with an element in PL_parser.
* remove filter inheritance option from lex_startZefram2010-10-211-1/+1
| | | | | | | | The only uses of lex_start that had the new_filter parameter false, to make the new lexer context share source filters with the previous lexer context, were uses with rsfp null, which therefore never invoked source filters. Inheriting source filters from a logically unrelated file seems like a silly idea anyway.