From 235a2f4e3ded35229ea76603beb8716870728d32 Mon Sep 17 00:00:00 2001 From: charlet Date: Wed, 15 Apr 2009 08:58:45 +0000 Subject: [PATCH] 2009-04-15 Thomas Quinot * sem_warn.ads: Minor reformatting 2009-04-15 Ed Schonberg * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146086 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/sem_ch3.adb | 42 +++++++++++++++++++++++------------------- gcc/ada/sem_ch6.adb | 13 ++++++++++--- gcc/ada/sem_warn.ads | 8 ++++---- 4 files changed, 48 insertions(+), 26 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 745e71660c6..de31fabf53a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2009-04-15 Thomas Quinot + + * sem_warn.ads: Minor reformatting + +2009-04-15 Ed Schonberg + + * 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 * prj-nmsc.adb (Locate_Directory): New Boolean parameter diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index b577aa3ac5e..8f3c75ef70e 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -8734,6 +8734,7 @@ package body Sem_Ch3 is or else Protected_Present (Iface_Def) or else Synchronized_Present (Iface_Def)) and then Nkind (N) /= N_Private_Extension_Declaration + and then not Error_Posted (N) then Error_Msg_NE ("progenitor& must be limited interface", @@ -12627,19 +12628,21 @@ package body Sem_Ch3 is null; elsif Protected_Present (Iface_Def) then - Error_Msg_N - ("(Ada 2005) limited interface cannot " - & "inherit from protected interface", Indic); + Error_Msg_NE + ("descendant of& must be declared" + & " as a protected interface", + N, Parent_Type); elsif Synchronized_Present (Iface_Def) then - Error_Msg_N - ("(Ada 2005) limited interface cannot " - & "inherit from synchronized interface", Indic); + Error_Msg_NE + ("descendant of& must be declared" + & " as a synchronized interface", + N, Parent_Type); elsif Task_Present (Iface_Def) then - Error_Msg_N - ("(Ada 2005) limited interface cannot " - & "inherit from task interface", Indic); + Error_Msg_NE + ("descendant of& must be declared as a task interface", + N, Parent_Type); else Error_Msg_N @@ -12658,20 +12661,21 @@ package body Sem_Ch3 is null; elsif Protected_Present (Iface_Def) then - Error_Msg_N - ("(Ada 2005) non-limited interface cannot " - & "inherit from protected interface", Indic); + Error_Msg_NE + ("descendant of& must be declared" + & " as a protected interface", + N, Parent_Type); elsif Synchronized_Present (Iface_Def) then - Error_Msg_N - ("(Ada 2005) non-limited interface cannot " - & "inherit from synchronized interface", Indic); + Error_Msg_NE + ("descendant of& must be declared" + & " as a synchronized interface", + N, Parent_Type); elsif Task_Present (Iface_Def) then - Error_Msg_N - ("(Ada 2005) non-limited interface cannot " - & "inherit from task interface", Indic); - + Error_Msg_NE + ("descendant of& must be declared as a task interface", + N, Parent_Type); else null; end if; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 2691e467c43..15e42f16b88 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -196,8 +196,8 @@ package body Sem_Ch6 is procedure Set_Formal_Validity (Formal_Id : Entity_Id); -- Formal_Id is an formal parameter entity. This procedure deals with - -- setting the proper validity status for this entity, which depends - -- on the kind of parameter and the validity checking mode. + -- setting the proper validity status for this entity, which depends on + -- the kind of parameter and the validity checking mode. ------------------------------ -- Analyze_Return_Statement -- @@ -3928,7 +3928,9 @@ package body Sem_Ch6 is procedure Possible_Freeze (T : Entity_Id); -- 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 - -- 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 -- @@ -3946,6 +3948,11 @@ package body Sem_Ch6 is and then not Is_Frozen (Designated_Type (T)) then 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 Possible_Freeze; diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads index b375b20dd51..3acb6873915 100644 --- a/gcc/ada/sem_warn.ads +++ b/gcc/ada/sem_warn.ads @@ -171,10 +171,10 @@ package Sem_Warn is procedure Check_Low_Bound_Tested (Expr : Node_Id); -- 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 - -- and if so, sets the Low_Bound_Tested flag in Expr to suppress warnings - -- about improper low bound assumptions (we assume that if the code has a - -- test that explicitly checks X'First, then it is not operating in blind - -- assumption mode). + -- and if so, sets the Low_Bound_Tested flag on entity P to suppress + -- warnings about improper low bound assumptions (we assume that if the + -- code has a test that explicitly checks P'First, then it is not operating + -- in blind assumption mode). procedure Warn_On_Known_Condition (C : Node_Id); -- C is a node for a boolean expression resulting from a relational -- 2.11.0