https://gcc.gnu.org/g:3aebcc20cbf07d58c47a75d1beae6a979d1c0252
commit r17-770-g3aebcc20cbf07d58c47a75d1beae6a979d1c0252 Author: Eric Botcazou <[email protected]> Date: Mon Jan 26 09:16:20 2026 +0100 ada: Small refactoring in Check_Anonymous_Access_Return_With_Tasks The procedure uses a custom version of the Might_Have_Tasks predicate, so this changes it to call the predicate instead. gcc/ada/ChangeLog: * sem_ch6.adb (Check_Anonymous_Access_Return_With_Tasks): Declare Scop as a constant and call the Might_Have_Tasks predicate instead of using a custom implementation of it. Diff: --- gcc/ada/sem_ch6.adb | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 514ab6eb6181..163d666ce104 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -2825,32 +2825,22 @@ package body Sem_Ch6 is ---------------------------------------------- procedure Check_Anonymous_Access_Return_With_Tasks is + Scop : constant Entity_Id := + (if Present (Spec_Id) then Spec_Id else Body_Id); + Decl : Node_Id; - Scop : Entity_Id; begin - if Present (Spec_Id) then - Scop := Spec_Id; - else - Scop := Body_Id; - end if; - if Ekind (Scop) = E_Function - and then Ekind (Etype (Scop)) = E_Anonymous_Access_Type and then not Is_Thunk (Scop) + and then Ekind (Etype (Scop)) = E_Anonymous_Access_Type + and then Might_Have_Tasks (Designated_Type (Etype (Scop))) -- Skip internally built functions which handle the case of -- a null access (see Expand_Interface_Conversion) and then not (Is_Interface (Designated_Type (Etype (Scop))) and then not Comes_From_Source (Parent (Scop))) - - and then (Has_Task (Designated_Type (Etype (Scop))) - or else - (Is_Class_Wide_Type (Designated_Type (Etype (Scop))) - and then - Is_Limited_Record - (Etype (Designated_Type (Etype (Scop)))))) and then Expander_Active then Decl := Build_Master_Declaration (Loc);
