[perl #122107] test that BEGIN blocks with errors don't remain named subs
[perl #122107] ensure that BEGIN blocks with errors don't remain named subs
perldelta for 2806bfd899e5, 3969ff3f8e4b
PATCH: [perl #121930] Bleadperl breaks MDOOTSON/Wx

The root cause of this issue is that XS code or the libraries it calls
is changing the locale behind Perl's back so that the decimal point
character is not a dot.  Version number parsing relies on it being a
dot.

This patch fixes the problem by retrieving the current locale just
before version number parsing, and updating Perl's records if the locale
has changed away from what is expected.  Given accurate records, the
pre-existing call to the STORE_NUMERIC_LOCAL_SET_STANDARD macro will
do what it's supposed to do, and change the locale so that the dot is
the radix character for the version number parsing.

After the parsing is done, the pre-existing call to the
RESTORE_NUMERIC_LOCAL macro will restore properly, but see below

This patch should be suitable for both 5.20.1 and 5.21 (though the SHA-1
value in the porting/customize.dat will have to be adjusted because the
files aren't otherwise identical).  But there is a fundamental
difference between the releases.  In 5.20.X, Perl does not attempt to
keep the radix character a dot at almost all times (though it
initializes things so it is a dot, overriding any environmental settings
to the contrary).  This leads to known non-regression bugs in 5.20
because very little XS code can cope with a non-dot.  To fix this, Perl
has changed the macros in 5.21 so that the result after the
RESTORE_NUMERIC_LOCAL is that the current locale will have a dot.  This
will fix those long-standing bugs where XS code expecting a dot fails
should it be mashed up with modules that change it to something else.
But this will break the relatively few modules that want it the other
way.  So it has been done early in 5.21 to give things a chance to
settle down.

The extra {} braces around the code that calls the macros is because
STORE_NUMERIC_LOCAL_SET_STANDARD declares a variable, and so must be
within the declarations area of a block for C89 compilers.  (I myself
would not write a macro that does this without indicating so in its
name.)
t/run/locale.t: Improve skip message

Better wording uggested by H.Merijn Brand
op/.stat.t: fix race condition

A test was checking that stat on FILEHANDLE and lstat on *FILEHANDLE{IO}
gave the same results. It was using STDOUT as the filehandle, but since
this can be modified by other processes during parallel testing, a race
condition is possible.

Open a file instead to get reliability.
fix fix for stat.t on win32

My previous commit made a test open a file, then delete it. It should of
course have closed the file before deleting it. On Linux this is just bad
manners, but on Win32 it actively fails.
[perl #46947] Parse method-BLOCK arguments as a term

(C.f. bug #114222 and commit 52d0e95b, which did the same thing
for ‘use’.)

When parsing the arguments following a method name and a block (for
‘method { $obj } LIST‘ syntax), the lexer was using heuristics to
determine whether an opening brace was a hash constructor or a block,
as it does at the beginning of a statement.  In every case in which it
determined it was a block, the parser would them throw a syntax error.

In this case, the lexer should not be trying to guess, since we *know*
it can only be a hash here.

This was the result:

$ perl -e 'method {$obj} {$foo=>undef}'
syntax error at -e line 1, near "} {"
Execution of -e aborted due to compilation errors.

Now we get this:

$ ./miniperl -e 'method {$obj} {$foo=>undef}'
Can't call method "method" on an undefined value at -e line 1.

as expected.
For older clang versions put back -Wno-unused-value.

Logical revert of b679cac0, but redone.

Apple versions only for now; situation on Linux side unknown.
Remove compiler warning spam on dos-djgpp
locale.c: Use PERL_UNUSED_RESULT

The previous way to suppress messages wasn't working for all gcc
versions.  Spotted by Jarkko Hietaniemi.
locale.c: Clarify comment
Stop defined(aassign) from being an error

(See the thread starting at
<20140813010036.15038.qmail@lists-nntp.develooper.com>.)

This commit changed the message 'defined(@...) is deprecated' into
a hard error:

commit e35475dec7197e291306173beba241d4e43bd5b2
Author: Karl Williamson <khw@cpan.org>
Date:   Mon Jun 16 18:56:44 2014 -0600

    Fatalize defined(@) and defined{%)

As I pointed out a couple of years (?) ago, this warning was also
showing up in places that did not involve checking the definedness of
an array; namely, defined(any list assignment):

$ perl -we '$_ = defined(my($a,$b)=3)'
defined(@array) is deprecated at -e line 1.
        (Maybe you should just omit the defined()?)

While checking that a list assignment evaluated in scalar context is
useless, as the result (a number) will always be defined, there is no
reason why this code should be any more invalid than ‘rand() > -1’ or
‘defined(time)’.  But now it has inadvertently become a hard error.

This commit simply removes the error for defined(aassign), under the
possibly false assumption that such a mistake will be rare, so it is
not worth clutting up perl itself with a special case for it.  Whether
that assumption is true remains to be seen.  In any case, in the
absence of any data, smaller is better, is it not?
Configure scan for the kind of long double we have

(Somewhat like quadkind, but for the format of the long double)
Configure scan for ldexpl
Perl_ldexp is one of ldexpl, scalbnl, or ldexp
Hexadecimal float sprintf, for perl #122219

Do not use the system sprintf since %a/%A is C99 (which we do not
require), and even if we did, there is room for interpretation
(for example whether to print trailing zeros or not) which means
that existing implementations will inevitably differ.

For the most common case, 64-bit doubles of IEEE 754, use first
frexp to extract the exponent, and then ldexp to scale the result
to a 64-bit unsigned integer.

For long doubles (80-bit or 128-bit) we look directly at the mantissa
(also known as fraction, or significand) bytes, and their 4-bit nybbles,
and extract them in correct order.

Since we bypass system printf, we need to do our own aligning, filling,
rounding, and other printf logic.
Hexadecimal float literals, for perl #122219

Do not use system strtod/strtold since its C99 (which we do not require).

If we can fit the mantissa bits of a NV to a UV (which is the case for
the most common format, 64-bit IEEE 754 double, which has 52 mantissa bits)
we will use that, and only in the end convert to NV.  If we cannot fit
the bits, accumulate the bits incrementally to a NV.
perldata: Fix too long verbatim lines
Add sync_locale()

This trivial function is to be used by XS code when it changes the
program's locale.  It hides the details from that code of what needs to
be done, which could change in the future.