public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-200] [Ada] Simplify conversions from Uint to Char_Code
@ 2022-05-09  9:32 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-09  9:32 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5c8053df7b7cbb9709aec0f295c4d0b8c7251f7f

commit r13-200-g5c8053df7b7cbb9709aec0f295c4d0b8c7251f7f
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Jan 18 21:18:42 2022 +0100

    [Ada] Simplify conversions from Uint to Char_Code
    
    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.

Diff:
---
 gcc/ada/par-prag.adb | 3 +--
 gcc/ada/sem_case.adb | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index 6f1f50f6a01..88f27f0fed7 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -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 :=
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb
index fed9f4d7dc6..ccd4b18b4af 100644
--- a/gcc/ada/sem_case.adb
+++ b/gcc/ada/sem_case.adb
@@ -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,


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-09  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09  9:32 [gcc r13-200] [Ada] Simplify conversions from Uint to Char_Code Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).