Commit 6765b310 by Ed Schonberg Committed by Arnaud Charlet

sem_ch3.adb (Diagnose_Interface): Cleanup error messages involving improper progenitor names...

2008-05-28  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Diagnose_Interface): Cleanup error messages involving
	improper progenitor names, and avoid cascaded errors.

From-SVN: r136077
parent 449be9fa
...@@ -712,6 +712,10 @@ package body Sem_Ch3 is ...@@ -712,6 +712,10 @@ package body Sem_Ch3 is
-- E is some record type. This routine computes E's Stored_Constraint -- E is some record type. This routine computes E's Stored_Constraint
-- from its Discriminant_Constraint. -- from its Discriminant_Constraint.
procedure Diagnose_Interface (N : Node_Id; E : Entity_Id);
-- Check that an entity in a list of progenitors is an interface,
-- emit error otherwise.
----------------------- -----------------------
-- Access_Definition -- -- Access_Definition --
----------------------- -----------------------
...@@ -3098,10 +3102,7 @@ package body Sem_Ch3 is ...@@ -3098,10 +3102,7 @@ package body Sem_Ch3 is
while Present (Intf) loop while Present (Intf) loop
T := Find_Type_Of_Subtype_Indic (Intf); T := Find_Type_Of_Subtype_Indic (Intf);
if not Is_Interface (T) then Diagnose_Interface (Intf, T);
Error_Msg_NE ("(Ada 2005) & must be an interface", Intf, T);
end if;
Next (Intf); Next (Intf);
end loop; end loop;
end; end;
...@@ -8660,8 +8661,7 @@ package body Sem_Ch3 is ...@@ -8660,8 +8661,7 @@ package body Sem_Ch3 is
Iface_Def := Type_Definition (Parent_Node); Iface_Def := Type_Definition (Parent_Node);
if not Is_Interface (Iface_Typ) then if not Is_Interface (Iface_Typ) then
Error_Msg_NE ("(Ada 2005) & must be an interface", Diagnose_Interface (Iface, Iface_Typ);
Iface, Iface_Typ);
else else
Check_Ifaces (Iface_Def, Iface); Check_Ifaces (Iface_Def, Iface);
...@@ -8701,8 +8701,7 @@ package body Sem_Ch3 is ...@@ -8701,8 +8701,7 @@ package body Sem_Ch3 is
Iface_Def := Type_Definition (Parent_Node); Iface_Def := Type_Definition (Parent_Node);
if not Is_Interface (Iface_Typ) then if not Is_Interface (Iface_Typ) then
Error_Msg_NE ("(Ada 2005) & must be an interface", Diagnose_Interface (Iface, Iface_Typ);
Iface, Iface_Typ);
else else
-- "The declaration of a specific descendant of an interface -- "The declaration of a specific descendant of an interface
...@@ -12443,8 +12442,7 @@ package body Sem_Ch3 is ...@@ -12443,8 +12442,7 @@ package body Sem_Ch3 is
if Interface_Present (Def) then if Interface_Present (Def) then
if not Is_Interface (Parent_Type) then if not Is_Interface (Parent_Type) then
Error_Msg_NE Diagnose_Interface (Indic, Parent_Type);
("(Ada 2005) & must be an interface", Indic, Parent_Type);
else else
Parent_Node := Parent (Base_Type (Parent_Type)); Parent_Node := Parent (Base_Type (Parent_Type));
...@@ -12537,7 +12535,7 @@ package body Sem_Ch3 is ...@@ -12537,7 +12535,7 @@ package body Sem_Ch3 is
T := Find_Type_Of_Subtype_Indic (Intf); T := Find_Type_Of_Subtype_Indic (Intf);
if not Is_Interface (T) then if not Is_Interface (T) then
Error_Msg_NE ("(Ada 2005) & must be an interface", Intf, T); Diagnose_Interface (Intf, T);
-- Check the rules of 3.9.4(12/2) and 7.5(2/2) that disallow -- Check the rules of 3.9.4(12/2) and 7.5(2/2) that disallow
-- a limited type from having a nonlimited progenitor. -- a limited type from having a nonlimited progenitor.
...@@ -12850,6 +12848,19 @@ package body Sem_Ch3 is ...@@ -12850,6 +12848,19 @@ package body Sem_Ch3 is
end if; end if;
end Derived_Type_Declaration; end Derived_Type_Declaration;
------------------------
-- Diagnose_Interface --
------------------------
procedure Diagnose_Interface (N : Node_Id; E : Entity_Id) is
begin
if not Is_Interface (E)
and then E /= Any_Type
then
Error_Msg_NE ("(Ada 2005) & must be an interface", N, E);
end if;
end Diagnose_Interface;
---------------------------------- ----------------------------------
-- Enumeration_Type_Declaration -- -- Enumeration_Type_Declaration --
---------------------------------- ----------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment