2009-04-20 Jerome Lambourg <lambourg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Apr 2009 13:14:40 +0000 (13:14 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Apr 2009 13:14:40 +0000 (13:14 +0000)
* impunit.adb: Add i-cil and i-cilobj packages, now needed by the
generated bindings for cil.

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

* sem_aggr.adb (Resolve_Record_Aggregate): If the type has unknown
discriminants, collect components from the Underlying_Record_View,
which will be used in the expansion of the aggregate into assignments.

* sem_ch3.adb: Do not label derived type with unknown discriminants as
having a private declaration.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146415 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/impunit.adb
gcc/ada/sem_aggr.adb
gcc/ada/sem_ch3.adb

index 65cd4e8..6a2a012 100644 (file)
@@ -1,3 +1,17 @@
+2009-04-20  Jerome Lambourg  <lambourg@adacore.com>
+
+       * impunit.adb: Add i-cil and i-cilobj packages, now needed by the
+       generated bindings for cil.
+
+2009-04-20  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_aggr.adb (Resolve_Record_Aggregate): If the type has unknown
+       discriminants, collect components from the Underlying_Record_View,
+       which will be used in the expansion of the aggregate into assignments.
+
+       * sem_ch3.adb: Do not label derived type with unknown discriminants as
+       having a private declaration.
+
 2009-04-20  Ed Schonberg  <schonberg@adacore.com>
 
        * exp_util.adb (Expand_Subtype_From_Expr): use the
index 0b8cdd5..4c308ba 100644 (file)
@@ -300,6 +300,8 @@ package body Impunit is
    ------------------------------------------
 
      "i-cexten",    -- Interfaces.C.Extensions
+     "i-cil   ",    -- Interfaces.CIL
+     "i-cilobj",    -- Interfaces.CIL.Object
      "i-cpp   ",    -- Interfaces.CPP
      "i-cstrea",    -- Interfaces.C.Streams
      "i-java  ",    -- Interfaces.Java
index 5078bc3..2e7ba8e 100644 (file)
@@ -3100,11 +3100,22 @@ package body Sem_Aggr is
                end if;
             end loop;
 
-            --  Now collect components from all other ancestors
+            --  Now collect components from all other ancestors, beginning
+            --  with the current type. If the type has unknown discriminants
+            --  use the component list of the underlying_record_view, which
+            --  needs to be used for the subsequent expansion of the aggregate
+            --  into assignments.
 
             Parent_Elmt := First_Elmt (Parent_Typ_List);
             while Present (Parent_Elmt) loop
                Parent_Typ := Node (Parent_Elmt);
+
+               if Has_Unknown_Discriminants (Parent_Typ)
+                 and then Present (Underlying_Record_View (Typ))
+               then
+                  Parent_Typ := Underlying_Record_View (Parent_Typ);
+               end if;
+
                Record_Def := Type_Definition (Parent (Base_Type (Parent_Typ)));
                Gather_Components (Empty,
                  Component_List (Record_Extension_Part (Record_Def)),
@@ -3120,12 +3131,21 @@ package body Sem_Aggr is
 
             if Null_Present (Record_Def) then
                null;
-            else
+
+            elsif not Has_Unknown_Discriminants (Typ) then
                Gather_Components (Base_Type (Typ),
                  Component_List (Record_Def),
                  Governed_By   => New_Assoc_List,
                  Into          => Components,
                  Report_Errors => Errors_Found);
+
+            else
+               Gather_Components
+                 (Base_Type (Underlying_Record_View (Typ)),
+                 Component_List (Record_Def),
+                 Governed_By   => New_Assoc_List,
+                 Into          => Components,
+                 Report_Errors => Errors_Found);
             end if;
          end if;
 
index a7ffd89..be87d0c 100644 (file)
@@ -5557,7 +5557,8 @@ package body Sem_Ch3 is
                  (N, Parent_Type, Derived_Type, Derive_Subps);
 
                --  Build anonymous completion, as a derivation from the full
-               --  view of the parent.
+               --  view of the parent. This is not a completion in the usual
+               --  sense, because the current type is not private.
 
                Decl :=
                  Make_Full_Type_Declaration (Loc,
@@ -5569,9 +5570,6 @@ package body Sem_Ch3 is
                            (Subtype_Indication (Type_Definition (N))),
                        Record_Extension_Part => New_Ext));
 
-               Set_Has_Private_Declaration (Full_Der);
-               Set_Has_Private_Declaration (Derived_Type);
-
                --  If the parent type has an underlying record view, use it
                --  here to build the new underlying record view.