From eb44440252221f3791b513782a492e3a3292c2a4 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 29 Oct 2009 15:42:50 +0100 Subject: [PATCH] [multiple changes] 2009-10-28 Robert Dewar * sem_type.adb: Minor reformatting 2009-10-28 Arnaud Charlet * exp_ch9.adb (Build_Task_Proc_Specification): Generate a different suffix for task type bodies. 2009-10-28 Ed Schonberg * exp_aggr.adb (Convert_Aggr_In_Allocator): Do not look for a finalization list if the designated type requires no control actions, to prevent a useless semantic dependence on ada.tags. From-SVN: r153705 --- gcc/ada/ChangeLog | 15 +++++++++++++++ gcc/ada/exp_aggr.adb | 8 +++++++- gcc/ada/exp_ch9.adb | 15 ++++++++++++--- gcc/ada/sem_type.adb | 39 ++++++++++++++++++++++++++++----------- 4 files changed, 62 insertions(+), 15 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 218dc32a915..0c5382e8fc0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2009-10-28 Robert Dewar + + * sem_type.adb: Minor reformatting + +2009-10-28 Arnaud Charlet + + * exp_ch9.adb (Build_Task_Proc_Specification): Generate a different + suffix for task type bodies. + +2009-10-28 Ed Schonberg + + * exp_aggr.adb (Convert_Aggr_In_Allocator): Do not look for a + finalization list if the designated type requires no control actions, + to prevent a useless semantic dependence on ada.tags. + 2009-10-28 Bob Duff * s-fileio.adb: Give more information in exception messages. diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 75eb8f500fa..aadb22485d2 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -3298,8 +3298,14 @@ package body Exp_Aggr is N_Discriminant_Specification then Flist := Empty; - else + + elsif Needs_Finalization (Typ) then Flist := Find_Final_List (Access_Type); + + -- Otherwise there are no controlled actions to be performed. + + else + Flist := Empty; end if; if Is_Array_Type (Typ) then diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index e26734ea40e..f9cbf7b50d8 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -3983,9 +3983,18 @@ package body Exp_Ch9 is Spec_Id : Entity_Id; begin - Spec_Id := - Make_Defining_Identifier (Loc, - Chars => New_External_Name (Chars (T), 'B')); + if Comes_From_Source (T) then + -- This is an explicit task type + Spec_Id := + Make_Defining_Identifier (Loc, + Chars => New_External_Name (Chars (T), "TB")); + else + -- This is an anonymous task type + Spec_Id := + Make_Defining_Identifier (Loc, + Chars => New_External_Name (Chars (T), 'B')); + end if; + Set_Is_Internal (Spec_Id); -- Associate the procedure with the task, if this is the declaration diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index 5b3a4f3ecfe..d35326e1a50 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -732,7 +732,7 @@ package body Sem_Type is begin -- If either operand missing, then this is an error, but ignore it (and -- pretend we have a cover) if errors already detected, since this may - -- simply mean we have malformed trees. + -- simply mean we have malformed trees or a semantic error upstream. if No (T1) or else No (T2) then if Total_Errors_Detected /= 0 then @@ -803,7 +803,8 @@ package body Sem_Type is then return True; - -- The context may be class wide + -- The context may be class wide, and a class-wide type is + -- compatible with any member of the class. elsif Is_Class_Wide_Type (T1) and then Is_Ancestor (Root_Type (T1), T2) @@ -816,8 +817,8 @@ package body Sem_Type is then return True; - -- Ada 2005 (AI-345): A class-wide abstract interface type T1 covers a - -- task_type or protected_type implementing T1 + -- Ada 2005 (AI-345): A class-wide abstract interface type covers a + -- task_type or protected_type that implements the interface. elsif Ada_Version >= Ada_05 and then Is_Class_Wide_Type (T1) @@ -884,7 +885,10 @@ package body Sem_Type is then return True; - -- Some contexts require a class of types rather than a specific type + -- Some contexts require a class of types rather than a specific type. + -- For example, conditions require any boolean type, fixed point + -- attributes require some real type, etc. The built-in types Any_XXX + -- represent these classes. elsif (T1 = Any_Integer and then Is_Integer_Type (T2)) or else (T1 = Any_Boolean and then Is_Boolean_Type (T2)) @@ -963,6 +967,8 @@ package body Sem_Type is then return Covers (Corresponding_Remote_Type (T1), T2); + -- and conversely. + elsif Is_Record_Type (T2) and then (Is_Remote_Call_Interface (T2) or else Is_Remote_Types (T2)) @@ -970,6 +976,10 @@ package body Sem_Type is then return Covers (Corresponding_Remote_Type (T2), T1); + -- Synchronized types are represented at run time by their corresponding + -- record type. During expansion one is replaced with the other, but + -- they are compatible views of the same type. + elsif Is_Record_Type (T1) and then Is_Concurrent_Type (T2) and then Present (Corresponding_Record_Type (T2)) @@ -982,9 +992,14 @@ package body Sem_Type is then return Covers (Corresponding_Record_Type (T1), T2); + -- During analysis, an attribute reference 'Access has a special type + -- kind: Access_Attribute_Type, to be replaced eventually with the type + -- imposed by context. + elsif Ekind (T2) = E_Access_Attribute_Type and then (Ekind (BT1) = E_General_Access_Type - or else Ekind (BT1) = E_Access_Type) + or else + Ekind (BT1) = E_Access_Type) and then Covers (Designated_Type (T1), Designated_Type (T2)) then -- If the target type is a RACW type while the source is an access @@ -996,6 +1011,8 @@ package body Sem_Type is return True; + -- Ditto for allocators, which eventually resolve to the context type + elsif Ekind (T2) = E_Allocator_Type and then Is_Access_Type (T1) then @@ -1020,7 +1037,7 @@ package body Sem_Type is -- A packed array type covers its corresponding non-packed type. This is -- not legitimate Ada, but allows the omission of a number of otherwise -- useless unchecked conversions, and since this can only arise in - -- (known correct) expanded code, no harm is done + -- (known correct) expanded code, no harm is done. elsif Is_Array_Type (T2) and then Is_Packed (T2) @@ -1077,7 +1094,7 @@ package body Sem_Type is return True; -- Ada 2005 (AI-50217): Additional branches to make the shadow entity - -- compatible with its real entity. + -- obtained through a limited_with compatible with its real entity. elsif From_With_Type (T1) then @@ -1099,7 +1116,7 @@ package body Sem_Type is -- If units in the context have Limited_With clauses on each other, -- either type might have a limited view. Checks performed elsewhere - -- verify that the context type is the non-limited view. + -- verify that the context type is the nonlimited view. if Is_Incomplete_Type (T2) then return Covers (T1, Get_Full_View (Non_Limited_View (T2))); @@ -1123,7 +1140,7 @@ package body Sem_Type is -- Ada 2005 (AI-423): Coverage of formal anonymous access types -- and actual anonymous access types in the context of generic - -- instantiation. We have the following situation: + -- instantiations. We have the following situation: -- generic -- type Formal is private; @@ -1145,7 +1162,7 @@ package body Sem_Type is then return True; - -- Otherwise it doesn't cover! + -- Otherwise, types are not compatible! else return False;