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