[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 22 Jun 2009 13:09:00 +0000 (15:09 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 22 Jun 2009 13:09:00 +0000 (15:09 +0200)
2009-06-22  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (Check_Overriding_Indicator): Clean up code, make warning
unconditional rather than a style check, because a formal name out of
order is suspicious.

2009-06-22  Vincent Celier  <celier@adacore.com>

* prj-nmsc.adb (Locate_Directory): Indicate the project name when
creating a directory automatically.

2009-06-22  Eric Botcazou  <ebotcazou@adacore.com>

* sem_ch3.adb (Create_Constrained_Components): For a subtype of an
untagged derived type, add a hidden component for every constrained
discriminant of the parent type to keep record layout consistent.

From-SVN: r148792

gcc/ada/ChangeLog
gcc/ada/prj-nmsc.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb

index 86b0ae32534f825715be813c6884bbfa0876d1df..343de41a157dd2758ce818e7b80508a2f18a869f 100644 (file)
@@ -1,3 +1,20 @@
+2009-06-22  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb (Check_Overriding_Indicator): Clean up code, make warning
+       unconditional rather than a style check, because a formal name out of
+       order is suspicious.
+
+2009-06-22  Vincent Celier  <celier@adacore.com>
+
+       * prj-nmsc.adb (Locate_Directory): Indicate the project name when
+       creating a directory automatically.
+
+2009-06-22  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * sem_ch3.adb (Create_Constrained_Components): For a subtype of an
+       untagged derived type, add a hidden component for every constrained
+       discriminant of the parent type to keep record layout consistent.
+
 2009-06-22  Thomas Quinot  <quinot@adacore.com>
 
        * exp_ch3.adb: Minor code reorganization (avoid an unnecessary tree
index f1f5550dc8cf15dda85e972e6b131d048df519c1..2f8b027fdac06433d8541ce6b7d5a0d3c5794bf2 100644 (file)
@@ -6551,7 +6551,8 @@ package body Prj.Nmsc is
                         Write_Str (Create);
                         Write_Str (" directory """);
                         Write_Str (Full_Path_Name.all);
-                        Write_Line (""" created");
+                        Write_Str (""" created for project ");
+                        Write_Line (Get_Name_String (Project.Name));
                      end if;
 
                   exception
index dcc8736d79df371f070662ad56bc610e9c68152a..3e334686b738905de57d9424ebbb95378c05f1a8 100644 (file)
@@ -11246,9 +11246,9 @@ package body Sem_Ch3 is
            and then Is_Completely_Hidden (Old_Compon)
          then
             --  This is a shadow discriminant created for a discriminant of
-            --  the parent type that is one of several renamed by the same
-            --  new discriminant. Give the shadow discriminant an internal
-            --  name that cannot conflict with that of visible components.
+            --  the parent type, which needs to be present in the subtype.
+            --  Give the shadow discriminant an internal name that cannot
+            --  conflict with that of visible components.
 
             Set_Chars (New_Compon, New_Internal_Name ('C'));
          end if;
@@ -11351,10 +11351,11 @@ package body Sem_Ch3 is
 
          --  For an untagged derived subtype, the number of discriminants may
          --  be smaller than the number of inherited discriminants, because
-         --  several of them may be renamed by a single new discriminant.
-         --  In this case, add the hidden discriminants back into the subtype,
-         --  because otherwise the size of the subtype is computed incorrectly
-         --  in GCC 4.1.
+         --  several of them may be renamed by a single new discriminant or
+         --  constrained. In this case, add the hidden discriminants back into
+         --  the subtype, because they need to be present if the optimizer of
+         --  the GCC 4.x back-end decides to break apart assignments between
+         --  objects using the parent view into member-wise assignments.
 
          Num_Gird := 0;
 
@@ -11401,8 +11402,15 @@ package body Sem_Ch3 is
                         --  component for the current old discriminant.
 
                         New_C := Create_Component (Old_Discr);
-                        Set_Original_Record_Component  (New_C, Old_Discr);
+                        Set_Original_Record_Component (New_C, Old_Discr);
                      end if;
+
+                  else
+                     --  The constraint has eliminated the old discriminant.
+                     --  Introduce a shadow component.
+
+                     New_C := Create_Component (Old_Discr);
+                     Set_Original_Record_Component (New_C, Old_Discr);
                   end if;
 
                   Next_Elmt (Constr);
index ed1f745b1fd514751851563015caf8a503cd2a63..1b4abcb6e6fe64e2bb40d89cd726deca6bf86198 100644 (file)
@@ -4381,8 +4381,7 @@ package body Sem_Ch6 is
       --  often carry names that reflect the type, and it is not worthwhile
       --  requiring that their names match.
 
-      if Style_Check
-        and then Present (Overridden_Subp)
+      if Present (Overridden_Subp)
         and then Nkind (Subp) /= N_Defining_Operator_Symbol
       then
          declare
@@ -4393,6 +4392,14 @@ package body Sem_Ch6 is
             Form1 := First_Formal (Subp);
             Form2 := First_Formal (Overridden_Subp);
 
+            --  If the overriding operation is a synchronized operation, skip
+            --  the first parameter of the overridden operation, which is
+            --  implicit in the new one.
+
+            if Is_Concurrent_Type (Scope (Subp)) then
+               Form2 := Next_Formal (Form2);
+            end if;
+
             if Present (Form1) then
                Form1 := Next_Formal (Form1);
                Form2 := Next_Formal (Form2);