public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-5350] [Ada] Simplify Is_Standard_xxx_Type routines with membership tests
@ 2020-11-25 13:28 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-11-25 13:28 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:49c4dd7a229ce424379402deb295bf25d4c544e2

commit r11-5350-g49c4dd7a229ce424379402deb295bf25d4c544e2
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Oct 14 22:49:08 2020 +0200

    [Ada] Simplify Is_Standard_xxx_Type routines with membership tests
    
    gcc/ada/
    
            * einfo.adb (Is_Standard_Character_Type,
            Is_Standard_String_Type): Simplify.
            (Last_Formal): Use procedural variant of Next_Formal.

Diff:
---
 gcc/ada/einfo.adb | 40 +++++++++-------------------------------
 1 file changed, 9 insertions(+), 31 deletions(-)

diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index 7f21e45e43d..c9b69b9adfd 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -8309,21 +8309,10 @@ package body Einfo is
 
    function Is_Standard_Character_Type (Id : E) return B is
    begin
-      if Is_Type (Id) then
-         declare
-            R : constant Entity_Id := Root_Type (Id);
-         begin
-            return
-              R = Standard_Character
-                or else
-              R = Standard_Wide_Character
-                or else
-              R = Standard_Wide_Wide_Character;
-         end;
-
-      else
-         return False;
-      end if;
+      return Is_Type (Id)
+        and then Root_Type (Id) in Standard_Character
+                                 | Standard_Wide_Character
+                                 | Standard_Wide_Wide_Character;
    end Is_Standard_Character_Type;
 
    -----------------------------
@@ -8332,21 +8321,10 @@ package body Einfo is
 
    function Is_Standard_String_Type (Id : E) return B is
    begin
-      if Is_Type (Id) then
-         declare
-            R : constant Entity_Id := Root_Type (Id);
-         begin
-            return
-              R = Standard_String
-                or else
-              R = Standard_Wide_String
-                or else
-              R = Standard_Wide_Wide_String;
-         end;
-
-      else
-         return False;
-      end if;
+      return Is_Type (Id)
+        and then Root_Type (Id) in Standard_String
+                                 | Standard_Wide_String
+                                 | Standard_Wide_Wide_String;
    end Is_Standard_String_Type;
 
    --------------------
@@ -8454,7 +8432,7 @@ package body Einfo is
 
          if Present (Formal) then
             while Present (Next_Formal (Formal)) loop
-               Formal := Next_Formal (Formal);
+               Next_Formal (Formal);
             end loop;
          end if;


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

only message in thread, other threads:[~2020-11-25 13:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 13:28 [gcc r11-5350] [Ada] Simplify Is_Standard_xxx_Type routines with membership tests 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).