]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Simplify conversions from Uint to Char_Code
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 18 Jan 2022 20:18:42 +0000 (21:18 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 9 May 2022 09:27:38 +0000 (09:27 +0000)
Replace "Char_Code (UI_To_Int (...))" with "UI_To_CC (...).

Cleanup related to handling characters in GNATprove counterexamples;
semantics is unaffected.

gcc/ada/

* par-prag.adb (Prag): Simplify conversion of character codes.
* sem_case.adb (Choice_Image): Likewise.
(Lit_Of): Likewise.

gcc/ada/par-prag.adb
gcc/ada/sem_case.adb

index 6f1f50f6a0196530da1ef13fd91580fc861103d1..88f27f0fed7ad1d0f680166381204e614e8bf5d2 100644 (file)
@@ -1266,8 +1266,7 @@ begin
 
          elsif Nkind (A) = N_Character_Literal then
             declare
-               R : constant Char_Code :=
-                     Char_Code (UI_To_Int (Char_Literal_Value (A)));
+               R : constant Char_Code := UI_To_CC (Char_Literal_Value (A));
             begin
                if In_Character_Range (R) then
                   Wide_Character_Encoding_Method :=
index fed9f4d7dc636577d0cbff0f1c26bda189b68ab3..ccd4b18b4afd24df8249dbd92e7167778dc9f532 100644 (file)
@@ -1104,7 +1104,7 @@ package body Sem_Case is
          C := UI_To_Int (Value);
 
          if C in 16#20# .. 16#7E# then
-            Set_Character_Literal_Name (Char_Code (UI_To_Int (Value)));
+            Set_Character_Literal_Name (UI_To_CC (Value));
             return Name_Find;
          end if;
 
@@ -2925,7 +2925,7 @@ package body Sem_Case is
          --  is created with the appropriate Char_Code and Chars fields.
 
          if Is_Standard_Character_Type (Choice_Type) then
-            Set_Character_Literal_Name (Char_Code (UI_To_Int (Value)));
+            Set_Character_Literal_Name (UI_To_CC (Value));
             Lit :=
               Make_Character_Literal (Loc,
                 Chars              => Name_Find,