re PR ada/19519 (GNAT Bug Box when reading a program with UTF-8 encoded enumeration...
authorRobert Dewar <dewar@adacore.com>
Fri, 18 Mar 2005 11:50:30 +0000 (12:50 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 18 Mar 2005 11:50:30 +0000 (12:50 +0100)
2005-03-17  Robert Dewar  <dewar@adacore.com>

PR ada/19519

* namet.adb (Copy_One_Character): Set proper wide character encoding
for upper half character if we have upper half encoding.

From-SVN: r96671

gcc/ada/namet.adb

index d462d1152e533fb22debc7c1f93cd4706e965e86..b10696dc863915b0308a8700a03481eda15bf45b 100644 (file)
@@ -36,6 +36,7 @@
 --  which is created manually from namet.ads and namet.adb.
 
 with Debug;    use Debug;
+with Opt;      use Opt;
 with Output;   use Output;
 with Tree_IO;  use Tree_IO;
 with Widechar; use Widechar;
@@ -299,7 +300,20 @@ package body Namet is
               and then Name_Buffer (Old + 1) /= '_'
             then
                Old := Old + 1;
-               Insert_Character (Character'Val (Hex (2)));
+
+               --  If we have upper half encoding, then we have to set an
+               --  appropriate wide character sequence for this character.
+
+               if Upper_Half_Encoding then
+                  Widechar.Set_Wide (Char_Code (Hex (2)), New_Buf, New_Len);
+
+                  --  For other encoding methods, upper half characters can
+                  --  simply use their normal representation.
+
+               else
+                  Insert_Character (Character'Val (Hex (2)));
+               end if;
+
 
             --  WW (wide wide character insertion)