einfo.adb (First_Private_Entity, [...]): Addition of one barrier to avoid wrong usage of this attribute.
2005-03-17 Javier Miranda <miranda@adacore.com> * einfo.adb (First_Private_Entity, Set_First_Private_Entity): Addition of one barrier to avoid wrong usage of this attribute. * sem_ch12.adb (Formal_Entity): Fix erroneous usage of the attribute First_Private_Entity. * sem_ch7.adb (Install_Visible_Declarations): Add a barrier to protect the subprogram against wrong usage. Adapt the code to traverse the entities in the scope of a record_type because in addition to its usage regarding packages, this subprogram is also called by Expand_N_Freeze_Entity to install the visible declarations of the enclosing scope of a record_type_with_private to establish the proper visibility before freezing the entity and related subprograms. From-SVN: r96664
This commit is contained in:
parent
5e77b60afd
commit
7b1da1d017
|
@ -1003,6 +1003,12 @@ package body Einfo is
|
|||
|
||||
function First_Private_Entity (Id : E) return E is
|
||||
begin
|
||||
pragma Assert (Ekind (Id) = E_Package
|
||||
or else Ekind (Id) = E_Generic_Package
|
||||
or else Ekind (Id) = E_Protected_Type
|
||||
or else Ekind (Id) = E_Protected_Subtype
|
||||
or else Ekind (Id) = E_Task_Type
|
||||
or else Ekind (Id) = E_Task_Subtype);
|
||||
return Node16 (Id);
|
||||
end First_Private_Entity;
|
||||
|
||||
|
@ -2981,7 +2987,12 @@ package body Einfo is
|
|||
|
||||
procedure Set_First_Private_Entity (Id : E; V : E) is
|
||||
begin
|
||||
pragma Assert (Nkind (Id) in N_Entity);
|
||||
pragma Assert (Ekind (Id) = E_Package
|
||||
or else Ekind (Id) = E_Generic_Package
|
||||
or else Ekind (Id) = E_Protected_Type
|
||||
or else Ekind (Id) = E_Protected_Subtype
|
||||
or else Ekind (Id) = E_Task_Type
|
||||
or else Ekind (Id) = E_Task_Subtype);
|
||||
Set_Node16 (Id, V);
|
||||
end Set_First_Private_Entity;
|
||||
|
||||
|
|
|
@ -6518,7 +6518,7 @@ package body Sem_Ch12 is
|
|||
|
||||
while Present (Actual_Ent)
|
||||
and then Present (Formal_Node)
|
||||
and then Actual_Ent /= First_Private_Entity (Act_Ent)
|
||||
and then Actual_Ent /= First_Private_Entity (Act_Pkg)
|
||||
loop
|
||||
-- ??? Are the following calls also needed here:
|
||||
--
|
||||
|
|
|
@ -1506,12 +1506,21 @@ package body Sem_Ch7 is
|
|||
----------------------------------
|
||||
|
||||
procedure Install_Visible_Declarations (P : Entity_Id) is
|
||||
Id : Entity_Id;
|
||||
Id : Entity_Id;
|
||||
Last_Entity : Entity_Id;
|
||||
|
||||
begin
|
||||
pragma Assert (Is_Package (P) or else Is_Record_Type (P));
|
||||
|
||||
if Is_Package (P) then
|
||||
Last_Entity := First_Private_Entity (P);
|
||||
else
|
||||
Last_Entity := Empty;
|
||||
end if;
|
||||
|
||||
Id := First_Entity (P);
|
||||
|
||||
while Present (Id) and then Id /= First_Private_Entity (P) loop
|
||||
while Present (Id) and then Id /= Last_Entity loop
|
||||
Install_Package_Entity (Id);
|
||||
Next_Entity (Id);
|
||||
end loop;
|
||||
|
|
Loading…
Reference in New Issue