public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Set Is_Not_Self_Hidden flag in more cases
@ 2023-05-25  8:05 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-05-25  8:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bob Duff

From: Bob Duff <duff@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_attr.adb | 2 +-
 gcc/ada/sem_ch10.adb | 8 ++++++--
 gcc/ada/sem_ch9.adb  | 4 ++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 0cfc2da29dd..efea03670c3 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -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;
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index c9bbd773424..a6cbe466b75 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -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
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 90b0ff08540..a15e37b7ce7 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -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);
-- 
2.40.0


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

only message in thread, other threads:[~2023-05-25  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25  8:05 [COMMITTED] ada: Set Is_Not_Self_Hidden flag in more cases Marc Poulhiès

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).