This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
6 years agoClarify comments around deprecated attributes
Dagfinn Ilmari Mannsåker [Sun, 29 Oct 2017 12:57:25 +0000 (12:57 +0000)]
Clarify comments around deprecated attributes

6 years agobytes_to_utf8(): Trim unused malloc'd space
Karl Williamson [Sun, 29 Oct 2017 05:13:47 +0000 (23:13 -0600)]
bytes_to_utf8(): Trim unused malloc'd space

I asked on p5p if anyone had an opinion about whether to trim
overallocated space in this function, and got no replies.

It seems to me to be best to tidy up upon return.

6 years agoBump Socket version to 2.020_04
Karl Williamson [Sat, 28 Oct 2017 19:08:02 +0000 (13:08 -0600)]
Bump Socket version to 2.020_04

Commit 0cdc775ef423ad6415e6f80b9244c17a52bf5149 made a small change in
cpan/Socket/Socket.pm, causing a porting test failure, which is solved
by a version bump, and changing customized.dat to account for that.

6 years agoperlre: Slight clarification
Karl Williamson [Sat, 28 Oct 2017 18:51:07 +0000 (12:51 -0600)]
perlre: Slight clarification

6 years agoperldiag: More detail on /i var length lookbehind
Karl Williamson [Sat, 28 Oct 2017 18:32:57 +0000 (12:32 -0600)]
perldiag: More detail on /i var length lookbehind

See http://nntp.perl.org/group/perl.perl5.porters/245323

6 years agoregcomp.h: Add comment
Karl Williamson [Fri, 27 Oct 2017 18:52:26 +0000 (12:52 -0600)]
regcomp.h: Add comment

6 years agoNumify $Socket::VERSION
Dagfinn Ilmari Mannsåker [Sat, 28 Oct 2017 15:23:33 +0000 (16:23 +0100)]
Numify $Socket::VERSION

We have a customised version with _ in the version, which causes
warnings from modules that check it numerically instead of calling
->VERSION(...).

6 years agoChange upper limit handling of -Dr output
Karl Williamson [Fri, 27 Oct 2017 18:28:57 +0000 (12:28 -0600)]
Change upper limit handling of -Dr output

Commit 2bfbbbaf9ef1783ba914ff9e9270e877fbbb6aba changed things so -Dr
output could be changed through an environment variable to truncate
the output differently than the default.

For most purposes, the default is good enough, but for someone trying to
debug the regcomp internals, sometimes one wants to see more than is
output by default.

That commit did not catch all the places.  This one changes the handling
so that any place that use the previous default maximum now uses the
environment variable (if set) instead.

6 years agoDevel-PPPort: Fix up pod
Karl Williamson [Fri, 27 Oct 2017 16:40:42 +0000 (10:40 -0600)]
Devel-PPPort: Fix up pod

Now that this module is in dist, podcheck runs, and found problems,
which this commit fixes.

6 years agomv Devel-PPPort from cpan to dist
Karl Williamson [Tue, 17 Oct 2017 12:54:57 +0000 (06:54 -0600)]
mv Devel-PPPort from cpan to dist

It was decided at the perl core hackathon in October 2017 to go ahead
and do this.

6 years agoregcomp.c: Skip UTF-8 decoding for invariants
Karl Williamson [Fri, 27 Oct 2017 16:15:29 +0000 (10:15 -0600)]
regcomp.c: Skip UTF-8 decoding for invariants

By adding two branches, we can avoid the expensive UTF-8 decode step for
the common case of the input being an ASCII character.

6 years agotoke.c: Add commentary
Karl Williamson [Fri, 27 Oct 2017 16:08:35 +0000 (10:08 -0600)]
toke.c: Add commentary

6 years agoregcomp.c: Don't forget to restore state
Karl Williamson [Fri, 27 Oct 2017 15:51:23 +0000 (09:51 -0600)]
regcomp.c: Don't forget to restore state

In code reading (so I don't have a test case), I realized that this code
could return out of its function without restoring the state that it has
changed out from under the caller, and that can lead to havoc when the
caller continues on assuming the original state.

This commit moves the return and other checking to after the state
restoral code.  It can call FAIL2 as part of a panic after the state the
failure is in is gone.  This would be a problem if it called vFAIL2
instead, but isn't because FAIL2 doesn't need the state the failure was
in.

6 years agoregcomp.c: Remove redundant 'if'
Karl Williamson [Fri, 27 Oct 2017 15:32:26 +0000 (09:32 -0600)]
regcomp.c: Remove redundant 'if'

We have already assured earlier in the function that this 'if' is always
true.

6 years agoregcomp.c: White-space only
Karl Williamson [Fri, 27 Oct 2017 15:25:56 +0000 (09:25 -0600)]
regcomp.c: White-space only

Vertically align some text.

6 years agoregcomp.c: Add assertion
Karl Williamson [Fri, 27 Oct 2017 15:23:01 +0000 (09:23 -0600)]
regcomp.c: Add assertion

6 years agoDon't link in Perl_my_strnlen when we don't have it.
Craig A. Berry [Thu, 26 Oct 2017 12:46:46 +0000 (07:46 -0500)]
Don't link in Perl_my_strnlen when we don't have it.

6 years agoUse File::Spec->tmpdir() instead of hard-coded /tmp
Steve Hay [Thu, 26 Oct 2017 07:28:25 +0000 (08:28 +0100)]
Use File::Spec->tmpdir() instead of hard-coded /tmp

The latter doesn't necessarily work on Windows (it depends whether you have
such a folder on the current drive), leading to a failed chdir(), which in
turn results in temporary files being created in the wrong folder, which
then don't get cleaned up.

6 years agoRestore parenthesis that went missing in 083b2a61ee6281f.
Craig A. Berry [Thu, 26 Oct 2017 01:28:23 +0000 (20:28 -0500)]
Restore parenthesis that went missing in 083b2a61ee6281f.

6 years agoRedirect STDERR to /dev/null instead of just closing it
Steve Hay [Wed, 25 Oct 2017 16:46:44 +0000 (17:46 +0100)]
Redirect STDERR to /dev/null instead of just closing it

See perl #132358: Just closing it leaves that file descriptor available
for use by the next open(), which can have unforeseen consequences...

6 years agoRemove unused probes in configure.com.
Craig A. Berry [Wed, 25 Oct 2017 12:33:34 +0000 (07:33 -0500)]
Remove unused probes in configure.com.

Recent commits for the C89 work had us stop using the result of
these probes, so there is no point in continuing to build and run
them.

6 years agoRevert "vms/vmsish.h: move a function declaration from doio.c"
Craig A. Berry [Wed, 25 Oct 2017 12:29:35 +0000 (07:29 -0500)]
Revert "vms/vmsish.h: move a function declaration from doio.c"

This reverts commit d4bd48023fe0ba950fface5aa859b6852aa29fc4.

perlio.h depends on vmsish.h and comes in (via iperlsys.h) about
a thousand lines later in perl.h.  So we can't put a prototype
that uses PerlIO in vmsish.h

Maybe there is a way to get that prototype out of doio.c, but
this isn't it.

6 years agoFix missing skip counts in PathTools' cwd.t
Dagfinn Ilmari Mannsåker [Wed, 25 Oct 2017 10:24:52 +0000 (11:24 +0100)]
Fix missing skip counts in PathTools' cwd.t

6 years agoUpgrade Net::Ping from version 2.55 to 2.61
Steve Hay [Tue, 24 Oct 2017 07:34:23 +0000 (08:34 +0100)]
Upgrade Net::Ping from version 2.55 to 2.61

This retains blead customizations 0fc44d0a18 and 7bfdd8260c. Other
customizations have been incorporated into the CPAN release.

6 years agodquote.c: Rmv extraneous #ifdef; add assertions
Karl Williamson [Sat, 25 Mar 2017 17:35:11 +0000 (11:35 -0600)]
dquote.c: Rmv extraneous #ifdef; add assertions

assert() already does nothing unless -DDEBUGGING; no need to enclose
them in #ifdef DEBUGGING.  And this adds another assertion that is
required to be true on entry to the function.

6 years agohandy.h: Add parens around macro expansion
Karl Williamson [Mon, 24 Apr 2017 19:09:16 +0000 (13:09 -0600)]
handy.h: Add parens around macro expansion

This guarantees the expected precedence no matter what the context it is
called in.

6 years agonumeric.c: Add comment
Karl Williamson [Sat, 25 Mar 2017 20:01:58 +0000 (14:01 -0600)]
numeric.c: Add comment

6 years agoConvert strncmp into strnEQ, strnNE
Karl Williamson [Thu, 9 Mar 2017 04:55:08 +0000 (21:55 -0700)]
Convert strncmp into strnEQ, strnNE

The new versions are much easier to comprehend.

There are several cases in vms.c where strEQ and strNE suffice, instead
of having to have a count parameter.

6 years agoConvert strcmp into strEQ, strNE
Karl Williamson [Thu, 9 Mar 2017 20:13:07 +0000 (13:13 -0700)]
Convert strcmp into strEQ, strNE

The latter two are easier to read

6 years agoUnweaken refs in in-place reverse
Dagfinn Ilmari Mannsåker [Tue, 26 Sep 2017 22:11:04 +0000 (23:11 +0100)]
Unweaken refs in in-place reverse

For consistency with assignment and in-place sort

6 years agoDynaLoader: Use strlcpy instead of strcpy
Karl Williamson [Mon, 27 Mar 2017 20:16:27 +0000 (14:16 -0600)]
DynaLoader: Use strlcpy instead of strcpy

strlcpy is safer.

6 years agoSkip various tests if PERL_BUILD_PACKAGING is set
Dominic Hargreaves [Sat, 14 Oct 2017 14:27:53 +0000 (16:27 +0200)]
Skip various tests if PERL_BUILD_PACKAGING is set

These are tests which tend not to be useful for downstream packagers

t/porting/customized.t change originally from Todd Rinaldo

6 years agoFurther simplify XSLoader .bs file handling
Dagfinn Ilmari Mannsåker [Mon, 23 Oct 2017 17:50:31 +0000 (18:50 +0100)]
Further simplify XSLoader .bs file handling

Because we're not actually doing anything with it, combine the check
with the one for the missing file.

6 years agoAvoid loading .bs files twice when using XSLoader
Dagfinn Ilmari Mannsåker [Mon, 23 Oct 2017 17:33:11 +0000 (18:33 +0100)]
Avoid loading .bs files twice when using XSLoader

When a .bs file is found, XSLoader::load() falls back to
DynalLoader::bootstrap() which will load it, so there's no need to do
it twice.

6 years agoIncrease $B::VERSION to 1.71
Father Chrysostomos [Mon, 23 Oct 2017 16:52:23 +0000 (09:52 -0700)]
Increase $B::VERSION to 1.71

6 years agoB::walksymtable: clear cached methods
Father Chrysostomos [Mon, 23 Oct 2017 16:50:10 +0000 (09:50 -0700)]
B::walksymtable: clear cached methods

There was a dummy assignment in B::walksymtable that I removed in com-
mit 6a4fc5265ba1 because it appeared to be redundant.  Removing that
assignment broke Module::Info (rt.cpan.org #123352), because it
changed the behaviour of B::Utils (by changing the behaviour of
B::walksymtable).  That seemingly useless assignment was actually
clearing cached methods, so that any B::GV object passed to the call-
back method sees ->CV pointing to something only if there is a real
sub there.  Since this seems like a reasonable expectation, this com-
mit restores the old behaviour, with a comment explaining what the
assignment is for, and tests it.

6 years agoRT#132347: fix building Tk
Aaron Crane [Mon, 23 Oct 2017 16:22:34 +0000 (17:22 +0100)]
RT#132347: fix building Tk

The Tk distribution has its own portability layer that expects to find
certain settings in %Config, as well as some cpp symbols defined in
perl.h. The recent Perl changes to require a C89 compiler caused some of
the metaconfig units defining those %Config settings and cpp symbols to
be omitted. This commit restores compatibility with Tk, by ensuring that
the things it wants are available even though they are no longer
provided by metaconfig.

6 years agoQuieten Time-HiRes test noise
Dagfinn Ilmari Mannsåker [Mon, 23 Oct 2017 14:50:55 +0000 (15:50 +0100)]
Quieten Time-HiRes test noise

The notices about testing for subsecond file timestamps don't belong
on STDERR, since we skip_all based on the result anyway.

6 years ago[MERGE] various bench.pl enhancements and fixes
David Mitchell [Mon, 23 Oct 2017 11:57:57 +0000 (12:57 +0100)]
[MERGE] various bench.pl enhancements and fixes

Various enhancements and fixups to bench.pl. The most notable ones are:

* Add 'compile' benchmark field

    If a benchmark has this flag set, measure the compile time of the
    construct rather than its execution time, by wrapping the code in

        eval q{ sub { ... } }

* Add 'pre' and 'post' benchmark fields

    These allow actions to be performed each time round the loop, just before
    and after the benchmarked code, but without contributing to the timings.

    For example to benchmark appending to a string, you need to reset the
    string to a known state before each iteration, otherwise the string gets
    bigger and bigger with each iteration:

        code => '$s = ""; $s .= "foo"',

    but now you're measuring both the concat and an assign. To measure just
    the concat, you can now do:

        pre  => '$s = ""',
        code => '$s .= "foo"',

    Note the contrast with 'setup', which is only executed once, outside the
    loop.

* Make 'desc' default to 'code'

    Any entries in the benchmarks file which don't have a 'desc' description
    field will have the description set to the string for 'code'

* Allow negative column indices

    e.g. --norm=-2 will make the second-to-rightmost column the 100% one

* Miscellaneous:

     Make -v an alias for --verbose

     --compact: display description too

     Add checks for bad benchmark files

     Display large values as 'Inf'

     Allow variable-width data columns

     --autolabel: avoid degenerate cases

     Fix race condition in test

     List the valid perls as part of an 'unrecognised perl' error message

6 years agobenchmarks.t: update to handle field changes
David Mitchell [Mon, 23 Oct 2017 11:46:04 +0000 (12:46 +0100)]
benchmarks.t: update to handle field changes

desc and setup are now optional; pre, post and compile have been added.

6 years agobench.pl: add 'compile' benchmark field
David Mitchell [Mon, 23 Oct 2017 10:29:18 +0000 (11:29 +0100)]
bench.pl: add 'compile' benchmark field

If a benchmark has this flag set, measure the compile time of the
construct rather than its execution time, by wrapping the code in

    eval q{ sub { ... } }

6 years agobench.pl: add 'pre' and 'post' benchmark fields
David Mitchell [Sat, 21 Oct 2017 22:53:03 +0000 (23:53 +0100)]
bench.pl: add 'pre' and 'post' benchmark fields

These allow actions to be performed each time round the loop, just before
and after the benchmarked code, but without contributing to the timings.

For example to benchmark appending to a string, you need to reset the
string to a known state before each iteration, otherwise the string gets
bigger and bigger with each iteration:

    code => '$s = ""; $s .= "foo"',

but now you're measuring both the concat and an assign. To measure just
the concat, you can now do:

    pre  => '$s = ""',
    code => '$s .= "foo"',

Note the contrast with 'setup', which is only executed once, outside the
loop.

6 years agobench.pl: make 'desc' default to 'code'
David Mitchell [Sat, 21 Oct 2017 15:44:58 +0000 (16:44 +0100)]
bench.pl: make 'desc' default to 'code'

Any entries in the benchmarks file which don't have a 'desc' description
fields will have the description set to the string for 'code'

6 years agobench.pl: add checks for bad benchmark files
David Mitchell [Sat, 21 Oct 2017 14:53:05 +0000 (15:53 +0100)]
bench.pl: add checks for bad benchmark files

When reading in a --benchmark file, do some basic sanity checks on the
values read in:
    * an even number of name => {} pairs
    * a valid test name
    * valid hash keys

6 years agobench.pl: display large values as 'Inf'
David Mitchell [Sat, 21 Oct 2017 14:19:28 +0000 (15:19 +0100)]
bench.pl: display large values as 'Inf'

When calculating percentages, you might end up with something like

    1 / 0.0000001

which really means that the new perl had one cache miss (say) and the old
perl had zero misses, but due to measurement noise, the 0 wasn't measured
as quite 0.

So if the value is more than a million, display as 'Inf' instead.

6 years agobench.pl: allow variable-width data columns
David Mitchell [Sat, 21 Oct 2017 14:13:35 +0000 (15:13 +0100)]
bench.pl: allow variable-width data columns

Rather than using a fixed(ish) format width like "%6.2f" (which was only
increased based on the width of the label heading each column), calculate
separately for each column, the minimum width based on both the label and
all the data to be displayed in that column.

6 years agobench.pl: factor out some common code
David Mitchell [Sat, 21 Oct 2017 10:05:39 +0000 (11:05 +0100)]
bench.pl: factor out some common code

put the code which prints a single data cell into a separate function,
grind_format_cell()

6 years agobench.pl: make -v an alias for --verbose
David Mitchell [Fri, 20 Oct 2017 12:30:27 +0000 (13:30 +0100)]
bench.pl: make -v an alias for --verbose

I'm too lazy to type the whole word every time.

6 years agobench.pl --autolabel: avoid degenerate cases
David Mitchell [Fri, 20 Oct 2017 12:06:27 +0000 (13:06 +0100)]
bench.pl --autolabel: avoid degenerate cases

If there was only one executable, it was creating the label ''; use '0'
instead.

Also, if the auto-generated labels are integers, prefix them with 'p'
so that things like --norm=2 aren't ambiguous (column number versus label)

6 years agobench.pl: fix race condition in test
David Mitchell [Fri, 20 Oct 2017 11:52:17 +0000 (12:52 +0100)]
bench.pl: fix race condition in test

The test that forces cachegrind to give an error by providing an invalid
arg, tests that bench.pl complains about the bad output from cachegrind.

But due to the way bench.pl's main event loop works, its possible for the
process to be reaped and for bench.pl to complain about its exit status
*before* any error message is read back from the pipe.

So test for both types of possible error message.

See
    Subject: Intermittent failure in bench.t
    http://nntp.perl.org/group/perl.perl5.porters/245218

6 years agobench.pl --compact: display description too
David Mitchell [Fri, 20 Oct 2017 11:35:18 +0000 (12:35 +0100)]
bench.pl --compact: display description too

As well as displaying the test name on each line, e.g.

    call::sub::empty

display the description too, e.g.

    call::sub::empty   function call with no args or body

6 years agobench.pl: allow negative column indices
David Mitchell [Fri, 20 Oct 2017 11:21:01 +0000 (12:21 +0100)]
bench.pl: allow negative column indices

e.g. --norm=-2 will make the second-to-rightmost column the 100% one

Also fix a slight bug in the existing positive (0..N-1) column selection
code: it didn't match against more than one digit, so for example
--norm=10 didn't work.

6 years agobench.pl: list valid in 'unrecognised perl' err
David Mitchell [Fri, 20 Oct 2017 11:01:14 +0000 (12:01 +0100)]
bench.pl: list valid in 'unrecognised perl' err

For something like --norm=foo where foo isn't a valid name of a perl
executable, list the valiud names as part of the error message

6 years agometaconfig: ignore "index", "rindex"
Aaron Crane [Mon, 23 Oct 2017 10:43:23 +0000 (11:43 +0100)]
metaconfig: ignore "index", "rindex"

This permits deletion of our modified d_strchr.U metaconfig unit.

6 years agoConfigure: rebuild from latest units
Aaron Crane [Mon, 23 Oct 2017 10:34:06 +0000 (11:34 +0100)]
Configure: rebuild from latest units

This is a whitespace-only change.

6 years agoNew .metaconf-exclusions.txt file
Aaron Crane [Mon, 23 Oct 2017 10:25:06 +0000 (11:25 +0100)]
New .metaconf-exclusions.txt file

This file lists symbols that metaconfig should ignore when calculating
what units Perl needs.

6 years agodocument semantics of %+ in perlvar in addition to perlre
Lukas Mai [Sun, 22 Oct 2017 20:55:14 +0000 (22:55 +0200)]
document semantics of %+ in perlvar in addition to perlre

6 years agoget rid of "implicit fallthrough" warnings with gcc 7
Lukas Mai [Sun, 22 Oct 2017 15:03:55 +0000 (17:03 +0200)]
get rid of "implicit fallthrough" warnings with gcc 7

6 years agoavoid "implicit fallthrough" warning under ithreads
Lukas Mai [Sun, 22 Oct 2017 13:56:11 +0000 (15:56 +0200)]
avoid "implicit fallthrough" warning under ithreads

6 years agoDefine I_STDARG cpp symbol for XS backcompat
Aaron Crane [Sun, 22 Oct 2017 12:33:31 +0000 (13:33 +0100)]
Define I_STDARG cpp symbol for XS backcompat

While I'm not eager in general to go round defining symbols like this
for all the standard headers, I_STDARG is a little unusual in that
several older XS modules also use it to decide whether to call the
va_args() macro using its pre-standardisation form (since C89 added an
additional argument to it).

Affected modules include DBI, Tk, and DBD::Unify.

6 years agoRemove superfluous FALLTHROUGH guards.
James E Keenan [Sun, 22 Oct 2017 11:48:43 +0000 (07:48 -0400)]
Remove superfluous FALLTHROUGH guards.

Per code review by mauke++ on #p5p.

6 years agoPrevent warnings when building with gcc-7.2.
James E Keenan [Sun, 22 Oct 2017 01:27:18 +0000 (21:27 -0400)]
Prevent warnings when building with gcc-7.2.

Guard against:  "warning: this statement may fall through" warnings.

6 years agoDefine an _() macro for XS backcompat
Aaron Crane [Sun, 22 Oct 2017 11:44:55 +0000 (12:44 +0100)]
Define an _() macro for XS backcompat

Removing this macro (as part of c89ification) broke DBI; see RT#132347.

6 years agoODBM_File: avoid "flags set but not used" warning
Lukas Mai [Sun, 22 Oct 2017 11:43:38 +0000 (13:43 +0200)]
ODBM_File: avoid "flags set but not used" warning

6 years agot/porting/pending-author.t: report skip reasons more carefully
Aaron Crane [Thu, 19 Oct 2017 09:48:30 +0000 (10:48 +0100)]
t/porting/pending-author.t: report skip reasons more carefully

6 years agoregcomp.c: Fix typo in comment
Karl Williamson [Sat, 21 Oct 2017 23:25:28 +0000 (17:25 -0600)]
regcomp.c: Fix typo in comment

6 years agoregcomp.c: Add assertion
Karl Williamson [Sat, 21 Oct 2017 23:24:11 +0000 (17:24 -0600)]
regcomp.c: Add assertion

If this value is negative, something is wrong.

6 years agoFix sv_vcatpvfn %s with precision on non-NUL-terminated strings
Dagfinn Ilmari Mannsåker [Sun, 15 Oct 2017 07:33:22 +0000 (09:33 +0200)]
Fix sv_vcatpvfn %s with precision on non-NUL-terminated strings

The precision parameter to %s can be used to print non-NUL-terminated
strings, so use my_strnlen() to limit the length checking to the
specified length.

6 years agoProvide fallback strnlen implementation
Dagfinn Ilmari Mannsåker [Sat, 21 Oct 2017 19:05:17 +0000 (20:05 +0100)]
Provide fallback strnlen implementation

6 years agoProbe for strnlen on VMS
Dagfinn Ilmari Mannsåker [Sat, 21 Oct 2017 19:04:37 +0000 (20:04 +0100)]
Probe for strnlen on VMS

6 years agoRegenerate Glossary
H.Merijn Brand [Sat, 21 Oct 2017 17:54:17 +0000 (19:54 +0200)]
Regenerate Glossary

6 years agoFix Perl_langinfo() non-threaded bug
Karl Williamson [Sat, 21 Oct 2017 17:12:20 +0000 (11:12 -0600)]
Fix Perl_langinfo() non-threaded bug

Perl_langinfo() is supposed to return a pointer to internal storage that
is supposed to remain valid until the next call to it.  That should come
automatically on single-threaded perls.  The previous version took
advantage of this to avoid copying the result to a buffer, and just
called plain nl_langinfo().  However, it turns out that some systems
destroy the internal space also when a setlocale() is done.  That means
the result must be copied in all instances.

6 years ago[MERGE] Rely on a C89 compiler
Aaron Crane [Sat, 21 Oct 2017 16:05:11 +0000 (17:05 +0100)]
[MERGE] Rely on a C89 compiler

We have claimed to need a C89 compiler for building since at least October 1998
(see commit 5effff0b18af479fcc5e67b74bc41c4bc53342f6). This branch finally
makes good on that promise: we no longer probe for required features of C89
(whether language features, cpp syntax, the presence or behaviour of library
routines, or the availability or contents of header files).

This permits substantial simplification of our header files, as well as
a pleasing reduction in the size of the Configure script and the number of
compilation probes it does.

That said, this set of changes is a little conservative. Notably, I have not
attempted to unpick our maze of malloc/free/realloc macros to rely on things
like free(NULL); nor have I attempted to rely on adequate locale support (since
AIUI the libc on Android in particular claims to have locale support but
doesn't). It's also possible that I've simply missed some opportunities to
simplify the code and/or Configure script, but I hope that we can collectively
fix those as and when we discover them.

These changes have been tested on the following platforms: Mac OS (gcc, clang),
Linux (gcc), FreeBSD (gcc), Win32 (MSVC), HP/UX (HP C), and AIX (xlc).

This work was undertaken at the Perl 5 Hackathon 2017. I thank the Hackathon's
sponsors for making it possible for me to attend; I would not have been able to
do this otherwise.

6 years agoperl.h: explicitly declare "environ" in more places
Aaron Crane [Wed, 18 Oct 2017 18:34:45 +0000 (19:34 +0100)]
perl.h: explicitly declare "environ" in more places

Some systems declare environ in some situations; others never do. (BSD
systems seem to fall into the latter category, for example.)

Previously, we declared environ in the absence of the DONT_DECLARE_STD cpp
symbol, but that symbol has now been removed (on the grounds that redeclaring
system functions is typically unhelpful). But it probably shouldn't have been
used to avoid declaring environ, because very few systems actually provide
declarations for that variable.

This change adds the environ declaration almost everywhere, on the grounds
that even where the system headers do declare it, an additional declaration
won't in fact hurt.

6 years agopod/perlhacktips.pod: remove some outdated portability notes
Aaron Crane [Tue, 17 Oct 2017 16:36:33 +0000 (17:36 +0100)]
pod/perlhacktips.pod: remove some outdated portability notes

6 years agoRely on C89 <string.h>
Aaron Crane [Sat, 14 Oct 2017 14:26:48 +0000 (16:26 +0200)]
Rely on C89 <string.h>

This requires a corresponding change in the metaconfig units.

6 years agoDon't attempt to use non-standard <memory.h>
Aaron Crane [Sat, 14 Oct 2017 14:10:31 +0000 (16:10 +0200)]
Don't attempt to use non-standard <memory.h>

It's only needed on systems without C89 <string.h>, which we rely on anyway.

6 years agoRely on C89 <assert.h>
Aaron Crane [Sat, 14 Oct 2017 13:47:10 +0000 (15:47 +0200)]
Rely on C89 <assert.h>

6 years agoRely on C89 <math.h>
Aaron Crane [Sat, 14 Oct 2017 13:20:33 +0000 (15:20 +0200)]
Rely on C89 <math.h>

This requires a corresponding change in the metaconfig units.

6 years agoNever attempt to redeclare standard functions
Aaron Crane [Sat, 14 Oct 2017 13:11:22 +0000 (15:11 +0200)]
Never attempt to redeclare standard functions

6 years agoDon't attempt to define or use STANDARD_C
Aaron Crane [Sat, 14 Oct 2017 12:43:38 +0000 (14:43 +0200)]
Don't attempt to define or use STANDARD_C

We rely on a C89 implementation anyway.

6 years agoRely on C89 NULL
Aaron Crane [Sat, 14 Oct 2017 12:39:07 +0000 (14:39 +0200)]
Rely on C89 NULL

6 years agoDon't declare C89 realloc()
Aaron Crane [Sat, 14 Oct 2017 12:03:01 +0000 (14:03 +0200)]
Don't declare C89 realloc()

The declaration is actually for PerlMem_realloc(), which is a macro for
either realloc() or an indirection through the interpreter struct, depending
on configuration — see iperlsys.h. If it's the indrection, this declaration
will be a syntax error, so it must be in fact plain old realloc().

The declaration is guarded with HAS_REALLOC_PROTOTYPE, which isn't actually
defined or consulted anywhere else in the codebase.

Since we require C89, there's no need for this — we #include <stdlib.h>, and
therefore can assume realloc() exists.

6 years agoRely on C89 strerror()
Aaron Crane [Sat, 14 Oct 2017 09:57:51 +0000 (11:57 +0200)]
Rely on C89 strerror()

This requires a corresponding change to the metaconfig units.

6 years agoutil.h: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 09:15:04 +0000 (11:15 +0200)]
util.h: simplify cpp conditionals

6 years agoutil.c: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 09:09:26 +0000 (11:09 +0200)]
util.c: simplify cpp conditionals

6 years agothread.h: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 08:56:37 +0000 (10:56 +0200)]
thread.h: simplify cpp conditionals

6 years agosv.c: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 08:52:05 +0000 (10:52 +0200)]
sv.c: simplify cpp conditionals

6 years agoregen/reentr.pl: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 08:48:10 +0000 (10:48 +0200)]
regen/reentr.pl: simplify cpp conditionals

6 years agopp_sys.c: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 08:42:16 +0000 (10:42 +0200)]
pp_sys.c: simplify cpp conditionals

6 years agopp_pack.c: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 08:07:18 +0000 (10:07 +0200)]
pp_pack.c: simplify cpp conditionals

6 years agopp_hot.c: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 07:55:26 +0000 (09:55 +0200)]
pp_hot.c: simplify cpp conditionals

6 years agopp_ctl.c: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 07:53:41 +0000 (09:53 +0200)]
pp_ctl.c: simplify cpp conditionals

6 years agopp.c: simplify cpp conditionals
Aaron Crane [Sat, 14 Oct 2017 07:51:50 +0000 (09:51 +0200)]
pp.c: simplify cpp conditionals

6 years agoperlio.c: simplify cpp conditionals
Aaron Crane [Fri, 13 Oct 2017 16:16:16 +0000 (18:16 +0200)]
perlio.c: simplify cpp conditionals

6 years agoperl.h: simplify cpp conditionals
Aaron Crane [Fri, 13 Oct 2017 16:11:58 +0000 (18:11 +0200)]
perl.h: simplify cpp conditionals

6 years agoDrop support for the hp9000s500 cpp symbol
Aaron Crane [Fri, 13 Oct 2017 15:42:54 +0000 (17:42 +0200)]
Drop support for the hp9000s500 cpp symbol

This includes changed metaconfig units which drop support in the same way.

https://en.wikipedia.org/wiki/HP_9000 :

> The HP 9000 brand was introduced in 1984 to encompass several existing
> technical workstation models previously launched in the early 1980s. […]
> The Series 500s were based on the HP FOCUS microprocessor. […] The 520 was
> a complete workstation with built-in keyboard, display, 5.25-inch floppy
> disk, and optional thermal printer and 5 MB hard disk. […] The processors
> in the original Series 500s ran at 20 MHz, and could reach a benchmark
> speed of 1 MIPS.

https://en.wikipedia.org/wiki/HP_FOCUS :

> The Hewlett-Packard FOCUS microprocessor, launched in 1982, was the
> first commercial, single chip, fully 32-bit microprocessor available on
> the market. […] The FOCUS […] was a stack architecture, with over 220
> instructions (some 32 bits wide, some 16 bits wide), a segmented memory
> model, and no general purpose programmer-visible registers.

6 years agoDelete useless references to DG/UX
Aaron Crane [Fri, 13 Oct 2017 15:24:42 +0000 (17:24 +0200)]
Delete useless references to DG/UX

6 years agoperl.c: simplify cpp conditionals
Aaron Crane [Fri, 13 Oct 2017 15:17:15 +0000 (17:17 +0200)]
perl.c: simplify cpp conditionals

6 years agoopcode.pl: simplify cpp conditionals
Aaron Crane [Fri, 13 Oct 2017 15:07:13 +0000 (17:07 +0200)]
opcode.pl: simplify cpp conditionals

This affects the generated opcode.h.