aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2005-03-18 12:48:05 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2005-03-18 12:48:05 +0100
commit7b1da1d017af4e414586eb027f06eb9b8c41fcdd (patch)
treed2cdf3aa14acc3f051135a94e65cead5681dcdf6 /gcc/ada
parent5e77b60afdb1ef7b0a6b3a711bd71560dc7c00d4 (diff)
downloadgcc-7b1da1d017af4e414586eb027f06eb9b8c41fcdd.zip
gcc-7b1da1d017af4e414586eb027f06eb9b8c41fcdd.tar.gz
gcc-7b1da1d017af4e414586eb027f06eb9b8c41fcdd.tar.bz2
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
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/einfo.adb13
-rw-r--r--gcc/ada/sem_ch12.adb2
-rw-r--r--gcc/ada/sem_ch7.adb13
3 files changed, 24 insertions, 4 deletions
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index 900b69a..20327cb 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -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;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 53bb257..661ac76 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -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:
--
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index cf1cc2f..5660b15 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -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;