]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Reuse Is_Formal_Object where convenient
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 6 Jan 2021 11:04:56 +0000 (12:04 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 4 May 2021 09:17:32 +0000 (05:17 -0400)
gcc/ada/

* exp_prag.adb, sem_prag.adb: Replace low-level Ekind membership
tests with a high-level call to Is_Formal_Object.

gcc/ada/exp_prag.adb
gcc/ada/sem_prag.adb

index c559184781b206a07814d6346767b85db176d24e..53c937db3b1264233a8eaf2d67e75595f9ebaeef 100644 (file)
@@ -2368,10 +2368,9 @@ package body Exp_Prag is
                if Comes_From_Source (E)
                  and then Is_Object (E)
                  and then not Is_Entry_Formal (E)
+                 and then not Is_Formal_Object (E)
                  and then Ekind (E) /= E_Component
                  and then Ekind (E) /= E_Discriminant
-                 and then Ekind (E) /= E_Generic_In_Parameter
-                 and then Ekind (E) /= E_Generic_In_Out_Parameter
                then
                   Append_To (A,
                     Make_Pragma_Argument_Association (Loc,
index e1752060045b65bc0e5ac199147204b638a70319..b6544952e1df24a6022f1176d07ca1f0f26cb701 100644 (file)
@@ -718,9 +718,7 @@ package body Sem_Prag is
          elsif Ekind (Item_Id) = E_Constant then
             Add_Str_To_Name_Buffer ("constant");
 
-         elsif Ekind (Item_Id) in
-                 E_Generic_In_Out_Parameter | E_Generic_In_Parameter
-         then
+         elsif Is_Formal_Object (Item_Id) then
             Add_Str_To_Name_Buffer ("generic parameter");
 
          elsif Is_Formal (Item_Id) then
@@ -3098,9 +3096,7 @@ package body Sem_Prag is
                         --  it is allowed for an initialization item to depend
                         --  on an input item.
 
-                        if Ekind (Input_Id) in E_Generic_In_Out_Parameter
-                                             | E_Generic_In_Parameter
-                        then
+                        if Is_Formal_Object (Input_Id) then
                            null;
 
                         elsif Ekind (Input_Id) in E_Constant | E_Variable