From 5073ffbd0df5f82154fd580e53686ef82b68748d Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 18 Jul 2012 17:22:33 -0600 Subject: Only generate above-Uni warning for \p{}, \P{} This warning was being generated inappropriately during some internal operations, such as parsing a program; spotted by Tom Christiansen. The solution is to move the check for this situation out of the common code, and into the code where just \p{} and \P{} are handled. As mentioned in the commit's perldelta, there remains a bug [perl #114148], where no warning gets generated when it should --- utf8.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'utf8.c') diff --git a/utf8.c b/utf8.c index 5797f8e010..f6c147c119 100644 --- a/utf8.c +++ b/utf8.c @@ -3189,24 +3189,6 @@ Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8) Copy(ptr, PL_last_swash_key, klen, U8); } - if (UTF8_IS_SUPER(ptr) && ckWARN_d(WARN_NON_UNICODE)) { - SV** const bitssvp = hv_fetchs(hv, "BITS", FALSE); - - /* This outputs warnings for binary properties only, assuming that - * to_utf8_case() will output any for non-binary. Also, surrogates - * aren't checked for, as that would warn on things like /\p{Gc=Cs}/ */ - - if (! bitssvp || SvUV(*bitssvp) == 1) { - /* User-defined properties can silently match above-Unicode */ - SV** const user_defined_svp = hv_fetchs(hv, "USER_DEFINED", FALSE); - if (! user_defined_svp || ! SvUV(*user_defined_svp)) { - const UV code_point = utf8n_to_uvuni(ptr, UTF8_MAXBYTES, 0, 0); - Perl_warner(aTHX_ packWARN(WARN_NON_UNICODE), - "Code point 0x%04"UVXf" is not Unicode, all \\p{} matches fail; all \\P{} matches succeed", code_point); - } - } - } - switch ((int)((slen << 3) / needents)) { case 1: bit = 1 << (off & 7); -- cgit v1.2.1