Fix per-hash hash order dependency bug in version.pm

If we make each hash have its own keyorder then this test will fail
pretty regularly. Fixing it to get sorted keys from Dumper for the
relevent test prevents this failure.
Lower version.pm version

Commit 4a7557453 increased the version when modifying a test, but
without updating other tests that check the version number.

Since modifying a test does not affect what gets installed, it was
not actually necessary to change the version number.
Add SS_ADD_* macros and replace most SSPUSH* uses

The current idiom for adding an entry to the savestack is

    SSCHECK(3);
    SSPUSHINT(...);
    SSPUSHPTR(...);
    SSPUSHUV(SAVEt_...);

Replace this with a new idiom:

    {
        dSS_ADD;
        SS_ADD_INT(...);
        SS_ADD_PTR(...);
        SS_ADD_UV(SAVEt_...);
        SS_ADD_END(3);
    }

This is designed to be more efficient.

First, it defines some local vars, and defers updating PL_savestack_ix
to the end.

Second, it performs the 'is there space on the stack' check *after*
pushing. Doing the check last means that values in registers will have
been pushed and no longer needed, so don't need saving around the call to
grow. Also, tail-call elimination of the grow() can be done. These changes
reduce the code of something like save_pushptrptr() to half its former
size.

Of course, doing the size check *after* pushing means we must always
ensure there are SS_MAXPUSH free slots on the savestack */
save_int/i32 inline the long version

Both these functions were structured as

    if (int will fit in type)
	SS_ADD(...);
    else
	save_pushi32ptr(...)

Inline the call of the "long" version of the save. With refactoring, the
machine code (x86_64, gcc -O2) is no larger than before, and saves time
on the long version.
refactor Perl_leave_scope

This is a large and hot function. The main problem with it is that
there is code to pop a few args repeated in just about every branch.
Also, there are a whole bunch of local vars (sv, av, hv, gv etc)
that are never all used simultaneously, but are really just there for
casting convenience. Together, they defeat the compiler's register
allocation algorithms (well, they did for gcc anyway).

We fix this by just declaring three general vars, arg0,1,2 of type ANY, and
move the popping code to above the switch(). We sort the SAVEt_*
indices in order of number of args, so it's quick to determine how many
args we need to pop for a particular type.

Together with the previous commits which added the SS_ADD_* macros, this
reduces the size of scope.o (-O2, gcc x86_64) by about 9% (threaded)
or 17% (unthreaded), and seems to speed up simple loops / function calls
by around 5%.
Optimise magic handling in save* and leave_scope

There are several places that have code similar to

    if (SvMAGICAL(sv)) {
        PL_localizing = 2;
        SvSETMAGIC(sv)
        PL_localizing = 0;
    }

The condition is sub-optimal (it should only test for set magic), and the
SvSETMAGIC repeats a similar test.
Other places didn't have the outer condition, so they set PL_localizing
twice even when not needed.
make SvREFCNT_dec() more efficient

Historically, SvREFCNT_dec was just

    #define SvREFCNT_dec(sv)        sv_free((SV*)(sv))

then in 5.10.0, for GCC, the macro was partially inlined, avoiding a
function call for the refcnt > 1 case. Recently, the macro was turned into
an inline function, providing the function-call avoidance to other
platforms too. However, the macro/inline-function is quite big, and
appears over 500 times in the core source. Its action is logically
equivalent to:

    if (sv) {
        if (SvREFCNT(sv) > 1)
            SvREFCNT(sv)--;
        else if (SvREFCNT == 1) {
            // normal case
            SvREFCNT(sv)--;
            sv_free2(sv);
        }
        else {
            // exceptional case
            sv_free(sv);
        }
    }

Where sv_free2() handles the "normal" quick cases, while sv_free()
handles the odd cases (e,g. a ref count already at 0 during global
destruction).

This means we have to plant code that potentially calls two different
subs, over 500 times.

This commit changes SvREFCNT_dec and sv_free2() to look like:

    PERL_STATIC_INLINE void
    S_SvREFCNT_dec(pTHX_ SV *sv)
    {
        if (sv) {
            U32 rc = SvREFCNT(sv);
            if (rc > 1)
                SvREFCNT(sv) = rc - 1;
            else
                Perl_sv_free2(aTHX_ sv, rc);
        }
    }

    Perl_sv_free2(pTHX_ SV *const sv, const U32 rc)
    {
        if (rc == 1) {
	    SvREFCNT(sv) = 0;
            ... do sv_clear, del_SV etc ...
            return
        }
        /* handle exceptional rc == 0 */
        ...
    }

So for the normal cases (rc > 1, rc == 1) there is the same amount of
testing and function calls, but the second test has been moved inside
the sv_free2() function.

This makes the perl executable about 10-15K smaller, and apparently a bit
faster (modulo the fact that most benchmarks are just measuring noise).

The refcount is passed as a second arg to sv_free2(), as on platforms
that pass the first few args in registers, it saves reading sv->sv_refcnt
again.
add SvREFCNT_dec_NN()

Like SvREFCNT_dec(), but skips the not null check, making code potentially
smaller and faster.

Also as proof of concept, updates the SvREFCNT_dec's in scope.c where
it's obvious the value can't be NULL. There are still 500+ uses in the
perl core that need evaluating!
Avoid some doubled escapes in tovmsspec.

Since it's impossible to guarantee a filename is never makes
multiple trips through the Unix-to-VMS converter, it's important
not to escape characters that have already been escaped.
silence some clang warnings

principally, proto.h was sometimes being included twice - once before
a fn decl, and once after - giving rise to a 'decl after def' warning.

Also, S_croak_memory_wrap was declared static in every source file, but
not used in some. So selectively disable the unused-function warning.
silence some non-clang warnings

ccde85316a0db149f30359ebfdf031ef602b0344 added some

    #pragma clang ...

lines to shut up clang.
This caused gcc to give voluminous 'unknown pragma "clang"' output.

Sigh.

Hopefully now fixed, although it all seems very cumbersome.
sigtrap.pm: Avoid lexical $_

my $_ is about to be deprecated.

It has been using it since commit 972fc2eb7a to avoid modifying a
read-only argument.  Using @{[...]} instead works, too.
Increase $sigtrap::VERSION to 1.07
encoding.t: Skip 2 tests under debugging
Deprecate lexical $_

See tickets #114020 and #75598 for why.

The changes to tests in cpan/Text-Tabs have been submitted upstream
at rt.cpan.org #81698.
Mention in more places that my $_ is deprecated
embed.fnc: Explain how X is used for public macros

I don’t know whether my message to the list
(<20121204012335.29409.qmail@lists-nntp.develooper.com>) was noticed.

In any case, here it is for posterity.  Hopefully this will save
others from finding this out the hard way as I had to (making mistakes
and having others come and correct them).
Fix misparsing of maketext strings.

Case 61251: This commit fixes a misparse of maketext strings that could
lead to arbitrary code execution.  Basically, maketext was compiling
bracket notation into functions, but neglected to escape backslashes
inside the content or die on fully-qualified method names when
generating the code.  This change escapes all such backslashes and dies
when a method name with a colon or apostrophe is specified.
add a note about security concerns in Storable

Storable is not a great way to pass data back and forth across security
boundaries.  We have discussed the security implications of the
auto-loading and auto-blessing behaviors in Storable in the past, both
on the perl5-porters mailing list and at various conferences.  Somehow,
though, these "well-known" probably have never actually been put into
the documentation.  This patch corrects that.

The original version of this patch included a recommendation to use
Sereal in its most stringent configuration, but that text was removed
for the time being by Ricardo Signes, who hopes to add it back once
Sereal has been in public use for just a bit longer.
Update Locale-Codes to CPAN version 3.24

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>