| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For lots of core functions:
if a function parameter has been declared NN in embed.fnc, don't test for
nullness at the start of the function, i.e. eliminate code like
if (!foo) ...
On debugging builds the test is redundant, as the PERL_ARGS_ASSERT_FOO
at the start of the function will already have croaked.
On optimised builds, it will skip the check (and so be slightly faster),
but if actually passed a null arg, will now crash with a null-deref SEGV
rather than doing whatever the check used to do (e.g. croak, or silently
return and let the caller's code logic to go awry). But hopefully this
should never happen as such instances will already have been detected on
debugging builds.
It also has the advantage of shutting up recent clangs which spew forth
lots of stuff like:
sv.c:6308:10: warning: nonnull parameter 'bigstr' will evaluate to
'true' on first encounter [-Wpointer-bool-conversion]
if (!bigstr)
The only exception was in dump.c, where rather than skipping the null
test, I instead changed the function def in embed.fnc to allow a null arg,
on the basis that dump functions are often used for debugging (where
pointers may unexpectedly become NULL) and it's better there to display
that this item is null than to SEGV.
See the p5p thread starting at 20150224112829.GG28599@iabyn.com.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some questions and loose ends:
XXX gv.c:S_gv_magicalize - why are we using SSize_t for paren?
XXX mg.c:Perl_magic_set - need appopriate error handling for $)
XXX regcomp.c:S_reg - need to check if we do the right thing if parno
was not grokked
Perl_get_debug_opts should probably return something unsigned; not sure
if that's something we can change.
|
|
|
|
|
|
|
|
|
| |
Generally the guideline is to outdent C labels (e.g. 'foo:') 2 columns
from the surrounding code.
If the label starts at column zero, then it means that diffs, such as
those generated by git, display the label rather than the function
name at the head of a diff block: which makes diffs harder to peruse.
|
|
|
|
| |
and then remove the disabling of that warning.
|
|
|
|
|
|
|
|
|
|
| |
gmtime has a target allocated for it, but it hasn’t used that target
since 46fc3d4c6 (inseparable changes from match from perl-5.003_97g to
perl-5.003_97h, probably the ‘Mondo Cool patch’ mentioned in the com-
mit message).
There is no reason not to use it and avoid allocating a fresh SV with
each scalar-context call.
|
|
|
|
|
|
|
|
|
|
| |
The purpose of EXTEND_MORTAL is to extend the mortals stack only
once before pushing multiple items. Here we are just going to push
one item, so extending it gains us nothing, as sv_2mortal is going
to do that anyway.
Moreover, we will not even be using the mortals stack if there has
been an error.
|
|
|
|
|
|
|
|
|
|
|
| |
cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -D_CONS
OLE -DNO_STRICT -DPERLDLL -DPERL_CORE -O1 -MD -Zi -DNDEBUG -G7 -GL -DPERL_EXTE
RNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\pp_sys.obj ..\pp_sys.c
pp_sys.c
..\pp_sys.c(4610) : error C2063: '_isnan' : not a function
NMAKE : fatal error U1077: 'cl' : return code '0x2'
See RT ticket for details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were getting a time struct like this:
$12 = {
tm_sec = -2147483588,
tm_min = 2147483647,
tm_hour = -2147483624,
tm_mday = -2147483647,
tm_mon = 11,
tm_year = 69,
tm_wday = -2147483641,
tm_yday = -2147483314,
tm_isdst = 0,
tm_gmtoff = 0,
tm_zone = 0x1004f6bb6 "UTC"
}
which resulted in dayname[tmbuf.tm_wday] reading past the beginning
of the array. We should check for nan explicitly instead of falling
through to the time calculations.
|
| |
|
|
|
|
|
|
|
|
|
| |
GIMME_V is a simpler macro that results in smaller machine code.
GIMME does not distinguish between scalar and void context. The two
instances of GIMME == G_SCALAR that I changed (which used to match
void context too, but no longer do) are in code paths unreachable in
void context, so we don’t need to check for it.
|
|
|
|
|
|
|
| |
This requires OS support in the form of either the dirfd() function, or a
dd_fd member in the DIR struct. POSIX.1-2008 specifies the former. If
neither is available, fileno() on a directory handle will return undef and
set errno.
|
|
|
|
| |
-dont compute GvSV multiple times
|
| |
|
|
|
|
|
| |
is_ascii_string's name has misled me in the past; the new name is
clearer.
|
|
|
|
| |
This is in preparation for making the test more complicated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the target is a lexical variable (as happens with ‘$lex = setpgrp’,
in which the assignment is optimised away), then doing set-magic mul-
tiple times has an observable effect. This was only happening when it
was called with no arguments.
This double STORE goes back to 1f200948c4c. 1f200948c4c was just
meant to fix a stack bug, but extending the stack when necessary, but
it was also push TARG and setting it to -1, only for it to be over-
written shortly. (Also, it didn’t fully fix the stack bugs. See
88d6953212e.)
|
|
|
|
|
|
|
|
| |
This was broken inadvertently by 92f2ac5f (5.15.3).
I really have no idea how to test this. I only confirmed the bug and
its fix via a temporary warn statement in pp_setpgrp (obviously not
included in this commit).
|
|
|
|
|
|
|
|
|
|
| |
The success cases in pp_semctl both push a single value to the stack, but
the error case merely set the topmost stack value to undef. The fix is to
push an undef.
This bug manifests most obviously as an "uninitialized value in list slice"
warning when doing something like `my $test = (semctl -1,0,0,0)[0]`; that
was reported out-of-band to rjbs.
|
|
|
|
|
|
|
|
|
|
|
| |
This operator works like <> or <ARGV>, as it reads the list of file
names to open from the command-line arguments. However, it disables
the magic-open feature (that forks to execute piped commands) :
$ bleadperl -e 'while(<>){print}' 'echo foo |'
foo
$ bleadperl -e 'while(<<>>){print}' 'echo foo |'
Can't open echo foo |: No such file or directory at -e line 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[perl #120835] and [rt #91183] and [rt #85570]
Seen errors in blead smoke in AIX 6.1:
cpan/IO-Socket-IP/t/18fdopen .................................. Argument
"\0\0\0^A\0\0\0r\0\0\0\0\0\0\0\0?M-^U\0\0M-^E^[^???\0^N\0..." isn't
numeric in numeric eq (==) at ../../lib/IO/Socket/IP.pm line 748.
cpan/IO-Socket-IP/t/31nonblocking-connect-internet ............ Argument
"\0\0\0\0\0\0\0\0?\0\n^B1?\0\0\0^B\0^BM-\rf?^H?\0^N\0^B?|..." isn't
numeric in scalar assignment at ../../lib/IO/Socket/IP.pm line 707.
|
|
|
|
|
|
|
|
| |
Where pp_foo() also handles OP_BAR, add a comment above the function
mentioning that it also does pp_bar.
This means that "grep pp_bar pp*.c" quickly locates the file/function that
handles OP_BAR.
|
|
|
|
| |
The note about %lld being broken is probably quite obsolete.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a new config file, regen/op_private, which contains all the
information about the flags and descriptions for the OP op_private field.
Previously, the flags themselves were defined in op.h, accompanied by
textual descriptions (sometimes inaccurate or incomplete).
For display purposes, there were short labels for each flag found in
Concise.pm, and another set of labels for Perl_do_op_dump() in dump.c.
These two sets of labels differed from each other in spelling (e.g.
REFC verses REFCOUNT), and differed in completeness and accuracy.
With this commit, all the data to generate the defines and the labels is
derived from a single source, and are generated automatically by 'make
regen'. It also contains complete data on which bits are used for what by
each op. So any attempt to add a new flag for a particular op where that
bit is already in use, will raise an error in make regen. This compares
to the previous practice of reading the descriptions in op.h and hoping
for the best.
It also makes use of data in regen/opcodes: for example, regen/op_private
specifies that all ops flagged as 'T' get the OPpTARGET_MY flag.
Since the set of labels used by Concise and Perl_do_op_dump() differed,
I've standardised on the Concise version. Thus this commit changes the
output produced by Concise only marginally, while Perl_do_op_dump() is
considerably different. As well as the change in labels (and missing
labels), Perl_do_op_dump() formerly had a bug whereby any unrecognised
bits would not be shown if there was at least one recognised bit.
So while Concise displayed (and still does) "LVINTRO,2", Perl_do_op_dump()
has changed:
- PRIVATE = (INTRO)
+ PRIVATE = (LVINTRO,0x2)
Concise has mainly changed in that a few op/bit combinations weren't being
shown symbolically, and now are. I've avoiding fixing the ones that would
break tests; they'll be fixed up in the next few commits.
A few new OPp* flags have been added:
OPpARG1_MASK
OPpARG2_MASK
OPpARG3_MASK
OPpARG4_MASK
OPpHINT_M_VMSISH_STATUS
OPpHINT_M_VMSISH_TIME
OPpHINT_STRICT_REFS
The last three are analogues for existing HINT_* flags. The former four
reflect that many ops some of the lower few bits of op_private to indicate
how many args the op expects. While (for now) this is still displayed as,
e.g. "LVINTRO,2", the definitions in regen/op_private now fully account
for which ops use which bits for the arg count.
There is a new module, B::Op_private, which allows this new data to be
accessed from Perl. For example,
use B::Op_private;
my $name = $B::Op_private::bits{aelem}{7}; # OPpLVAL_INTRO
my $value = $B::Op_private::defines{$name}; # 128
my $label = $B::Op_private::labels{$name}; # LVINTRO
There are several new constant PL_* tables. PL_op_private_valid[]
specifies for each op number, which bits are valid for that op. In a
couple of commits' time, op_free() will use this on debugging builds to
assert that no ops gained any private flags which we don't know about.
In fact it was by using such a temporary assert repeatedly against the
test suite, that I tracked down most of the inconsistencies and errors in
the current flag data.
The other PL_op_private_* tables contain a compact representation of all
the ops/bits/labels in a format suitable for Perl_do_op_dump() to decode
Op_private. Overall, the perl binary is about 500 bytes smaller on my
system.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was discussion about extending these to work for Latin1,
(http://nntp.perl.org/group/perl.perl5.porters/214950 and following)
but in the end it was decided that this is a heuristic, and perturbing
that might break things. So this patch keeps the same criteria as
before, but refactors things so it isn't ASCII-platform-centric.
However, the version it replaces checked for utf8ness piece-meal,
leading to possibly incorrect results, which this fixes. If a buffer
isn't entirely UTF-8, then it can't be UTF-8. So this uses
is_utf8_string() instead of reimplementing the utf8ness checks, and does
it for the buffer as a whole.
And, there was an inapproptiate test for ALPHA under locale that this
removes. The test for locale non-strange characters is that they be
either printable or space (things like \t are space but not printable).
|
|
|
|
|
|
|
| |
Therefore, as an extra paranoia step, zero-terminate
the readlink result buffer even before the result SV is created.
Also, readlink returns SSize_t, not int.
|
|
|
|
|
| |
Remaining atoi() uses include at least:
ext/DynaLoader/dl_aix.xs, os2/os2.c, vms/vms.c
|
| |
|
|
|
|
|
|
|
|
| |
You need to configure with g++ *and* -Accflags=-DPERL_GLOBAL_STRUCT
or -Accflags=-DPERL_GLOBAL_STRUCT_PRIVATE to see any difference.
(g++ does not do the "post-annotation" form of "unused".)
The version code has some of these issues, reported upstream.
|
|
|
|
|
|
| |
This reverts commit 148f39b7de6eae9ddd59e0b0aff691d6abea7aca.
(Still needs more work, but wanted to see how well this passed with Jenkins.)
|
|
|
|
|
|
| |
Definitely not *after* it. It marks the start of the unreachable,
not the first unrechable line. And if they are in that order,
it looks better to linebreak after the lint hint.
|
|
|
|
|
| |
Even though it can't be reached, the absence of a return statement
makes the VMS C compiler warn that it's missing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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?)
|
|
|
|
|
|
|
| |
This reverts commit 8c2b19724d117cecfa186d044abdbf766372c679.
I don't understand - smoke-me came back happy with three
separate reports... oh well, some other time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
|
|
|
| |
Commit d6ded95025185cb1ec8ca3ba5879cab881d8b180 introduced
the ability to specify individual category parameters to 'use locale'.
However in doing so, it causes Perl to not be able to compile on
platforms that don't have some or all of those categories defined, such
as Android. This commit uses #ifdefs to remedy that.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is not very user friendly to list functions as
"Functions found in file FOO". Better is to group them by purpose, as
many were already. I went through and placed the ones that weren't
already so grouped into groups. Patches welcome if you have a better
classification.
I changed the headings of some so that the important disctinction was
the first word so that they are placed in the file more appropriately.
And a couple of ones that I had created myself, I came up with a name
that I think is better than the original
|
|
|
|
|
|
|
| |
This commit allows one to specify to enable locale-awareness for only a
specified subset of the locale categories. Thus you could make a
section of code LC_MESSAGES aware, with no locale-awareness for the
other categories.
|
|
|
|
|
|
|
|
|
|
|
| |
remove some redundant code regarding stack handling
-removed:
-4/-8 pop on SP
+4/+8 push on SP
PUTBACK
function's machine code size dropped from 0xC5 to 0xBD bytes on VC2003
|
|
|
|
|
|
|
| |
Used by linters (static checkers), and also good for human readers.
Even though "FALL THROUGH" seems to be the most common, e.g BSD lint
manual only knows "FALLTHROUGH" (or "FALLTHRU").
|
|
|
|
|
|
|
|
| |
Adding asserts to more spots.
Fix for Coverity perl5 CIDs 28962,28968,28969:
CID ...: Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer p->q
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(Also very few spots of negative numgroups for getgroups(),
and fgetc() return, but almost all checking is for fcntl.)
(merged fix for perl #121743 and perl #121745: hopefully
picked up all the fixes-to-fixes from the ticket...)
Fix for Coverity perl5 CIDs 28990..29003,29005..29011,29013,
45354,45363,49926:
Argument cannot be negative (NEGATIVE_RETURNS) fd is
passed to a parameter that cannot be negative.
and CIDs 29004, 29012:
Argument cannot be negative (NEGATIVE_RETURNS)
num_groups is passed to a parameter that cannot be negative
and because of CIDs 29005 and 29006 also CID 28924.
In the first set of issues a fd is retrieved from PerlIO_fileno, and
that is then used in places like fstat(), fchown(), dup(), etc.,
without checking whether the fd is valid (>=0).
In the second set of issues a potentially negative
number is potentially passed to getgroups().
The CIDs 29005 and 29006 were a bit messy: fixing them needed also
resolving CID 28924 where the return value of fstat() was ignored,
and for completeness adding two croak calls (with perldiag updates):
a bit of a waste since it's suidperl code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix for Coverity perl5 CID 29088: Uninitialized scalar variable (UNINIT)
uninit_use: Using uninitialized value tmbuf.tm_year.
There is a code path that can lead to accessing uninitialized tmbuf:
when the too-small or too-large time inputs to gmtime/localtime
happen.
- make it so that the tm_year is used only on successful code path:
pp_sys.c
- add the gmtime failed / localtime failed errors to perldiag:
pod/perldiag.pod
- test those errors: t/op/time.t
|
|
|
|
|
|
|
| |
If PerlIO_getc returns EOF, PerlIO_get_cnt is not going to return a
positive value all of a sudden.
Signed-off-by: Niels Thykier <niels@thykier.net>
|
| |
|
|
|
|
|
|
| |
Calls to Perl_do_openn() all have at least 2 unused arguments which clutter
the code and hinder easy understanding. Perl_do_open6() and
Perl_do_open_raw() each only do one job, so don't have the dead arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was replaced by the standard tms struct in v7.0, released in
1995. Explicit support for pre-7.0 was removed in 32995a382d65b
for Perl 5.16, but I missed the tbuffer_t bit, which tripped up
Nicholas in 25983af42cdcf2dc, because he asked for:
struct tbuffer_t
which via macro expansion became:
struct struct tms
which failed to compile. So remove code that's unnecessarily
different on VMS, leaving only a tbuffer_t compatibility macro
with a more appropriate comment so it will hopefully be less
likely to get used in new code.
|
|
|
|
|
|
|
|
|
|
| |
PL_timesbuf is effectively a vestige of Perl 1, and doesn't actually need to
be an interpreter variable. It will be removed early in v5.21.x, but it's a
good idea to refactor the code not to use it before then. A local struct tms
will be on the C stack, which will be in the CPU's L1 cache, whereas the
relevant part of the interpreter struct may well not be in the CPU cache at
all. Therefore this change might reduce cache pressure fractionally. A local
variable access should also be simpler machine code on most CPU architectures.
|
|
|
|
|
|
| |
av_tindex is a more clearly named synonym for av_len, available starting
in v5.18. This changes the core uses to it, including modules in /ext,
which are not dual-lifed.
|