This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Brian Fraser [Fri, 30 May 2014 23:28:18 +0000 (01:28 +0200)]
Added several missing PERL_UNUSED_RESULT()
Brian Fraser [Fri, 30 May 2014 23:24:52 +0000 (01:24 +0200)]
Removed set_emergency_buffer from malloc.c
This was added in 2003, but never used.
Brian Fraser [Fri, 30 May 2014 23:19:27 +0000 (01:19 +0200)]
Mark several functions with __attribute__noreturn__
Namely, die_nocontext, die, die_sv, and screaminstr. They
all croak and never return, so let's mark them as non-returning.
Brian Fraser [Fri, 30 May 2014 23:16:46 +0000 (01:16 +0200)]
Cast %p arguments to (void*)
These were all part of debugging statements; the commit silences
a chunk of warnings under -Wformat
Brian Fraser [Fri, 30 May 2014 23:15:42 +0000 (01:15 +0200)]
Adding missing SVfARG() invocations
This silences a chunk of warnings under -Wformat
Brian Fraser [Fri, 30 May 2014 23:13:26 +0000 (01:13 +0200)]
Adding missing HEKfARG() invocations
This silences a chunk of warnings under -Wformat
Brian Fraser [Fri, 30 May 2014 23:10:20 +0000 (01:10 +0200)]
Protect against ptrdiff_t not being available.
This is primarily for pedantic builds; ptrdiff_t is now standard,
and had already been in use in the core without guards.
Karl Williamson [Thu, 12 Jun 2014 21:15:44 +0000 (15:15 -0600)]
POSIX.xs: Fix typo.
I haven't gotten used to my new keyboard, and missed this lowercase
letter that should have been uppercase. Spotted by Dennis Kaarsemaker
Karl Williamson [Thu, 12 Jun 2014 20:35:45 +0000 (14:35 -0600)]
Fix some compilation warnings
After commits
d6ded95025185cb1ec8ca3ba5879cab881d8b180 and
130c5df3625bd130cd1e2771308fcd4eb66cebb2, there are some compilation
warnings if not all locale categories are used.
Karl Williamson [Thu, 12 Jun 2014 20:31:24 +0000 (14:31 -0600)]
pp.c: Fix Win32 compilation problems
Commit
130c5df3625bd130cd1e2771308fcd4eb66cebb2 introduced errors into
Windows (at least) compilations because it used #if's in the middle of
apparent function calls, but these were really macros that turned the
function call foo() into a call of Perl_foo(), and so we were doing
an #if from within a #define which is not generally legal.
Karl Williamson [Thu, 12 Jun 2014 19:26:24 +0000 (13:26 -0600)]
Allow to compile if don't have LC_CTYPE etc defined
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.
Karl Williamson [Thu, 12 Jun 2014 19:24:13 +0000 (13:24 -0600)]
regen podcheck.t db
Several recent commits just changed the db manually, and in doing so
made incorrect changes. It should instead be regenerated by machine
with the -regen parameter.
Karl Williamson [Thu, 12 Jun 2014 18:06:02 +0000 (12:06 -0600)]
pp.c: Vertically stack ternary operators
This is for comprehensibility and to make a future commit easier.
Matthew Horsfall (alh) [Thu, 12 Jun 2014 17:05:35 +0000 (13:05 -0400)]
perldelta for 470dd22
Matthew Horsfall (alh) [Thu, 12 Jun 2014 11:01:57 +0000 (07:01 -0400)]
perldelta for 7fefc6c, dcccc8f, f83c603
Tony Cook [Thu, 12 Jun 2014 05:24:32 +0000 (15:24 +1000)]
Tony Cook [Thu, 12 Jun 2014 05:09:53 +0000 (15:09 +1000)]
some perldelta fixes
- move the utf8::downgrade() note out of the middle of the perl5db.pl
entry
- give the Unicode::Collate entry back its =item
- move the Hash::Util entry into alphabetical order
Tony Cook [Thu, 12 Jun 2014 04:06:25 +0000 (14:06 +1000)]
bump $VERSION for PerlIO-encoding, PerlIO-mmap, PerlIO-scalar, OS2-Process
Dagfinn Ilmari Mannsåker [Mon, 9 Jun 2014 17:53:36 +0000 (18:53 +0100)]
Change sv_catpvn(…, "…", …) to sv_catpvs(…, "…")
The dual-life dist affected uses Devel::PPPort, so can safely use
sv_catpvs() even though it wasn't added until Perl v5.8.9.
Tony Cook [Thu, 12 Jun 2014 03:50:22 +0000 (13:50 +1000)]
test for the Data::Dumper bug fixed by "Change newSVpvn("…", …) to newSVpvs("…")"
Dagfinn Ilmari Mannsåker [Fri, 4 Oct 2013 15:48:40 +0000 (16:48 +0100)]
Change newSVpvn("…", …) to newSVpvs("…")
The dual-life dists affected use Devel::PPPort, so can safely use
newSVpvs() even though it wasn't added until Perl v5.8.9.
kafka [Thu, 12 Jun 2014 01:18:09 +0000 (21:18 -0400)]
Bring a few lines in Storable.pm under 80 cols.
Remove entry for storable in known_pod_issues.
Increment Storable version number.
For: https://rt.perl.org/Ticket/Display.html?id=121861
Daniel Dragan [Mon, 9 Jun 2014 09:50:19 +0000 (05:50 -0400)]
SvREFCNT_dec_NN in pp_require
Some compilers (GCC) will inline+optimize this, some don't (Visual C). Make
it clear to not check for null twice.
James E Keenan [Thu, 12 Jun 2014 00:57:39 +0000 (20:57 -0400)]
Remove entries for threads.pm and CoreList.pod.
Follow up to earlier POD corrections. See: RT #121873 and #121822.
kafka [Mon, 12 May 2014 17:13:43 +0000 (19:13 +0200)]
Bring a few lines in SelfLoader.pm under 80 cols.
Bump version number in SelfLoader.pm.
Remove 'selfloader' entry from known_pod_issues.
For: https://rt.perl.org/Ticket/Display.html?id=121850
Jarkko Hietaniemi [Wed, 11 Jun 2014 22:41:07 +0000 (18:41 -0400)]
C backtrace tweaks.
Rename the environment variable that triggers the backtrace before
warns and croaks as PERL_USE_C_BACKTRACE_ON_ERROR (and correspondingly,
the define as USE_C_BACKTRACE_ON_ERROR).
Pod cleanups and updates, and move the needed #includes from perl.h
to util.c since that's the only place where they are needed.
Matthew Horsfall (alh) [Thu, 12 Jun 2014 00:10:22 +0000 (20:10 -0400)]
perldelta for 808cb9e
Matthew Horsfall (alh) [Thu, 12 Jun 2014 00:05:37 +0000 (20:05 -0400)]
perldelta for 30a1535
Matthew Horsfall (alh) [Wed, 11 Jun 2014 23:53:25 +0000 (19:53 -0400)]
perldelta for 2d8eb85
Matthew Horsfall (alh) [Wed, 11 Jun 2014 23:47:14 +0000 (19:47 -0400)]
perldelta for 53cb238
Matthew Horsfall (alh) [Wed, 11 Jun 2014 23:40:17 +0000 (19:40 -0400)]
perldelta for 8be3c4c
Matthew Horsfall (alh) [Wed, 11 Jun 2014 23:10:44 +0000 (19:10 -0400)]
perldelta for e5a8a0f.
Also update the perldelta template since it mentioned x2p
Brian Fraser [Tue, 3 Jun 2014 16:58:50 +0000 (18:58 +0200)]
Removed NeXT support
Chris 'BinGOs' Williams [Wed, 11 Jun 2014 17:03:40 +0000 (18:03 +0100)]
Update Test-Harness to CPAN version 3.32
[DELTA]
3.32 2014-06-11
- Remove harness_class from argument hash in T::H::E (Leon Timmermans)
Matthew Horsfall (alh) [Wed, 11 Jun 2014 13:54:20 +0000 (09:54 -0400)]
perldelta for be075ca, 037ab3f
Matthew Horsfall (alh) [Wed, 11 Jun 2014 13:39:21 +0000 (09:39 -0400)]
perldelta for 461a975
Matthew Horsfall (alh) [Wed, 11 Jun 2014 13:30:55 +0000 (09:30 -0400)]
perldelta for coverity fixes
Matthew Horsfall (alh) [Wed, 11 Jun 2014 13:23:16 +0000 (09:23 -0400)]
perldelta for b3cf482, 4fa715f
Matthew Horsfall (alh) [Wed, 11 Jun 2014 12:44:20 +0000 (08:44 -0400)]
perldelta for ae07d0f
Matthew Horsfall (alh) [Wed, 11 Jun 2014 12:38:12 +0000 (08:38 -0400)]
perldelta for bd47baf
Matthew Horsfall (alh) [Wed, 11 Jun 2014 12:28:43 +0000 (08:28 -0400)]
perldelta for 725995b
H.Merijn Brand [Wed, 11 Jun 2014 07:45:50 +0000 (09:45 +0200)]
[perl #121585] Configure shouldn't write source tree
H.Merijn Brand [Wed, 11 Jun 2014 07:45:44 +0000 (09:45 +0200)]
Fix cbacktrace
H.Merijn Brand [Wed, 11 Jun 2014 07:09:04 +0000 (09:09 +0200)]
Fix i_bfd
The final i_bfd statement was a wrong copy-paste
re-order Configure: in preparation of backporting this change and
integration of another, some reorder is required
Tony Cook [Wed, 11 Jun 2014 04:52:26 +0000 (14:52 +1000)]
Andrew Fresh is now a perl author
Andrew Fresh [Sat, 31 May 2014 17:30:40 +0000 (10:30 -0700)]
Default to using OpenBSD's malloc
While perl bug #75742 successfully convinced p5p that the speed of the
OpenBSD malloc was a good enough reason to instead use perl's malloc,
the system malloc has many security features that OpenBSD users expect.
The system malloc has always been used in the base system perl.
While the is slower than the perl malloc, the OpenBSD project believes
the tradeoff is worth it and would prefer that users who need the speed
specifically ask for it.
Andrew Fresh [Sun, 1 Jun 2014 18:00:39 +0000 (11:00 -0700)]
Correct architectures and versions for hints
Over time, OpenBSD has kept this up-to-date locally without enough
patches going upstream.
This should bring perl in sync with reality.
Tony Cook [Wed, 11 Jun 2014 01:29:55 +0000 (11:29 +1000)]
correct handling of buffer sizes for POSIX::strxfrm()
There were two problems:
1) we allocated srclen*4+1, but then only supplied srclen to the first
strxfrm() call, which meant we could be "failing" the strfrm()
unnecessarily.
2) the return value of the first strxfrm() was being handled correctly,
the contents of the output buffer supplied to strxfrm() is indeterminate
when the return value is the buffer size or larger, so we should
make a new call then.
Jarkko Hietaniemi [Wed, 11 Jun 2014 00:18:50 +0000 (20:18 -0400)]
Locale tests assumed POSIX, not true in minitest.
Tony Cook [Tue, 10 Jun 2014 00:39:49 +0000 (10:39 +1000)]
perldelta for
7ac929242683
Tony Cook [Tue, 3 Jun 2014 06:56:40 +0000 (16:56 +1000)]
add a warning for using the :win32 PerlIO layer
Reini Urban [Tue, 10 Jun 2014 00:15:23 +0000 (10:15 +1000)]
[perl #121733] fix t/op/stat.t 96 for windows
Tony: fixes for minitest
Reini Urban [Mon, 9 Jun 2014 06:55:09 +0000 (16:55 +1000)]
[perl #121732] fix t/op/filetest.t for windows
Tony: fix for minitest
David Mitchell [Mon, 9 Jun 2014 17:29:29 +0000 (18:29 +0100)]
bump Benchmark version
(whoops, I failed to run a full make test before my last commit)
David Mitchell [Mon, 9 Jun 2014 10:41:22 +0000 (11:41 +0100)]
Benchmark.pm: avoid long walltime on calibration
RT #122003
runloop() in Benchmark.pm does the equivalent of the following:
$t = (times)[0];
while ($t == (times)[0]) {}
so that it finishes in a position where the user CPU counter has just
incremented.
This is all well and good, but on some platforms (specifically OpenBSD
running under VirtualBox), the system CPU burned each time round the loop
to get times() is far greater than the user CPU burned. This can cause the
loop to run for minutes consuming system CPU until enough user CPU has
been burned to tick the user CPU counter.
The fix in this commit is to replace the empty body of the while loop with
something that does a gradually increasing amount of busy work.
Craig A. Berry [Sun, 8 Jun 2014 23:14:57 +0000 (18:14 -0500)]
Eliminate VMS-specific code in PerlIOStdio_fill.
The same logic but with more safety checks is already defined for
PerlSIO_ungetc in iperlsys.h, so DRY says we should just use that.
Also, that definition in iperlsys.h really depends on the library
we are using, not the compiler. And there is only one viable C
library on VMS and it ships with the OS, so it's really just an
OS dependency.
N.B. While it may be something of a fool's errand to maintain the
stdio layer, deleting redundant code can only be a good thing,
possibly enabling further refactoring and clean-up.
Daniel Dragan [Thu, 5 Jun 2014 03:17:39 +0000 (23:17 -0400)]
remove 1 read of interp var from PUSHMARK
PL_markstack_ptr was read once to do the ++ and comparison. Then after
the markstack_grow call, or not, depending on the branch. The code reads
PL_markstack_ptr a 2nd time. It has to be reread in case (or always does)
markstack_grow reallocs the mark stack. markstack_grow has a void retval.
That is a waste of a register. Let us put it to use to return the new
PL_markstack_ptr. In markstack_grow the contents that will be assigned to
PL_markstack_ptr are already in a register. So let the I32* flow out from
markstack_grow to its caller.
In VC2003 32 bit asm, mark_stack_entry is register eax. The retval of
markstack_grow is in eax. So the assignment "=" in
"mark_stack_entry = markstack_grow();" has no overhead. Since the other,
not extend branch, is function call free,
"(mark_stack_entry = ++PL_markstack_ptr)" assigns to eax. Ultimatly with
this patch a 3 byte mov instruction is saved for each instance of PUSHMARK,
and 1 interp var read is removed. I observed 42 callers of markstack_grow
with my disassembler, so theoretically 3*42 bytes of machine code was
removed for me.
Perl_pp_pushmark dropped from 0x2b to 0x28 bytes of x86 VC 2003
machine code. [perl #122034]
Thomas Sibley [Thu, 5 Jun 2014 17:17:42 +0000 (10:17 -0700)]
Document that "exec LIST" and "system LIST" may fall back to the shell on Win32
As noted on p5p [1] and subsequently discussed [2].
The Win32 functions for handling exec() and system() attempt to
specially handle shell builtins by catching spawn failures and
re-attempting the spawn using the shell with the given argument LIST.
If "exec PROGRAM LIST" syntax (or the equivalent for system()) is used,
then only the specified PROGRAM will ever be run (although Perl will
still try the spawn twice on Win32 if PROGRAM doesn't exist or otherwise
can't be executed).
[1] http://www.nntp.perl.org/group/perl.perl5.porters/2014/04/msg214556.html
[2] http://www.nntp.perl.org/group/perl.perl5.porters/2014/04/msg214564.html
James E Keenan [Sun, 8 Jun 2014 15:18:58 +0000 (11:18 -0400)]
Small grammatical fix.
Jarkko Hietaniemi [Tue, 3 Jun 2014 12:39:56 +0000 (08:39 -0400)]
Add C backtrace API.
Useful for at least debugging.
Supported in Linux and OS X (possibly to some extent in *BSD).
See perlhacktips for details.
Chris 'BinGOs' Williams [Sat, 7 Jun 2014 22:08:32 +0000 (23:08 +0100)]
Update Test-Harness to CPAN version 3.31
[DELTA]
3.31 2014-06-07
- Implement external rulesfile for TAP::Harness (David Golden)
- Add harness_class argument to TAP::Harness::Env (Leon Timmermans)
- Make prove respect environmental variables #28 (Leon Timmermans)
Chris 'BinGOs' Williams [Sat, 7 Jun 2014 22:07:09 +0000 (23:07 +0100)]
Sync autouse version for recent CPAN release
Karl Williamson [Fri, 6 Jun 2014 20:43:04 +0000 (14:43 -0600)]
locale.c: Fix uncomplemented 'if' test
Somehow the ! in this if () got dropped, and there were no tests to
catch it. Now both are remedied.
Karl Williamson [Fri, 6 Jun 2014 19:13:25 +0000 (13:13 -0600)]
POSIX.xs: Add a const to a parameter
Karl Williamson [Fri, 6 Jun 2014 19:11:55 +0000 (13:11 -0600)]
perlapi: Nit, and mention NUL for some functions
This adds the mention of embedded or terminating NULs for some functions
where it wasn't previously indicated.
Karl Williamson [Fri, 6 Jun 2014 19:08:17 +0000 (13:08 -0600)]
strftime: Set UTF-8 flag appropriately on return
The flag was only getting set if the format was in UTF-8. This looks at
the return values, and sets the flag if they are non-ASCII UTF-8 and, as
a further check, if the current locale is a UTF-8 one.
Karl Williamson [Fri, 6 Jun 2014 19:04:55 +0000 (13:04 -0600)]
PATCH: [perl #119425] strftime with %p
In a locale in which there is no a.m. nor p.m. indicator, a format with
only %p in it would print %p instead of nothing.
Karl Williamson [Fri, 6 Jun 2014 16:29:28 +0000 (10:29 -0600)]
lib/locale.t: Change acceptable fail % for Win32
Commit
375f5f0648cdf36c13cb11499b332c99c710d138 fixed the Windows ctype
functions to follow POSIX rules, so there is no need to make an
exception for them.
David Mitchell [Sat, 7 Jun 2014 13:16:21 +0000 (14:16 +0100)]
fix locale.c under -DPERL_GLOBAL_STRUCT
Craig A. Berry [Fri, 6 Jun 2014 19:12:19 +0000 (14:12 -0500)]
Correct socksizetype on VMS.
This was modified to comply with the standard in DEC C 5.0. The
last 5.x release was 5.7 in 1998 and we've long since required
at least 6.0 to build Perl. So this change is a wee bit behind
schedule.
Craig A. Berry [Fri, 6 Jun 2014 14:05:13 +0000 (09:05 -0500)]
Refactor some compiler-based hints in configure.com.
Once upon a time, there was VAX C, and there was a port of GCC
2.something that used the same library. These both only ran on VAX
and both became obsolete years ago. When DEC/Compaq/HP C came
along, it had its own library (typically referred to simply as
"the CRTL") that shipped with the operating system. It was thus
natural to determine the presence or absence of a library function
based on the compiler choice, as that implied a library choice.
But there is now no choice of library nor has been for many years.
The CRTL is it, and even a new port of GCC (which apparently exists
in some form as part of Ada Core's toolchain) would almost
certainly use it. So stop using the selected compiler to decide
whether a library function is present or not.
Chris 'BinGOs' Williams [Fri, 6 Jun 2014 15:06:43 +0000 (16:06 +0100)]
Sync ExtUtils-Install version for CPAN release
Ricardo Signes [Fri, 6 Jun 2014 01:23:58 +0000 (21:23 -0400)]
update release schedule
Karl Williamson [Thu, 5 Jun 2014 20:58:49 +0000 (14:58 -0600)]
perlapi: Place in dictionary sort order
Underscores or their lack can confuse people in finding sorted items.
Karl Williamson [Thu, 5 Jun 2014 20:29:44 +0000 (14:29 -0600)]
perlapi: Refactor placements, headings of some functions
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
Karl Williamson [Thu, 5 Jun 2014 20:22:50 +0000 (14:22 -0600)]
perlapi: Include general information
Unlike other pod handling routines, autodoc requires the line following
an =head1 to be non-empty for its text to be included in the paragraph
started by the heading. If you fail to do this, silently the text will
be omitted from perlapi. I went through the source code, and where it
was apparent that the text was supposed to be in perlapi, deleted the
empty line so it would be, with some revisions to make more sense.
I added =cuts where I thought it best for the text to not be included.
Craig A. Berry [Thu, 5 Jun 2014 20:44:52 +0000 (15:44 -0500)]
Move a VMS-specific include file in sv.c.
C++ doesn't allow pulling in rms.h smack dab in the middle of a
function like that. While we're in there, go ahead and start
using the correct __VMS macro instead of just VMS. The latter
was only necessary for VAX C, the non-C89-compliant predecessor
to DEC C that died a natural death some years ago.
Craig A. Berry [Thu, 5 Jun 2014 20:42:34 +0000 (15:42 -0500)]
A malloc cast in vms/vms.c.
C didn't notice this with standard warnings enabled, but C++ takes
vengeance, so cast appropriately.
Craig A. Berry [Thu, 5 Jun 2014 20:30:08 +0000 (15:30 -0500)]
wcs* fix-up for configure.com
VMS has had wcscmp and wcsxfrm since version 6.2 was released in
1995. None of these functions depends on what compiler we're
running, only on what the C library has, and there is only one
viable CRTL in existence in modern times, so we probably need a
further refactor to eliminate the compiler check for this whole
section.
Ricardo Signes [Thu, 5 Jun 2014 18:28:23 +0000 (14:28 -0400)]
update release schedule
Karl Williamson [Wed, 4 Jun 2014 01:46:19 +0000 (19:46 -0600)]
t/run/locale.t: Remove unnecessary setlocales()
The locale is supposed to be passed in via the environment. There is no
need to also set it explicitly.
Karl Williamson [Wed, 4 Jun 2014 01:37:45 +0000 (19:37 -0600)]
Fix Windows ctype functions
Windows doesn't follow the Posix standard for their functions like
isalnum(), isdigit(), etc. This forces compliance by changing the
macros that are the interfaces to those functions to be smarter than
just calling the raw functions.
Karl Williamson [Wed, 4 Jun 2014 00:39:40 +0000 (18:39 -0600)]
Revert "PATCH: [perl #119499] "$!" with UTF-8 flag"
This reverts commit
b17e32ea3ba5ef7362d2a3d1a433661afb897786.
With this commit, the stringification of $! will have the UTF-8 flag set
when the text is actually non-ASCII UTF-8. The reverted commit itself
reverted code that was to fix bugs with this discrepancy of the UTF-8
flag, but which caused backward-compatibility problems with existing
code.
Several things have happened in the interim which allows us to
experimentally resotre the previously reverted changes. One is that
this is early in the 5.21 cycle, and we have plenty of time to see what
negative consequences this may cause. Two is that the returned text
will only be in UTF-8 if the stringification happens within the scope of
'use locale'. This means that the negative effects won't happen for
code, like ack, that is otherwise locale unaware. Third, the 'locale'
pragma has been enhanced to allow the program to only have locale
awareness of LC_MESSAGES.
Code that needs to continue the 5.20 and earlier behavior can do the
stringification within the scopes of both 'use bytes' and 'use locale
":messages". No other Perl operations will be affected by locale; only
$! and $^E stringification. The 'bytes' pragma causes the UTF-8 flag to
not be set, just as in previous Perl releases.
Karl Williamson [Mon, 2 Jun 2014 21:56:05 +0000 (15:56 -0600)]
Use C locale for "$!" ouside 'use locale' scope
The stringification of $! has long been an outlier in Perl locale
handling. The theory has been that these operating system messages are
likely to be of use to the final user, and should be in their language.
Things like
No space left on device
Can't fork
are not something the program is likely to handle, but could be
meaningfully helpful to the end-user.
There are problems with this though. One is that many perl messages are
in English, with the $! appended to them, so that the resultant message
is of mixed language, and may need to be translated anyway. Things like
No space left on device
probably won't need the remaining portion of the message to give someone
a clear indication as to what's wrong. But there are many other
messages where both the OS error and the Perl error would be needed
togther to understand the problem. An on-line translation tool can be
used to do this.
Another problem is that it can lead to garbage coming out on the user's
terminal when the program is not expecting UTF-8, but the underlying
locale is UTF-8. This is what happens in Bug #112208, and another that
was merged with it. It's a lot harder to translate mojibake via an
online tool than English.
This commit solves that by using the C locale for messages, except
within the scope of 'use locale'. It is extremely likely that the
messages in the C locale will be English, but if not they will be ASCII,
and there will be no garbage printed. A program that says "use locale"
is indicating that it has the intelligence necessary to deal with
locales.
Karl Williamson [Mon, 2 Jun 2014 21:00:05 +0000 (15:00 -0600)]
Data::Dumper: Fix wrong #if
The code being conditionally compiled is for LC_COLLATE, not LC_NUMERIC
Karl Williamson [Mon, 2 Jun 2014 20:49:30 +0000 (14:49 -0600)]
Add parameters to "use locale"
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.
Karl Williamson [Mon, 2 Jun 2014 19:52:38 +0000 (13:52 -0600)]
numeric.c: Remove unnecessary test
The second test won't be true unless the first one is (but not vice
versa), so no need to test the first.
Karl Williamson [Mon, 2 Jun 2014 18:15:47 +0000 (12:15 -0600)]
op.c: Use macro instead of its expansion
It's better to use a pre-defined macro when available. This isn't quite
the same, as the macro is valid for both run-time and compile-time and
the code is only compile-time. In the unlikely event that this were
ever to be found to be other than negligible, a compile-time-only
version of the macro could be created.
Karl Williamson [Mon, 2 Jun 2014 02:07:30 +0000 (20:07 -0600)]
Allow dynamic lock of LC_NUMERIC
When processing version strings, the radix character must be a dot even
if we otherwise would be using some other character. vutil.c
upg_version() changes to the dot, but calls sv_catpvf() which may try to
change the character to something else. This commit introduces a way to
lock the character to a dot around the call to sv_catpvf()
vutil.c is cpan-upstream, but already blead and cpan have diverged, so
this just updates the SHA of the new version
Karl Williamson [Mon, 2 Jun 2014 01:40:12 +0000 (19:40 -0600)]
Fix up LC_NUMERIC wrap macros
perl.h has some macros used to manipulate the locale exposed for the
category LC_NUMERIC. These are currently undocumented, but will need to
be documented as the development of 5.21 progresses. This fixes these
up in several ways:
The tests for if we are in the correct state are made into macros. This
is in preparation for the next commit, which will make one of them more
complicated, and so that complication will only have to be in one place.
The variable declared by them is renamed to be preceded by an
underscore. It is dangerous practice to have a name used in a macro, as
it could conflict with a name used by outside code. This alleviates it
somewhat by making it even less likely to conflict. This will have to
be revisited when some of these macros are made part of the public API.
The tests to see if things need to change are reversed. Previously we
said we need to change to standard, for example, if the variable for
'local' is set. But both can be true at the same time if the underlying
locale is C. In this case, we only need to change if we aren't in
standard. Whether that is also local is irrelevant.
Karl Williamson [Sun, 1 Jun 2014 20:05:48 +0000 (14:05 -0600)]
Keep LC_NUMERIC in C locale, except for brief periods
This is for XS modules, so they don't have to worry about the radix
being a non-dot. When the locale needs to be in the underlying one, the
operation should be wrapped using macros for the purpose. That API may
change as we gain experience in 5.21, so I'm not including it now.
Karl Williamson [Sun, 1 Jun 2014 22:05:20 +0000 (16:05 -0600)]
numeric.c: White-space only
The previous commit added a block around this code, so indent
correspondingly.
Karl Williamson [Sun, 1 Jun 2014 22:02:24 +0000 (16:02 -0600)]
Make sure locale set right for radix parsing
I haven't found a test case this fails for in v5.20, but I'm sure there
is one. But two commits from now would fail if this wasn't done.
Karl Williamson [Mon, 2 Jun 2014 00:07:34 +0000 (18:07 -0600)]
perllocale: Wrap some text in C<...>
Karl Williamson [Sun, 1 Jun 2014 19:42:31 +0000 (13:42 -0600)]
Avoid locale function overhead
For the LC_NUMERIC locale category, one can swap between setlocale being
to "C" or to the underlying locale. Perl keeps track of the state
using two boolean variables. By testing these before calling the swap
functions, we can skip calling them if the current state is the one we
want to be in, and avoid the function call overhead, as the function
becomes a no-op if the current state is the desired one.
Karl Williamson [Fri, 16 May 2014 03:18:14 +0000 (21:18 -0600)]
'use locale' no longer ever fails.to compile
Thus we can skip the machinations we used to do to make sure things
compiled.
Karl Williamson [Fri, 16 May 2014 01:29:41 +0000 (19:29 -0600)]
Set utf8 flag properly in localeconv
Rare, but not unheard of, is for the strings returned by localeconv to
be in UTF-8. This commit looks for and sets the UTF-8 flag if they are.
so encoded.
A private function had to changed from static for this. It is renamed
to begin with an underscore to emphasize its private nature.
Karl Williamson [Fri, 16 May 2014 00:30:37 +0000 (18:30 -0600)]
Exclude undefined hash elements from localeconv()
A given platform may not have all the localeconv elements available, or
Perl may be compiled to not use them. Don't define hash elements for
the missing ones.
Karl Williamson [Fri, 16 May 2014 00:13:08 +0000 (18:13 -0600)]
Swap #if sense for localeconv()
When the else clause is trivial, and the if clause is long, It's far easier to understand if they're swapped
so the short clause and the else are right after the if.
Karl Williamson [Thu, 15 May 2014 21:40:51 +0000 (15:40 -0600)]
Localeconv() should be independent of 'use locale'
localeconv() should return the values for the underlying locale of
the program regardless of whether the calling place is within the
scope of "use locale" or not. Otherwise, it makes no sense to call it
from outside such scope, and a pure perl module that calls it on behalf
of a caller would likely get it wrong.
In earlier versions of Perl the LC_NUMERIC category was initialized to
C, but was changed by the first setlocale() anywhere in the process. It
is rare to call localeconv() without first having done a setlocale().
But to solve other bugs, future commits will keep LC_NUMERIC in the C
locale except during such operations where it should be the underlying
locale. localeconv() is such a place, so this commit is being done
before the later ones so it doesn't break.