]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Set Is_Not_Self_Hidden flag in more cases
authorBob Duff <duff@adacore.com>
Fri, 3 Mar 2023 14:46:34 +0000 (09:46 -0500)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 25 May 2023 07:44:16 +0000 (09:44 +0200)
More work-in-progress for changing E_Void checks to the flag.

gcc/ada/

* sem_ch9.adb (Analyze_Protected_Type_Declaration): Set the flag
for protected types.
(Analyze_Single_Protected_Declaration): Likewise, for singleton
protected objects.
(Analyze_Task_Type_Declaration): Set the flag for task types.
(Analyze_Single_Task_Declaration): Likewise, for singleton task
objects.
* sem_ch10.adb (Decorate_Type): Set the flag for types treated as
incomplete.
(Build_Shadow_Entity): Set the flag for shadow entities.
(Decorate_State): Set the flag for an abstract state.
(Build_Limited_Views): Set the flag for limited view of package.
* sem_attr.adb (Check_Not_Incomplete_Type): Disable the check when
this is a current instance.

gcc/ada/sem_attr.adb
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch9.adb

index 0cfc2da29ddf7c89af48ef67247ecaec67252872..efea03670c3b04a0cc29e6ebee9fdc8e38e29a92 100644 (file)
@@ -2517,7 +2517,7 @@ package body Sem_Attr is
            or else In_Spec_Expression
          then
             return;
-         else
+         elsif not Is_Current_Instance (P) then
             Check_Fully_Declared (P_Type, P);
          end if;
       end Check_Not_Incomplete_Type;
index c9bbd7734240d1cf397c43cb927d294bbace0eee..a6cbe466b75e9dd938e372728a2f6555ad7b65b7 100644 (file)
@@ -3306,6 +3306,7 @@ package body Sem_Ch10 is
       --  incomplete type, and carries the corresponding attributes.
 
       Mutate_Ekind           (Ent, E_Incomplete_Type);
+      Set_Is_Not_Self_Hidden (Ent);
       Set_Etype              (Ent, Ent);
       Set_Full_View          (Ent, Empty);
       Set_Is_First_Subtype   (Ent);
@@ -5989,7 +5990,8 @@ package body Sem_Ch10 is
             Mutate_Ekind (Shadow, Ekind (Ent));
          end if;
 
-         Set_Is_Internal       (Shadow);
+         Set_Is_Not_Self_Hidden (Shadow);
+         Set_Is_Internal (Shadow);
          Set_From_Limited_With (Shadow);
 
          --  Add the new shadow entity to the limited view of the package
@@ -6056,6 +6058,7 @@ package body Sem_Ch10 is
       procedure Decorate_State (Ent : Entity_Id; Scop : Entity_Id) is
       begin
          Mutate_Ekind            (Ent, E_Abstract_State);
+         Set_Is_Not_Self_Hidden  (Ent);
          Set_Etype               (Ent, Standard_Void_Type);
          Set_Scope               (Ent, Scop);
          Set_Encapsulating_State (Ent, Empty);
@@ -6416,11 +6419,12 @@ package body Sem_Ch10 is
             raise Program_Error;
       end case;
 
-      --  The withed unit may not be analyzed, but the with calause itself
+      --  The withed unit may not be analyzed, but the with clause itself
       --  must be minimally decorated. This ensures that the checks on unused
       --  with clauses also process limieted withs.
 
       Mutate_Ekind (Pack, E_Package);
+      Set_Is_Not_Self_Hidden (Pack);
       Set_Etype (Pack, Standard_Void_Type);
 
       if Is_Entity_Name (Nam) then
index 90b0ff0854028f5925b49e66dc066b3289a93ee5..a15e37b7ce70058f2d01f9f4fba8b5c7625e0100 100644 (file)
@@ -2067,6 +2067,7 @@ package body Sem_Ch9 is
       end if;
 
       Mutate_Ekind           (T, E_Protected_Type);
+      Set_Is_Not_Self_Hidden (T);
       Set_Is_First_Subtype   (T);
       Reinit_Size_Align      (T);
       Set_Etype              (T, T);
@@ -2901,6 +2902,7 @@ package body Sem_Ch9 is
 
       Enter_Name (Obj_Id);
       Mutate_Ekind               (Obj_Id, E_Variable);
+      Set_Is_Not_Self_Hidden     (Obj_Id);
       Set_Etype                  (Obj_Id, Typ);
       Set_SPARK_Pragma           (Obj_Id, SPARK_Mode_Pragma);
       Set_SPARK_Pragma_Inherited (Obj_Id);
@@ -2987,6 +2989,7 @@ package body Sem_Ch9 is
 
       Enter_Name (Obj_Id);
       Mutate_Ekind               (Obj_Id, E_Variable);
+      Set_Is_Not_Self_Hidden     (Obj_Id);
       Set_Etype                  (Obj_Id, Typ);
       Set_SPARK_Pragma           (Obj_Id, SPARK_Mode_Pragma);
       Set_SPARK_Pragma_Inherited (Obj_Id);
@@ -3265,6 +3268,7 @@ package body Sem_Ch9 is
       end if;
 
       Mutate_Ekind           (T, E_Task_Type);
+      Set_Is_Not_Self_Hidden (T);
       Set_Is_First_Subtype   (T, True);
       Set_Has_Task           (T, True);
       Reinit_Size_Align      (T);