OSDN Git Service

gcc/ada/
authorsam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Aug 2008 08:59:47 +0000 (08:59 +0000)
committersam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Aug 2008 08:59:47 +0000 (08:59 +0000)
* exp_ch13.adb, exp_disp.adb, sem_cat.adb, sem_ch10.adb,
* sem_ch12.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb,
* sem_prag.adb, sem_util.adb, sem_warn.adb: Use
Is_Package_Or_Generic_Package instead of hand-crafted tests.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139191 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/ada/ChangeLog
gcc/ada/exp_ch13.adb
gcc/ada/exp_disp.adb
gcc/ada/sem_cat.adb
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch12.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch7.adb
gcc/ada/sem_ch8.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb
gcc/ada/sem_warn.adb

index 3ffa651..47bcb8e 100644 (file)
@@ -1,5 +1,12 @@
 2008-08-18  Samuel Tardieu  <sam@rfc1149.net>
 
+       * exp_ch13.adb, exp_disp.adb, sem_cat.adb, sem_ch10.adb,
+       * sem_ch12.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb,
+       * sem_prag.adb, sem_util.adb, sem_warn.adb: Use
+       Is_Package_Or_Generic_Package instead of hand-crafted tests.
+
+2008-08-18  Samuel Tardieu  <sam@rfc1149.net>
+
        PR ada/15808
        * sem_ch6.adb (Check_Private_Overriding): Check for generic packages
        as well.
index 4d2967b..af94e1d 100644 (file)
@@ -259,9 +259,8 @@ package body Exp_Ch13 is
          Push_Scope (E_Scope);
          Install_Visible_Declarations (E_Scope);
 
-         if Ekind (E_Scope) = E_Package         or else
-            Ekind (E_Scope) = E_Generic_Package or else
-            Is_Protected_Type (E_Scope)         or else
+         if Is_Package_Or_Generic_Package (E_Scope) or else
+            Is_Protected_Type (E_Scope)             or else
             Is_Task_Type (E_Scope)
          then
             Install_Private_Declarations (E_Scope);
index 5911501..84ea0b8 100644 (file)
@@ -6016,9 +6016,7 @@ package body Exp_Disp is
    begin
       --  The scope must be a package
 
-      if Ekind (Scop) /= E_Package
-        and then Ekind (Scop) /= E_Generic_Package
-      then
+      if not Is_Package_Or_Generic_Package (Scop) then
          return False;
       end if;
 
index 367f255..273c04f 100644 (file)
@@ -433,8 +433,7 @@ package body Sem_Cat is
       --  of an RCI unit.
 
       return Is_Remote_Call_Interface (Unit_Entity)
-        and then (Ekind (Unit_Entity) = E_Package
-                  or else Ekind (Unit_Entity) = E_Generic_Package)
+        and then Is_Package_Or_Generic_Package (Unit_Entity)
         and then Unit_Kind /= N_Package_Body
         and then List_Containing (N) =
                   Visible_Declarations
@@ -459,8 +458,7 @@ package body Sem_Cat is
       --  There are no restrictions on the body of a Remote Types unit
 
       return Is_Remote_Types (Unit_Entity)
-        and then (Ekind (Unit_Entity) = E_Package
-                   or else Ekind (Unit_Entity) = E_Generic_Package)
+        and then Is_Package_Or_Generic_Package (Unit_Entity)
         and then Unit_Kind /= N_Package_Body
         and then not In_Package_Body (Unit_Entity)
         and then not In_Instance;
index f81cca8..6331c04 100644 (file)
@@ -2007,9 +2007,7 @@ package body Sem_Ch10 is
          --  all the parents are bodies. Restore full visibility of their
          --  private entities.
 
-         if Ekind (Scop) = E_Package
-           or else Ekind (Scop) = E_Generic_Package
-         then
+         if Is_Package_Or_Generic_Package (Scop) then
             Set_In_Package_Body (Scop);
             Install_Private_Declarations (Scop);
          end if;
@@ -2099,9 +2097,7 @@ package body Sem_Ch10 is
          --  context includes another subunit of the same parent which in
          --  turn includes a child unit in its context.
 
-         if Ekind (Par_Unit) = E_Package
-           or else Ekind (Par_Unit) = E_Generic_Package
-         then
+         if Is_Package_Or_Generic_Package (Par_Unit) then
             if not Is_Immediately_Visible (Par_Unit)
               or else (Present (First_Entity (Par_Unit))
                         and then not Is_Immediately_Visible
index 30628b6..c956e7c 100644 (file)
@@ -5202,8 +5202,7 @@ package body Sem_Ch12 is
 
          Inst_Par := Entity (Prefix (Gen_Id));
          while Present (Inst_Par)
-           and then Ekind (Inst_Par) /= E_Package
-           and then Ekind (Inst_Par) /= E_Generic_Package
+           and then not Is_Package_Or_Generic_Package (Inst_Par)
          loop
             Inst_Par := Homonym (Inst_Par);
          end loop;
index d3faa0e..1100c30 100644 (file)
@@ -6566,8 +6566,7 @@ package body Sem_Ch6 is
          elsif Current_Scope = Standard_Standard then
             null;
 
-         elsif ((Ekind (Current_Scope) = E_Package
-                  or else Ekind (Current_Scope) = E_Generic_Package)
+         elsif (Is_Package_Or_Generic_Package (Current_Scope)
                  and then not In_Package_Body (Current_Scope))
            or else Is_Overriding
          then
index ee3300b..ef9a654 100644 (file)
@@ -847,10 +847,7 @@ package body Sem_Ch7 is
                   Set_Is_Known_Non_Null (E, False);
                end if;
 
-            elsif Ekind (E) = E_Package
-                    or else
-                  Ekind (E) = E_Generic_Package
-            then
+            elsif Is_Package_Or_Generic_Package (E) then
                Clear_Constants (E, First_Entity (E));
                Clear_Constants (E, First_Private_Entity (E));
             end if;
@@ -1145,8 +1142,7 @@ package body Sem_Ch7 is
          declare
             Comp_Unit : constant Entity_Id := Cunit_Entity (Current_Sem_Unit);
          begin
-            if (Ekind (Comp_Unit) = E_Package
-                 or else Ekind (Comp_Unit) = E_Generic_Package)
+            if Is_Package_Or_Generic_Package (Comp_Unit)
               and then not In_Private_Part (Comp_Unit)
               and then not In_Instance
             then
@@ -1308,8 +1304,7 @@ package body Sem_Ch7 is
       Set_Is_Pure         (Id, PF);
       Init_Size_Align     (Id);
 
-      if (Ekind (Current_Scope) /= E_Package
-          and then Ekind (Current_Scope) /= E_Generic_Package)
+      if not Is_Package_Or_Generic_Package (Current_Scope)
         or else In_Private_Part (Current_Scope)
       then
          Error_Msg_N ("invalid context for private declaration", N);
index c52f5ad..d943cbc 100644 (file)
@@ -2933,9 +2933,8 @@ package body Sem_Ch8 is
          Error_Msg_N
            ("renamed generic unit must be a library unit", Name (N));
 
-      elsif Ekind (Old_E) = E_Package
-        or else Ekind (Old_E) = E_Generic_Package
-      then
+      elsif Is_Package_Or_Generic_Package (Old_E) then
+
          --  Inherit categorization flags
 
          New_E := Defining_Entity (N);
@@ -6645,8 +6644,7 @@ package body Sem_Ch8 is
             then
                Full_Vis := True;
 
-            elsif (Ekind (S) = E_Package
-                    or else Ekind (S) = E_Generic_Package)
+            elsif Is_Package_Or_Generic_Package (S)
               and then (In_Private_Part (S)
                          or else In_Package_Body (S))
             then
index c1c661b..44b5c88 100644 (file)
@@ -1383,10 +1383,7 @@ package body Sem_Prag is
             --  the end of the package declarations (for details, see
             --  Analyze_Package_Specification.Analyze_PPCs).
 
-            if Ekind (Scope (S)) /= E_Package
-                 and then
-               Ekind (Scope (S)) /= E_Generic_Package
-            then
+            if not Is_Package_Or_Generic_Package (Scope (S)) then
                Analyze_PPC_In_Decl_Part (N, S);
             end if;
 
@@ -3539,8 +3536,7 @@ package body Sem_Prag is
 
          elsif (C = Convention_Java or else C = Convention_CIL)
            and then
-             (Ekind (Def_Id) = E_Package
-                or else Ekind (Def_Id) = E_Generic_Package
+             (Is_Package_Or_Generic_Package (Def_Id)
                 or else Ekind (Def_Id) = E_Exception
                 or else Nkind (Parent (Def_Id)) = N_Component_Declaration)
          then
@@ -4307,9 +4303,7 @@ package body Sem_Prag is
          E    : Entity_Id;
 
          In_Package_Spec : constant Boolean :=
-                             (Ekind (Current_Scope) = E_Package
-                                or else
-                              Ekind (Current_Scope) = E_Generic_Package)
+                             Is_Package_Or_Generic_Package (Current_Scope)
                                and then not In_Package_Body (Current_Scope);
 
          procedure Suppress_Unsuppress_Echeck (E : Entity_Id; C : Check_Id);
@@ -9215,9 +9209,7 @@ package body Sem_Prag is
                   declare
                      Ent : constant Entity_Id := Find_Lib_Unit_Name;
                   begin
-                     if Ekind (Ent) = E_Package
-                       or else Ekind (Ent) = E_Generic_Package
-                     then
+                     if Is_Package_Or_Generic_Package (Ent) then
                         Set_Obsolescent (Ent);
                         return;
                      end if;
index e1d042c..5783d3c 100644 (file)
@@ -7031,11 +7031,8 @@ package body Sem_Util is
          --  If scope is a package, also clear current values of all
          --  private entities in the scope.
 
-         if Ekind (S) = E_Package
-              or else
-            Ekind (S) = E_Generic_Package
-              or else
-            Is_Concurrent_Type (S)
+         if Is_Package_Or_Generic_Package (S)
+           or else Is_Concurrent_Type (S)
          then
             Kill_Current_Values_For_Entity_Chain (First_Private_Entity (S));
          end if;
index c22d0ce..feb19ce 100644 (file)
@@ -1294,11 +1294,8 @@ package body Sem_Warn is
                            or else
                              (Ekind (E1) = E_Package
                                 and then
-                                  Ekind (Cunit_Entity (Current_Sem_Unit)) /=
-                                                          E_Package
-                                and then
-                                  Ekind (Cunit_Entity (Current_Sem_Unit)) /=
-                                                          E_Generic_Package))
+                                  not Is_Package_Or_Generic_Package
+                                    (Cunit_Entity (Current_Sem_Unit))))
 
                --  Exclude instantiations, since there is no reason why every
                --  entity in an instantiation should be referenced.
@@ -1432,7 +1429,7 @@ package body Sem_Warn is
          --  formal package, because the corresponding body is not analyzed.
 
          <<Continue>>
-            if ((Ekind (E1) = E_Package or else Ekind (E1) = E_Generic_Package)
+            if (Is_Package_Or_Generic_Package (E1)
                   and then Nkind (Parent (E1)) = N_Package_Specification
                   and then
                     Nkind (Original_Node (Unit_Declaration_Node (E1)))