[Ada] Do not print non ASCII characters in debug routines
authorArnaud Charlet <charlet@adacore.com>
Fri, 25 May 2018 09:03:24 +0000 (09:03 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Fri, 25 May 2018 09:03:24 +0000 (09:03 +0000)
2018-05-25  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* pprint.adb (Expression_Name): Do not print non ASCII characters.

From-SVN: r260720

gcc/ada/ChangeLog
gcc/ada/pprint.adb

index 1b95eb53d2fb0045b962cab15dcd1649750d66ae..3f183c38520243a875407c92c3c8d5a428dfba69 100644 (file)
@@ -1,3 +1,7 @@
+2018-05-25  Arnaud Charlet  <charlet@adacore.com>
+
+       * pprint.adb (Expression_Name): Do not print non ASCII characters.
+
 2018-05-25  Bob Duff  <duff@adacore.com>
 
        * libgnat/a-strunb__shared.ads, libgnat/a-stwiun__shared.ads,
index aa793d80f7ba6e749e44c427c715e1b605b4930f..53354ae7ba2188f86f83f2d8654a386a3d222ba7 100644 (file)
@@ -213,8 +213,7 @@ package body Pprint is
 
             when N_Character_Literal =>
                declare
-                  Char : constant Int :=
-                           UI_To_Int (Char_Literal_Value (Expr));
+                  Char : constant Int := UI_To_Int (Char_Literal_Value (Expr));
                begin
                   if Char in 32 .. 127 then
                      return "'" & Character'Val (Char) & "'";
@@ -890,6 +889,15 @@ package body Pprint is
             if Right /= Expr then
                while Scn < End_Sloc loop
                   case Src (Scn) is
+
+                     --  Give up on non ASCII characters
+
+                     when Character'Val (128) .. Character'Last =>
+                        Append_Paren := 0;
+                        Index := 0;
+                        Right := Expr;
+                        exit;
+
                      when ' '
                         | ASCII.HT
                      =>