From c9e7bd8efbef325c4cd76b2382ce5858d153e2c4 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 22 Jun 2009 15:09:00 +0200 Subject: [PATCH] [multiple changes] 2009-06-22 Ed Schonberg * 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 * prj-nmsc.adb (Locate_Directory): Indicate the project name when creating a directory automatically. 2009-06-22 Eric Botcazou * 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 | 17 +++++++++++++++++ gcc/ada/prj-nmsc.adb | 3 ++- gcc/ada/sem_ch3.adb | 24 ++++++++++++++++-------- gcc/ada/sem_ch6.adb | 11 +++++++++-- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 86b0ae32534..343de41a157 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2009-06-22 Ed Schonberg + + * 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 + + * prj-nmsc.adb (Locate_Directory): Indicate the project name when + creating a directory automatically. + +2009-06-22 Eric Botcazou + + * 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 * exp_ch3.adb: Minor code reorganization (avoid an unnecessary tree diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index f1f5550dc8c..2f8b027fdac 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -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 diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index dcc8736d79d..3e334686b73 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -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); diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index ed1f745b1fd..1b4abcb6e6f 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -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); -- 2.30.2