From 1104029a0824d177415806f3d30cecd2c5c399a1 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 24 Oct 2012 21:35:06 -0600 Subject: [PATCH] toke.c: Avoid unnecessary uninitialized value msgs \N{uknown character} is now a syntax error. It also generates a "Use of uninitialized value" message that is redundant (and confusing) with the unknown character message. --- t/lib/charnames/alias | 17 ----------------- toke.c | 2 ++ 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/t/lib/charnames/alias b/t/lib/charnames/alias index a4e3658..fcd08a9 100644 --- a/t/lib/charnames/alias +++ b/t/lib/charnames/alias @@ -62,7 +62,6 @@ use charnames ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE" }; "Here: \N{e_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 3. Unknown charname 'e_ACUTE' at - line 3, within string Execution of - aborted due to compilation errors. ######## @@ -73,7 +72,6 @@ use charnames ":short", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUT "Here: \N{e_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 4. Unknown charname 'e_ACUTE' at - line 4, within string Execution of - aborted due to compilation errors. ######## @@ -102,7 +100,6 @@ use charnames ":loose", ":alias" => { e_ACUTE => "latin SMALL LETTER E WITH ACUT "Here: \N{e_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 4. Unknown charname 'e_ACUTE' at - line 4, within string Execution of - aborted due to compilation errors. ######## @@ -113,7 +110,6 @@ use charnames ":full", ":alias" => { e_ACUTE => "LATIN:e WITH ACUTE" }; "Here: \N{e_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 4. Unknown charname 'e_ACUTE' at - line 4, within string Execution of - aborted due to compilation errors. ######## @@ -162,7 +158,6 @@ use charnames ":short", ":alias" => { "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 7. Unknown charname 'a_ACUTE' at - line 7, within string Execution of - aborted due to compilation errors. ######## @@ -187,7 +182,6 @@ use charnames ":short", ":alias" => { "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 6. Unknown charname 'a_ACUTE' at - line 6, within string Execution of - aborted due to compilation errors. ######## @@ -200,7 +194,6 @@ use charnames ":short", ":alias" => { "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 6. Unknown charname 'a_ACUTE' at - line 6, within string Execution of - aborted due to compilation errors. ######## @@ -214,8 +207,6 @@ use charnames ":full", ":alias" => { "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 7. -Use of uninitialized value at - line 7. Unknown charname 'e_ACUTE' at - line 7, within string Execution of - aborted due to compilation errors. ######## @@ -270,8 +261,6 @@ use charnames ":full", ":alias" => "xyzzy"; "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 4. -Use of uninitialized value at - line 4. Unknown charname 'e_ACUTE' at - line 4, within string Execution of - aborted due to compilation errors. ######## @@ -287,8 +276,6 @@ no warnings 'void'; use charnames ":full", ":alias" => "xyzzy"; "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; EXPECT -Use of uninitialized value at - line 4. -Use of uninitialized value at - line 4. Unknown charname 'e_ACUTE' at - line 4, within string Execution of - aborted due to compilation errors. ######## @@ -320,8 +307,6 @@ use charnames ":short", ":alias" => "xyzzy"; "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; EXPECT OPTIONS random fatal -Use of uninitialized value at - line 4. -Use of uninitialized value at - line 4. Unknown charname 'e_ACUTE' at - line 4, within string Execution of - aborted due to compilation errors. ######## @@ -337,8 +322,6 @@ no warnings 'void'; use charnames ":alias" => ":xyzzy"; "Here: \N{e_ACUTE}\N{a_ACUTE}!\n"; EXPECT -Use of uninitialized value at - line 4. -Use of uninitialized value at - line 4. Unknown charname 'e_ACUTE' at - line 4, within string Execution of - aborted due to compilation errors. ######## diff --git a/toke.c b/toke.c index 97b2170..5ad110f 100644 --- a/toke.c +++ b/toke.c @@ -3288,6 +3288,7 @@ S_scan_const(pTHX_ char *start) * revisited to not have charnames use utf8 for characters * that don't need it when regexes don't have to be in utf8 * for Unicode semantics. If doing so, remember EBCDIC */ + if (SvPOK(res)) { sv_utf8_upgrade(res); str = SvPV_const(res, len); @@ -3470,6 +3471,7 @@ S_scan_const(pTHX_ char *start) (int)(i - s + 1), s, (int)(e - i), i + 1); } } + } } /* End \N{NAME} */ #ifdef EBCDIC if (!dorange) -- 2.7.4