diff options
author | Javier Miranda <miranda@adacore.com> | 2020-06-24 15:57:36 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-15 05:39:13 -0400 |
commit | 952604032ac5a2804d0f36de7e329902f0340a8e (patch) | |
tree | eff8ac54e3613b185ab0dd8e43bdcbe6d817de51 | |
parent | 8861bdd59a95b32ad6000157418c808317421bfe (diff) | |
download | gcc-952604032ac5a2804d0f36de7e329902f0340a8e.zip gcc-952604032ac5a2804d0f36de7e329902f0340a8e.tar.gz gcc-952604032ac5a2804d0f36de7e329902f0340a8e.tar.bz2 |
[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.
-rw-r--r-- | gcc/ada/exp_ch3.adb | 10 | ||||
-rw-r--r-- | gcc/ada/exp_ch6.adb | 7 | ||||
-rw-r--r-- | gcc/ada/exp_ch6.ads | 4 |
3 files changed, 10 insertions, 11 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 0b601c5..93f8fa0 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 26fb58f..1885e89 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 69b1909..272f893 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 |