[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 24 Jun 2009 09:15:17 +0000 (11:15 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 24 Jun 2009 09:15:17 +0000 (11:15 +0200)
2009-06-24  Javier Miranda  <miranda@adacore.com>

* exp_ch4.adb (Expand_N_Type_Conversion): return immediately
from processing the type conversion when the node is
replaced by an N_Raise_Program_Error node.

2009-06-24  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_ch6.adb (Designates_From_With_Type): New routine.
(Process_Formals): Since anonymous access types are no longer flagged
as from with types, traverse the designated type to determine whether
it is coming from a limited view.

* sem_res.adb: Remove with and use clauses for Sem_Ch10.
(Full_Designated_Type): Use Available_View to extract the non-limited /
full view of a type.

From-SVN: r148899

gcc/ada/ChangeLog
gcc/ada/exp_ch4.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_res.adb

index 4905f7f6a57a65320116304817399ae1ebc2106c..8a097f4436a86b26cabbd0ef622bd30a59fc7b28 100644 (file)
@@ -1,3 +1,20 @@
+2009-06-24  Javier Miranda  <miranda@adacore.com>
+
+       * exp_ch4.adb (Expand_N_Type_Conversion): return immediately
+       from processing the type conversion when the node is
+       replaced by an N_Raise_Program_Error node.
+
+2009-06-24  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * sem_ch6.adb (Designates_From_With_Type): New routine.
+       (Process_Formals): Since anonymous access types are no longer flagged
+       as from with types, traverse the designated type to determine whether
+       it is coming from a limited view.
+
+       * sem_res.adb: Remove with and use clauses for Sem_Ch10.
+       (Full_Designated_Type): Use Available_View to extract the non-limited /
+       full view of a type.
+
 2009-06-24  Robert Dewar  <dewar@adacore.com>
 
        * exp_ch6.adb: Minor reformatting
index 507ccad5005bc9eadbc7244ce31fe1181150cfb4..1862cb5d9aaffe0aa8923b6fc2dba5a901a456f0 100644 (file)
@@ -7860,6 +7860,8 @@ package body Exp_Ch4 is
               Make_Raise_Program_Error (Sloc (N),
                 Reason => PE_Accessibility_Check_Failed));
             Set_Etype (N, Target_Type);
+
+            return;
          end if;
       end if;
 
index bb0da6d7538085230509531f59f0b243246d510c..dfd0cd424d0b399db317324966ff3268620868c1 100644 (file)
@@ -7837,11 +7837,36 @@ package body Sem_Ch6 is
       First_Out_Param : Entity_Id := Empty;
       --  Used for setting Is_Only_Out_Parameter
 
+      function Designates_From_With_Type (Typ : Entity_Id) return Boolean;
+      --  Determine whether an access type designates a type coming from a
+      --  limited view.
+
       function Is_Class_Wide_Default (D : Node_Id) return Boolean;
       --  Check whether the default has a class-wide type. After analysis the
       --  default has the type of the formal, so we must also check explicitly
       --  for an access attribute.
 
+      -------------------------------
+      -- Designates_From_With_Type --
+      -------------------------------
+
+      function Designates_From_With_Type (Typ : Entity_Id) return Boolean is
+         Desig : Entity_Id := Typ;
+
+      begin
+         if Is_Access_Type (Desig) then
+            Desig := Directly_Designated_Type (Desig);
+         end if;
+
+         if Is_Class_Wide_Type (Desig) then
+            Desig := Root_Type (Desig);
+         end if;
+
+         return
+           Ekind (Desig) = E_Incomplete_Type
+             and then From_With_Type (Desig);
+      end Designates_From_With_Type;
+
       ---------------------------
       -- Is_Class_Wide_Default --
       ---------------------------
@@ -8031,7 +8056,7 @@ package body Sem_Ch6 is
             --  is also class-wide.
 
             if Ekind (Formal_Type) = E_Anonymous_Access_Type
-              and then not From_With_Type (Formal_Type)
+              and then not Designates_From_With_Type (Formal_Type)
               and then Is_Class_Wide_Default (Default)
               and then not Is_Class_Wide_Type (Designated_Type (Formal_Type))
             then
index a662d5bf46a40ead89bbf54b83d9e56866ce9b23..c797d8caef160bb88803aa609489a4ea86418fc3 100644 (file)
@@ -9620,26 +9620,19 @@ package body Sem_Res is
             --------------------------
 
             function Full_Designated_Type (T : Entity_Id) return Entity_Id is
-               Desig : Entity_Id := Designated_Type (T);
+               Desig : constant Entity_Id := Designated_Type (T);
 
             begin
+               --  Handle the limited view of a type
+
                if Is_Incomplete_Type (Desig)
                  and then From_With_Type (Desig)
                  and then Present (Non_Limited_View (Desig))
                then
-                  Desig := Non_Limited_View (Desig);
-
-                  --  The shadow entity's non-limited view may designate an
-                  --  incomplete type.
-
-                  if Is_Incomplete_Type (Desig)
-                    and then Present (Full_View (Desig))
-                  then
-                     Desig := Full_View (Desig);
-                  end if;
+                  return Available_View (Desig);
+               else
+                  return Desig;
                end if;
-
-               return Desig;
             end Full_Designated_Type;
 
             --  Local Declarations