From: Javier Miranda Date: Wed, 24 Jun 2020 19:57:36 +0000 (-0400) Subject: [Ada] Cleanup definition of Might_Have_Tasks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=952604032ac5a2804d0f36de7e329902f0340a8e;p=gcc.git [Ada] Cleanup definition of Might_Have_Tasks gcc/ada/ * exp_ch6.ads (Might_Have_Tasks): Update documentation. * exp_ch6.adb (Might_Have_Tasks): Return also true when the type has tasks. (Make_Build_In_Place_Call_In_Allocator): Code cleanup. * exp_ch3.adb (Ensure_Activation_Chain_And_Master, Expand_N_Full_Type_Declaration, Expand_N_Object_Declaration): Code cleanup. --- diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 0b601c56213..93f8fa0728d 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -4758,7 +4758,7 @@ package body Exp_Ch3 is begin pragma Assert (Nkind (Obj_Decl) = N_Object_Declaration); - if Has_Task (Typ) or else Might_Have_Tasks (Typ) then + if Might_Have_Tasks (Typ) then Build_Activation_Chain_Entity (Obj_Decl); if Has_Task (Typ) then @@ -5898,10 +5898,8 @@ package body Exp_Ch3 is Typ := Etype (Comp); if Ekind (Typ) = E_Anonymous_Access_Type - and then - (Has_Task (Available_View (Designated_Type (Typ))) - or else - Might_Have_Tasks (Available_View (Designated_Type (Typ)))) + and then Might_Have_Tasks + (Available_View (Designated_Type (Typ))) and then No (Master_Id (Typ)) then -- Ensure that the record or array type have a _master @@ -6785,7 +6783,7 @@ package body Exp_Ch3 is -- of the stacks in this scenario, the stacks of the first array are -- not counted. - if (Has_Task (Typ) or else Might_Have_Tasks (Typ)) + if Might_Have_Tasks (Typ) and then not Restriction_Active (No_Secondary_Stack) and then (Restriction_Active (No_Implicit_Heap_Allocations) or else Restriction_Active (No_Implicit_Task_Allocations)) diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 26fb58fdf52..1885e89e963 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -8912,7 +8912,7 @@ package body Exp_Ch6 is -- rather than some outer chain. begin - if Has_Task (Result_Subt) or else Might_Have_Tasks (Result_Subt) then + if Might_Have_Tasks (Result_Subt) then Actions := New_List; Build_Task_Allocate_Block_With_Init_Stmts (Actions, Allocator, Init_Stmts => New_List (Assign)); @@ -9954,8 +9954,9 @@ package body Exp_Ch6 is begin return not Global_No_Tasking and then not No_Run_Time_Mode - and then Is_Class_Wide_Type (Typ) - and then Is_Limited_Record (Typ); + and then (Has_Task (Typ) + or else (Is_Class_Wide_Type (Typ) + and then Is_Limited_Record (Typ))); end Might_Have_Tasks; ---------------------------- diff --git a/gcc/ada/exp_ch6.ads b/gcc/ada/exp_ch6.ads index 69b19090102..272f8931923 100644 --- a/gcc/ada/exp_ch6.ads +++ b/gcc/ada/exp_ch6.ads @@ -241,8 +241,8 @@ package Exp_Ch6 is -- object. Function_Call must denote a call to a CPP_Constructor function. function Might_Have_Tasks (Typ : Entity_Id) return Boolean; - -- Return True if Typ is a limited class-wide type (or subtype), since it - -- might have task components. + -- Return True when type Typ has tasks or when it is a limited class-wide + -- type (or subtype), since it might have task components. function Needs_BIP_Alloc_Form (Func_Id : Entity_Id) return Boolean; -- Ada 2005 (AI-318-02): Return True if the function needs an implicit