[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 15 Apr 2009 08:58:45 +0000 (10:58 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 15 Apr 2009 08:58:45 +0000 (10:58 +0200)
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

gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_warn.ads

index 745e71660c6081a8f91fec96f53e287982e8c69e..de31fabf53a3ea2efe797ea4b34147bde50ca7ad 100644 (file)
@@ -1,3 +1,14 @@
+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>
 
        * prj-nmsc.adb (Locate_Directory): New Boolean parameter
index b577aa3ac5e027acf303eaec46635f32b22a8d51..8f3c75ef70e0d4cc6ce70d47a612d193bb36974f 100644 (file)
@@ -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;
index 2691e467c431db1e2dab0c24ee9e097a83d49e29..15e42f16b88813a4dc630df9ffe652652c76f8f2 100644 (file)
@@ -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;
 
index b375b20dd518832afb655f181c686177392971e2..3acb6873915f3ac0e31a01fb100509a5c3de8ccf 100644 (file)
@@ -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