From: Piotr Trojanek Date: Thu, 23 Mar 2023 19:15:19 +0000 (+0100) Subject: ada: Remove leftover code for counting protected entries X-Git-Tag: basepoints/gcc-15~8859 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a555bfee36bf0ce7513c37e9d4fb1f23405a064;p=thirdparty%2Fgcc.git ada: Remove leftover code for counting protected entries We used to count protected entries by iterating over component declarations, but then switched to iterating over entities and left some code that is no longer needed. Cleanup; semantics is unaffected (maybe except fixing an assertion failure in developer builds when there is pragma among entry family declarations). gcc/ada/ * exp_ch9.adb (Build_Entry_Count_Expression): Remove loop over component declaration; consequently remove a parameter that is no longer used; adapt callers. (Make_Task_Create_Call): Refine type of a local variable. --- diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 68f1290cab45..b0e3632b8c83 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -154,8 +154,7 @@ package body Exp_Ch9 is -- N is the enclosing construct. function Build_Entry_Count_Expression - (Concurrent_Type : Node_Id; - Component_List : List_Id; + (Concurrent_Type : Entity_Id; Loc : Source_Ptr) return Node_Id; -- Compute number of entries for concurrent object. This is a count of -- simple entries, followed by an expression that computes the length @@ -1428,14 +1427,12 @@ package body Exp_Ch9 is ---------------------------------- function Build_Entry_Count_Expression - (Concurrent_Type : Node_Id; - Component_List : List_Id; + (Concurrent_Type : Entity_Id; Loc : Source_Ptr) return Node_Id is Eindx : Nat; Ent : Entity_Id; Ecount : Node_Id; - Comp : Node_Id; Lo : Node_Id; Hi : Node_Id; Typ : Entity_Id; @@ -1459,13 +1456,8 @@ package body Exp_Ch9 is -- Loop through entry families building the addition nodes Ent := First_Entity (Concurrent_Type); - Comp := First (Component_List); while Present (Ent) loop if Ekind (Ent) = E_Entry_Family then - while Chars (Ent) /= Chars (Defining_Identifier (Comp)) loop - Next (Comp); - end loop; - Typ := Entry_Index_Type (Ent); Hi := Type_High_Bound (Typ); Lo := Type_Low_Bound (Typ); @@ -9248,7 +9240,7 @@ package body Exp_Ch9 is declare Entry_Count_Expr : constant Node_Id := Build_Entry_Count_Expression - (Prot_Typ, Cdecls, Loc); + (Prot_Typ, Loc); Num_Attach_Handler : Nat := 0; Protection_Subtype : Node_Id; Ritem : Node_Id; @@ -14232,7 +14224,7 @@ package body Exp_Ch9 is Tdec : Node_Id; Tdef : Node_Id; Tnam : Name_Id; - Ttyp : Node_Id; + Ttyp : Entity_Id; begin Ttyp := Corresponding_Concurrent_Type (Task_Rec); @@ -14453,14 +14445,7 @@ package body Exp_Ch9 is -- where a,b... are the entry family names for the task definition - Ecount := - Build_Entry_Count_Expression - (Ttyp, - Component_Items - (Component_List - (Type_Definition - (Parent (Corresponding_Record_Type (Ttyp))))), - Loc); + Ecount := Build_Entry_Count_Expression (Ttyp, Loc); Append_To (Args, Ecount); -- Master parameter. This is a reference to the _Master parameter of