toke.c: UTF-8 aware warning cleanups blead
authorAlex Vandiver <alex@chmrr.net>
Tue, 31 Mar 2015 07:46:41 +0000 (03:46 -0400)
committerDavid Mitchell <davem@iabyn.com>
Tue, 31 Mar 2015 08:43:45 +0000 (09:43 +0100)
t/lib/warnings/toke
toke.c

index 6cbce2e..dab8451 100644 (file)
@@ -1545,10 +1545,12 @@ Comme ca!
 ########
 # toke.c
 # Fix 'Use of "..." without parentheses is ambiguous' warning for
-# Unicode function names
+# Unicode function names.  If not under PERL_UNICODE, this will generate
+# a "Wide character" warning
 use utf8;
 use warnings;
 sub 𝛃(;$) { return 0; }
 my $v = 𝛃 - 5;
 EXPECT
-Warning: Use of "𝛃" without parentheses is ambiguous at - line 7.
+OPTION regex
+(Wide character.*\n)?Warning: Use of "𝛃" without parentheses is ambiguous
diff --git a/toke.c b/toke.c
index f974b1c..2a99f0b 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1846,8 +1846,8 @@ S_check_uni(pTHX)
        return;
 
     Perl_ck_warner_d(aTHX_ packWARN(WARN_AMBIGUOUS),
-                    "Warning: Use of \"%.*s\" without parentheses is ambiguous",
-                    (int)(s - PL_last_uni), PL_last_uni);
+                    "Warning: Use of \"%"UTF8f"\" without parentheses is ambiguous",
+                    UTF8fARG(UTF, (int)(s - PL_last_uni), PL_last_uni));
 }
 
 /*
@@ -2529,9 +2529,10 @@ S_get_and_check_backslash_N_name(pTHX_ const char* s, const char* const e)
         /* We deliberately don't try to print the malformed character, which
          * might not print very well; it also may be just the first of many
          * malformations, so don't print what comes after it */
-        yyerror(Perl_form(aTHX_
+        yyerror_pv(Perl_form(aTHX_
             "Malformed UTF-8 character immediately after '%.*s'",
-            (int) (first_bad_char_loc - (U8 *) backslash_ptr), backslash_ptr));
+            (int) (first_bad_char_loc - (U8 *) backslash_ptr), backslash_ptr),
+                   SVf_UTF8);
        return NULL;
     }
 
@@ -6055,8 +6056,8 @@ Perl_yylex(pTHX)
                            while (t < PL_bufend && *t != ']')
                                t++;
                            Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
-                                       "Multidimensional syntax %.*s not supported",
-                                   (int)((t - PL_bufptr) + 1), PL_bufptr);
+                                       "Multidimensional syntax %"UTF8f" not supported",
+                                        UTF8fARG(UTF,(int)((t - PL_bufptr) + 1), PL_bufptr));
                        }
                    }
                }