Commit e358346d by Arnaud Charlet

[multiple changes]

2009-04-15  Thomas Quinot  <quinot@adacore.com>

	* sem_warn.ads: Minor reformatting

2009-04-15  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb: better error message for illegal interfaces

	* sem_ch6.adb (Possible_Freeze): Delay freezing a subprogram if a
	formal is an incomplete type from a limited_with clause.

From-SVN: r146086
parent a9872a59
2009-04-15 Thomas Quinot <quinot@adacore.com>
* sem_warn.ads: Minor reformatting
2009-04-15 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb: better error message for illegal interfaces
* sem_ch6.adb (Possible_Freeze): Delay freezing a subprogram if a
formal is an incomplete type from a limited_with clause.
2009-04-15 Vincent Celier <celier@adacore.com> 2009-04-15 Vincent Celier <celier@adacore.com>
* prj-nmsc.adb (Locate_Directory): New Boolean parameter * prj-nmsc.adb (Locate_Directory): New Boolean parameter
...@@ -8734,6 +8734,7 @@ package body Sem_Ch3 is ...@@ -8734,6 +8734,7 @@ package body Sem_Ch3 is
or else Protected_Present (Iface_Def) or else Protected_Present (Iface_Def)
or else Synchronized_Present (Iface_Def)) or else Synchronized_Present (Iface_Def))
and then Nkind (N) /= N_Private_Extension_Declaration and then Nkind (N) /= N_Private_Extension_Declaration
and then not Error_Posted (N)
then then
Error_Msg_NE Error_Msg_NE
("progenitor& must be limited interface", ("progenitor& must be limited interface",
...@@ -12627,19 +12628,21 @@ package body Sem_Ch3 is ...@@ -12627,19 +12628,21 @@ package body Sem_Ch3 is
null; null;
elsif Protected_Present (Iface_Def) then elsif Protected_Present (Iface_Def) then
Error_Msg_N Error_Msg_NE
("(Ada 2005) limited interface cannot " ("descendant of& must be declared"
& "inherit from protected interface", Indic); & " as a protected interface",
N, Parent_Type);
elsif Synchronized_Present (Iface_Def) then elsif Synchronized_Present (Iface_Def) then
Error_Msg_N Error_Msg_NE
("(Ada 2005) limited interface cannot " ("descendant of& must be declared"
& "inherit from synchronized interface", Indic); & " as a synchronized interface",
N, Parent_Type);
elsif Task_Present (Iface_Def) then elsif Task_Present (Iface_Def) then
Error_Msg_N Error_Msg_NE
("(Ada 2005) limited interface cannot " ("descendant of& must be declared as a task interface",
& "inherit from task interface", Indic); N, Parent_Type);
else else
Error_Msg_N Error_Msg_N
...@@ -12658,20 +12661,21 @@ package body Sem_Ch3 is ...@@ -12658,20 +12661,21 @@ package body Sem_Ch3 is
null; null;
elsif Protected_Present (Iface_Def) then elsif Protected_Present (Iface_Def) then
Error_Msg_N Error_Msg_NE
("(Ada 2005) non-limited interface cannot " ("descendant of& must be declared"
& "inherit from protected interface", Indic); & " as a protected interface",
N, Parent_Type);
elsif Synchronized_Present (Iface_Def) then elsif Synchronized_Present (Iface_Def) then
Error_Msg_N Error_Msg_NE
("(Ada 2005) non-limited interface cannot " ("descendant of& must be declared"
& "inherit from synchronized interface", Indic); & " as a synchronized interface",
N, Parent_Type);
elsif Task_Present (Iface_Def) then elsif Task_Present (Iface_Def) then
Error_Msg_N Error_Msg_NE
("(Ada 2005) non-limited interface cannot " ("descendant of& must be declared as a task interface",
& "inherit from task interface", Indic); N, Parent_Type);
else else
null; null;
end if; end if;
......
...@@ -196,8 +196,8 @@ package body Sem_Ch6 is ...@@ -196,8 +196,8 @@ package body Sem_Ch6 is
procedure Set_Formal_Validity (Formal_Id : Entity_Id); procedure Set_Formal_Validity (Formal_Id : Entity_Id);
-- Formal_Id is an formal parameter entity. This procedure deals with -- Formal_Id is an formal parameter entity. This procedure deals with
-- setting the proper validity status for this entity, which depends -- setting the proper validity status for this entity, which depends on
-- on the kind of parameter and the validity checking mode. -- the kind of parameter and the validity checking mode.
------------------------------ ------------------------------
-- Analyze_Return_Statement -- -- Analyze_Return_Statement --
...@@ -3928,7 +3928,9 @@ package body Sem_Ch6 is ...@@ -3928,7 +3928,9 @@ package body Sem_Ch6 is
procedure Possible_Freeze (T : Entity_Id); procedure Possible_Freeze (T : Entity_Id);
-- T is the type of either a formal parameter or of the return type. -- T is the type of either a formal parameter or of the return type.
-- If T is not yet frozen and needs a delayed freeze, then the -- If T is not yet frozen and needs a delayed freeze, then the
-- subprogram itself must be delayed. -- subprogram itself must be delayed. If T is the limited view of
-- of an incomplete type the subprogram must be frozen as well,
-- because T may depend on local types that have not been frozen yet.
--------------------- ---------------------
-- Possible_Freeze -- -- Possible_Freeze --
...@@ -3946,6 +3948,11 @@ package body Sem_Ch6 is ...@@ -3946,6 +3948,11 @@ package body Sem_Ch6 is
and then not Is_Frozen (Designated_Type (T)) and then not Is_Frozen (Designated_Type (T))
then then
Set_Has_Delayed_Freeze (Designator); Set_Has_Delayed_Freeze (Designator);
elsif Ekind (T) = E_Incomplete_Type
and then From_With_Type (T)
then
Set_Has_Delayed_Freeze (Designator);
end if; end if;
end Possible_Freeze; end Possible_Freeze;
......
...@@ -171,10 +171,10 @@ package Sem_Warn is ...@@ -171,10 +171,10 @@ package Sem_Warn is
procedure Check_Low_Bound_Tested (Expr : Node_Id); procedure Check_Low_Bound_Tested (Expr : Node_Id);
-- Expr is the node for a comparison operation. This procedure checks if -- Expr is the node for a comparison operation. This procedure checks if
-- the comparison is a source comparison of P'First with some other value -- the comparison is a source comparison of P'First with some other value
-- and if so, sets the Low_Bound_Tested flag in Expr to suppress warnings -- and if so, sets the Low_Bound_Tested flag on entity P to suppress
-- about improper low bound assumptions (we assume that if the code has a -- warnings about improper low bound assumptions (we assume that if the
-- test that explicitly checks X'First, then it is not operating in blind -- code has a test that explicitly checks P'First, then it is not operating
-- assumption mode). -- in blind assumption mode).
procedure Warn_On_Known_Condition (C : Node_Id); procedure Warn_On_Known_Condition (C : Node_Id);
-- C is a node for a boolean expression resulting from a relational -- C is a node for a boolean expression resulting from a relational
......
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