| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
The PL_block_type debugging-only array is now used indeirectly in
ext/re/re-exec.c, which enables debugging even on non-debugging builds
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit is a first step to making the handling of (/(?{...})/ more sane.
But see the big proviso at the end.
Currently a patten like /a(?{...})b/ is uninterpreted by the lexer and
parser, and is instead passed as-is to the regex compiler, which is
responsible for ensuring that the embedded perl code is extracted and
compiled. The only thing the quoted string code in the lexer currently
does is to skip nested matched {}'s, in order to get to end of the code
block and restart looking for interpolated variables, \Q etc.
This commit makes the lexer smarter.
Consider the following pattern:
/FOO(?{BLOCK})BAR$var/
This is currently tokenised as
op_match
(
op_const["FOO(?{BLOCK})BAR"]
,
$
"var"
)
Instead, tokenise it as:
op_match
(
op_const["FOO"]
,
DO
{
BLOCK
;
}
,
op_const["(?{BLOCK})"]
,
op_const["BAR"]
,
$
"var"
)
This means that BLOCK is itself tokenised and parsed. We also insert
a const into the stream to include the original source text of BLOCK so
that it's available for stringifying qr's etc.
Note that by allowing the lexer/parser direct access to BLOCK, we can now
handle things like
/(?{"{"})/
This mechanism is similar to the way something like
"abc $a[foo(q(]))] def"
is currently parsed: the double-quoted string handler in the lexer stops
at $a[, the 'foo(q(]))' is treated as perl code, then at the end control is
passed back to the string handler to handle the ' def'.
This commit includes a new error message:
Sequence (?{...}) not terminated with ')'
since when control is passed back to the quoted-string handler, it expects
to find the ')' as the next char. This new error mostly replaces the old
Sequence (?{...}) not terminated or not {}-balanced in regex
Big proviso:
This commit updates toke.c to recognise the embedded code, but doesn't
then do anything with it. The parser will pass both a compiled do block
and a const for each embedded (?{..}), and Perl_pmruntime just throws
away the do block and keeps the constant text instead which is passed to
the regex compiler. So currently each code block gets compiled twice (!)
with two sets of warnings etc. The next stage will be to pass these do
blocks to the regex compiler.
This commit is based on a patch I had originally worked up about 6 years
ago and has been sitting bit-rotting ever since.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem with Perl___notused under C++ is that in some cases
it's merely extern, and in some cases (via the XS macro via the
XSPROTO macro) it's extern "C". Object code analysis shows that
you do actually get one mangled and one unmangled version of the
symbol, which wouldn't matter since the whole point is to have
something we never use.
Except that one very picky C++ compiler (HP C++ for OpenVMS) sees
what we're up to and slaps us down hard. Since declaration after
statement has always been allowed in C++, just go ahead and do a
real noop statement for C++ and avoid the use of an external
symbol.
|
|
|
|
|
| |
This updates the editor hints in our files for Emacs and vim to request
that tabs be inserted as spaces.
|
|
|
|
|
|
|
| |
The funny extra arguments to strerror are only there on VMS
when compiling with C, not C++.
On VMS, DONT_DECLARE_STD is synonymous with defined(__cplusplus).
|
|
|
|
|
|
|
|
|
| |
The core is not using it any more. Every CPAN module that increments
it also does newXS, which triggers mro_method_changed_in, which is
sufficient; so nothing will break.
So, to keep those modules compiling, PL_amagic_generation is now an
alias to PL_na outside the core.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This comment in perl.c:
/* Note: 20,40,80 used for NATIVE_HINTS */
(added by a0ed51b3 [Here are the long-expected Unicode/UTF-8 mod-
ifications.]), has apparently always been wrong. The values in
vms/vmsish.h end with 7 zeroes in hex, and are only shifted down to
one zero when assigned to cop->op_private in op.c:newSTATEOP. In
PL_hints they never have the values indicated in perl.h. So those
are actually free bits. It’s the high versions in vmsish.h that
are not free.
20 (actually 0x20000000) hasn’t been used for anything since commit
744a34f9085 (Urk -- undo previous removal of vmsish 'exit' change),
which change I don’t really understand. In any case, the comment was
never updated.
This comment in op.h:
/* NOTE: OP_NEXTSTATE and OP_DBSTATE (i.e. COPs) carry lower
* bits of PL_hints in op_private */
was added by d41ff1b8ad98 (introduce $^U), which was later reverted.
op_private does not carry the lower bits of PL_hints, but, rather,
certain higher bits of PL_hints, shifted to fit (the NATIVE_HINTS
cited above).
Due to misleading comments, I ended up breaking the VMS build in com-
mit d1718a7cf5, by using its bits for something else.
This commit moves the bits around a bit to avoid the clash, and modi-
fies the comments to reflect reality.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With commit b50b20584, strict.pm starting putting hints in %^H to
indicate that strict mode has been enabled or disabled explicitly, so
version declarations should not change the setting.
This causes ‘Unbalanced string table refcount’ warnings when Safe.pm
encounters prohibited ops.
This happens because ops are leaking when those ops point to HEKs (in
the internal form that %^H takes when attached to ops).
This commit moves those new strict hints into $^H, to avoid those
warnings. This does simply paper over the real problem (leaked ops),
but at least it gets the warnings back down to the 5.14 amount.
Because of the new hints in $^H, B::Concise has been updated to
account for them, and so have all its tests. I modified OptreeCheck
to avoid setting the hints with ‘no strict;’, as that resulted in
slightly fewer changes to the tests. It will also result in fewer
changes to the tests in future.
Two B::Deparse tests started failing due to %^H not being localised.
Apparently there is a bug somewhere (in perl, Deparse.pm or deparse.t)
that got triggered as a result. In fact, one of the tests exhibited
*two* bugs. But for now, I’ve simply added a workaround to the two
tests so they don’t trigger those bugs (which bugs will have to wait
till after 5.16).
|
|
|
|
|
|
| |
_POSIX_PATH_MAX is required to be defined for POSIX systems as
256, which is too small for a fallback PATH_MAX (some systems, such as
GNU/Hurd, do not have an inherent limit on path length).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Under POSIX threads the getpid() and getppid() functions return the
same values across multiple threads, i.e. threads don't have their own
PID's. This is not the case under the obsolete LinuxThreads where each
thread has a different PID, so getpid() and getppid() will return
different values across threads.
Ever since the first perl 5.0 we've returned POSIX-consistent
semantics for $$, until v5.14.0-251-g0e21945 when the getpid() cache
was removed. In 5.8.1 Rafael added further explicit POSIX emulation in
perl-5.8.0-133-g4d76a34 [1] by explicitly caching getppid(), so that
multiple threads would always return the same value.
I don't think all this effort to emulate POSIX sematics is worth it. I
think $$ and getppid() are OS-level functions that should always
return the same as their C equivalents. I shouldn't have to use a
module like Linux::Pid to get the OS version of the return values.
This is pretty much a complete non-issue in practice these days,
LinuxThreads was a Linux 2.4 thread implementation that nobody
maintains anymore[2], all modern Linux distros use NPTL threads which
don't suffer from this discrepancy. Debian GNU/kFreeBSD does use
LinuxThreads in the 6.0 release, but they too will be moving away from
it in future releases, and really, nobody uses Debian GNU/kFreeBSD
anyway.
This caching makes it unnecessarily tedious to fork an embedded Perl
interpreter. When someone that constructs an embedded perl interpreter
and forks their application, the fork(2) system call isn't going to
run Perl_pp_fork(), and thus the return value of $$ and getppid()
doesn't reflect the current process. See [3] for a bug in uWSGI
related to this, and Perl::AfterFork on the CPAN for XS code that you
need to run after forking a PerlInterpreter unbeknownst to perl.
We've already been failing the tests in t/op/getpid.t on these Linux
systems that nobody apparently uses, the Debian GNU/kFreeBSD users did
notice and filed #96270, this patch fixes that failure by changing the
tests to test for different behavior under LinuxThreads, I've tested
that this works on my Debian GNU/kFreeBSD 6.0.4 virtual machine.
If this change is found to be unacceptable (i.e. we want to continue
to emulate POSIX thread semantics for the sake of LinuxThreads) we
also need to revert v5.14.0-251-g0e21945, because currently we're only
emulating POSIX semantics for getppid(), not getpid(). But I don't
think we should do that, both v5.14.0-251-g0e21945 and this commit are
awesome.
This commit includes a change to embedvar.h made by "make
regen_headers".
1. http://www.nntp.perl.org/group/perl.perl5.porters/2002/08/msg64603.html
2. http://pauillac.inria.fr/~xleroy/linuxthreads/
3. http://projects.unbit.it/uwsgi/ticket/85
|
| |
|
| |
|
|
|
|
|
| |
This adds the parameter handling, tests, and documentation for this new
feature which allows locale and Unicode to play well with each other.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current definition of SAVE_DEFSV doesn’t take reference count-
ing into account. Every instance of it in the perl core is buggy
as a result.
Most are also followed by DEFSV_set, which is likewise buggy.
This commit implements SAVE_DEFSV in terms of save_gp and
SAVEGENERICSV if PERL_CORE is defined. save_gp and SAVEGENERICSV are
what local(*_) = \$foo uses. Changing the definition for XS code is
probably too risky this close to 5.16. It should probably be changed
later, though.
DEFSV_set is now changed to do reference counting too.
|
|
|
|
|
| |
It makes little sense to have it in perl.h any more. (Until
recently, feature.h didn’t exist.)
|
|
|
|
|
|
| |
Now that we have hints in $^H to indicate the default feature bun-
dle, there is no need for entries in %^H that turn features off by
their presence.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds the array_base feature to feature.pm
Perl_feature_is_enabled has been modified to use PL_curcop, rather
than PL_hintgv, so it can work with run-time hints as well.
(PL_curcop holds the current state op at run time, and &PL_compiling
at compile time, so it works for both.) The hints in $^H are not
stored in the same place at compile time and run time, so the FEATURE_IS_ENABLED macro has been modified to check first whether
PL_curop == &PL_compiling.
Since array_base is on by default with no hint for it in %^H, it is
a ‘negative’ feature, whose entry in %^H turns it off. feature.pm
has been modified to support such negative features. The new FEATURE_IS_ENABLED_d can check whether such default features
are enabled.
This does make things less efficient, as every version declaration
now loads feature.pm to disable all features (including turning off
array_base, which entails adding an entry to %^H) before loading the
new bundle. I have plans to make this more efficient.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 22c35a8c2392967a (October 1988) added a #include "embed.h" later in
perl.h for when building with PERL_OBJECT defined. Commit d18c61170a306915
(November 1988) added an effectively duplicate #include for all WIN32.
Commit 0cb9638729211ea7 (June 1999) corrected the made the earlier #include
in perl.h also conditional on !PERL_OBJECT (in addition to the
!PERL_FOR_X2P added by 22c35a8c2392967a), but it wasn't until commit
d18c61170a306915 (November 1999) that this changed this to !WIN32, and
embed.h was included exactly once by perl.h (as a2p never actually includes
perl.h).
Commit acfe0abcedaf592f (August 2001) removed the PERL_OBJECT code from
perl.h, reducing the duplication somewhat, but commit 96e176bf068724d0
(October 2001) created analogous special case duplication for VMS, and
commit 27da23d53ccce622 (April 2005) for Symbian. Commit eb8433b7af0f2e09
(March 2006) then neatly put the same #ifndef PERL_MAD code after all 4
locations that included embed.h and commit b3f24c00097febc1 (April 2006)
made the same correction in all 4 places.
But, the daft part of all this is that there was no reason why Win32 was
special - every other operating system can build perl with embed.h included
later in perl.h
Hence the earlier 3 locations can be eliminated, and the was-just-Win32
location made unconditional.
Which saves some lines of code. But fewer lines than are in this commit
message.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 22c35a8c2392967a in October 1998 added an #if !defined(PERL_FOR_X2P)
guard to prevent perl.h from including embed.h when being used to compile
a2p. However, this was not needed even then, because embed.h only contains
pre-processor directives (mostly #define) related to tokens unused in a2p's
C code, so its continued inclusion would not have any effect. Moreover a2p
never actually included perl.h from its own code - only its copy of malloc.c
would include perl.h, and that only if perl was configured to use its own
malloc. But even x2p's use of malloc.c had been "temporarily disabled" by
commit 30e2e4257067d5f8 1 month earlier, so there was never a need for this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit makes CORE::glob bypassing glob overrides.
A side effect of the fix is that, with the default glob implementa-
tion, undefining *CORE::GLOBAL::glob no longer results in an ‘unde-
fined subroutine’ error.
Another side effect is that compilation of a glob op no longer assumes
that the loading of File::Glob will create the *CORE::GLOB::glob type-
glob. ‘++$INC{"File/Glob.pm"}; sub File::Glob::csh_glob; eval '<*>';’
used to crash.
This is accomplished using a mechanism similar to lock() and
threads::shared. There is a new PL_globhook interpreter varia-
ble that pp_glob calls when there is no override present. Thus,
File::Glob (which is supposed to be transparent, as it *is* the
built-in implementation) no longer interferes with the user mechanism
for overriding glob.
This removes one tier from the five or so hacks that constitute glob’s
implementation, and which work together to make it one of the buggiest
and most inconsistent areas of Perl.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
$[ remains as a variable. It no longer has compile-time magic.
At runtime, it always reads as zero, accepts a write of zero, but dies
on writing any other value.
|
|
|
|
|
|
|
| |
This is necessary after 046cc26cf77f76bc63fd4d206fef560054f5d298,
which removed the special handling in vmsish.h. Building with
threads masked the need for the current change because reentr.h
also does the equivalent.
|
|
|
|
|
|
|
|
|
|
|
|
| |
grep.cpan.me and Google's codesearch find no use of WITH_THR or WITH_THX.
WITH_THX() was added in June 1999 in cea2e8a9dd23747f, and the last user
eliminated with 0b250b9ef0d5134f in August 1999. WITH_THX() was used again
for DEBUG_CX() in 1c98cc53150c4860, and eliminated in d9f81b50694a810f.
WITH_THR() was added in 1997 in 0f15f207c55ce70f. Use everywhere except
DEBUG_SCOPE() was eliminated in 2006 in 11206fddaf7ef068. WITH_THR() was
removed from DEBUG_SCOPE() in d9f81b50694a810f.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this, the VMS compiler, with warnings cranked up to level 4,
emits pages and pages of things like:
dVAR;
....^
%CC-I-NOPARMLIST, The declaration of the function Perl___notused has
an empty parameter list. If the function has parameters, they should
be declared here; if it has no parameters, "void" should be specified
in the parameter list.
at line number 100 in file MDA0:[SMOKE.blead]perl.c;1
Over 2,000 of these plus other warnings yields a smoke report of 750K,
which is quite a bit over the 400K limit of the perl.org mailing lists,
not to mention being a slow read.
|
|
|
|
|
|
| |
Without this, the main Makefile and Makefile.micro interfere with each other,
as they both generate the same 5 files, and both think that they can delete
them with their respective clean targets.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
This was inadvertently added as part of eba804b9d4475c6d, but only causes
t/porting/bincompat.t to fail on those platforms that define
HAVE_INTERP_INTERN. It's always the really subtle things that catch you out.
|
|
|
|
|
| |
It had most, but not all, C pre-processor options that change the size of the
interpreter struct.
|
|
|
|
|
| |
Under a DEBUGGING build, this reduces the size of the perl binary by about
10%, and reduces the time to run the test suite by about 10-20%% (!)
|
| |
|
|
|
|
| |
This is the first step in adding a dtrace probe for global phase change
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously dNOOP would declare an unused variable, and where possible mark it
as "unused" to prevent compiler warnings. However, clang doesn't provide
attribute unused, so will produced screenfuls of warnings if invoked with
-Wunused-variable, hiding the real unused variable warnings.
Using a function declaration instead avoids these warnings.
We can't just use define dNOOP as nothing, or a comment, as it is used as
dNOOP;
and a bare semicolon is an error.
|
|
|
|
|
|
|
| |
Unicode inversion lists commonly will contain UV_MAX, which may
trigger these warnings. Add a flag to suppress them to the numeric
grok functions, which can be set by the code that is dealing with
these lists
|
|
|
|
|
| |
They exist solely to ensure that Perl_runops_standard and Perl_runops_debug
are linked in - nothing assigns to either variable, and nothing reads them.
|
|
|
|
| |
Make them const U16 - they should have been const from the start.
|
|
|
|
|
| |
To get the initialisation to work, the location of #include patchlevel.h needs
to be moved.
|
|
|
|
|
|
|
|
| |
On OS/2, keep it in perlvars.h, as it's not const there. makedef.pl doesn't
pay attention to C pre-processor symbols, so it will always see the declaration
in perlvars.h, and add the symbol to the linker file, so no need to mention
sh_path in globvar.sym. Add special case logic in regen/embed.pl to make the
embedvar.h macros for PL_sh_path defined only on OS/2.
|
|
|
|
|
|
|
|
|
|
|
| |
They were converted in perl.h from const char[] to #define in 31fb120917c4f65d,
then re-instated as const char[], but in perlvars.h, in 3fe35a814d0a98f4.
There's no need for compile-time constants to jump through the hoops of
perlvars.h, even for Symbian, as the various "EXTCONST" variables already in
perl.h demonstrate.
These were the only 3 users of the the PERLVARISC macro, so eliminate that, and
all related code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Under MULTIPLICITY, intrpvar.h is included "early", as:
struct interpreter {
# include "intrpvar.h"
};
with local definitions of PERLVAR{,A,I,IS,ISC} that generate output text for the
"variables" as structure members. Additionally, under PERL_GLOBAL_STRUCT
"perlvars.h" is included within struct perl_vars { ... }.
Move the definition/undefining of these 5 macros to within the
#ifdef MULTIPLICITY block, to clarify the limited intent of their scope.
Move some additional related PERL_GLOBAL_STRUCT setup to within the block.
|
|
|
|
|
| |
Two members, flags and fallback, were using integer types considerably larger
than the range of values that they needed to store.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use this to simplify the logic in Perl_sv_magic().
This introduces a small change of behaviour for error cases involving unknown
magic types. Previously, if Perl_sv_magic() was passed a magic type unknown to
it, it would
1: Croak "Modification of a read-only value attempted" if read only
2: Return without error if the SV happened to already have this magic
3: otherwise croak "Don't know how to handle magic of type \\%o"
Now it will always croak "Don't know how to handle magic of type \\%o", even
on read only values, or SVs which already have the unknown magic type.
|
|
|
|
| |
Use this to replace S_is_container_magic() in mg.c with a direct lookup.
|
|
|
|
|
|
|
|
|
|
|
| |
Use it to eliminate the large switch statement in Perl_sv_magic().
As the table needs to be keyed on magic type, which is expressed as C character
constants, the order depends on the compiler's character set. Frustratingly,
EBCDIC variants don't agree on the code points for '~' and ']', which we use
here. Instead of having (at least) 4 tables, get the local runtime to sort the
table for us. Hence the regen script writes out the (unsorted) mg_raw.h, which
generate_uudmap sorts to generate mg_data.h
|
| |
|