summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-03-27 22:18:01 -0600
committerKarl Williamson <khw@cpan.org>2015-03-27 22:34:21 -0600
commit008e8e82d7383361068156624879df7566121878 (patch)
treeed4ce2ee78b0f0ae375a3bee84ba9848b9814a0f /perl.h
parent2b79cfef7518ea0ccd16f1b34ef8dd2b25877f35 (diff)
downloadperl-008e8e82d7383361068156624879df7566121878.tar.gz
Don't raise Wide char warning in UTF-8 locale
This belongs in the category of "I can't believe I did that." Commit 613abc6d16e99bd9834fe6afd79beb61a3a4734d introduced warning messages when a multi-byte character is operated on in a single byte locale. But the two macros introduced fail to suppress said messages when in a multi-byte locale where the operation is perfectly valid. This partially solves v5.22 blocker [perl #123527]. But it could still fail if the test files are called from within a non-UTF-8 locale. I will issue a pull request for fixing that.
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/perl.h b/perl.h
index 50eca37226..dceae8fdff 100644
--- a/perl.h
+++ b/perl.h
@@ -5826,12 +5826,17 @@ typedef struct am_table_short AMTS;
* argument; the 2nd, is a pointer to the first byte of the UTF-8 encoded
* string, and an end position which it won't try to read past */
# define _CHECK_AND_OUTPUT_WIDE_LOCALE_CP_MSG(cp) \
- Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE), \
- "Wide character (U+%"UVXf") in %s", (UV) cp, OP_DESC(PL_op));
+ STMT_START { \
+ if (! PL_in_utf8_CTYPE_locale && ckWARN(WARN_LOCALE)) { \
+ Perl_warner(aTHX_ packWARN(WARN_LOCALE), \
+ "Wide character (U+%"UVXf") in %s", \
+ (UV) cp, OP_DESC(PL_op)); \
+ } \
+ } STMT_END
# define _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG(s, send) \
STMT_START { /* Check if to warn before doing the conversion work */\
- if (ckWARN(WARN_LOCALE)) { \
+ if (! PL_in_utf8_CTYPE_locale && ckWARN(WARN_LOCALE)) { \
UV cp = utf8_to_uvchr_buf((U8 *) s, (U8 *) send, NULL); \
Perl_warner(aTHX_ packWARN(WARN_LOCALE), \
"Wide character (U+%"UVXf") in %s", \