diff options
author | Karl Williamson <khw@cpan.org> | 2014-12-18 13:29:51 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-12-29 13:52:56 -0700 |
commit | 780fcc9fd03dbbd16715e2b6ecd020f9e50b7cc7 (patch) | |
tree | e5f04281794fe574a278cbbe72d4718737c1c482 /sv.c | |
parent | a4525e789871d3846f20d0ea7d2d239c6a21a5a4 (diff) | |
download | perl-780fcc9fd03dbbd16715e2b6ecd020f9e50b7cc7.tar.gz |
Don't raise 'poorly supported' locale warning unnecessarily
Commit 8c6180a91de91a1194f427fc639694f43a903a78 added a warning message
for when Perl determines that the program's underlying locale just
switched into is poorly supported. At the time it was thought that this
would be an extremely rare occurrence. However, a bug in HP-UX -
B.11.00/64 causes this message to be raised for the "C" locale. A
workaround was done that silenced those. However, before it got fixed,
this message would occur gobs of times executing the test suite. It was
raised even if the script is not locale-aware, so that the underlying
locale was completely irrelevant. There is a good prospect that someone
using an older Asian locale as their default would get this message
inappropriately, even if they don't use locales, or switch to a
supported one before using them.
This commit causes the message to be raised only if it actually is
relevant. When not in the scope of 'use locale', the message is stored,
not raised. Upon the first locale-dependent operation within a bad
locale, the saved message is raised, and the storage cleared. I was
able to do this without adding extra branching to the main-line
non-locale execution code. This was done by adding regnodes which get
jumped to by switch statements, and refactoring some existing C tests so
they exclude non-locale right off the bat.
These changes would have been necessary for another locale warning that
I previously agreed to implement, and which is coming a few commits from
now.
I do not know of any way to add tests in the test suite for this. It is
in fact rare for modern locales to have these issues. The way I tested
this was to temporarily change the C code so that all locales are viewed
as defective, and manually note that the warnings came out where
expected, and only where expected.
I chose not to try to output this warning on any POSIX functions called.
I believe that all that are affected are deprecated or scheduled to be
deprecated anyway. And POSIX is closer to the hardware of the machine.
For convenience, I also don't output the message for some zero-length
pattern matches. If something is going to be matched, the message will
likely very soon be raised anyway.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -14588,6 +14588,9 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, /* Unicode features (see perlrun/-C) */ PL_unicode = proto_perl->Iunicode; + /* Should we warn if uses locale? */ + PL_warn_locale = proto_perl->Iwarn_locale; + /* Pre-5.8 signals control */ PL_signals = proto_perl->Isignals; |