From 99859ea756671ac375a231d803623394de872ece Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Sun, 5 Jan 2020 23:53:42 +0100 Subject: [PATCH] [Ada] Iterate with procedural versions of Next_... routines where possible 2020-06-03 Piotr Trojanek gcc/ada/ * checks.adb, einfo.adb, exp_aggr.adb, exp_ch4.adb, exp_ch6.adb, exp_unst.adb, exp_util.adb, freeze.adb, inline.adb, repinfo.adb, sem_aggr.adb, sem_attr.adb, sem_aux.adb, sem_ch13.adb, sem_ch3.adb, sem_ch4.adb, sem_ch8.adb, sem_elab.adb, sem_eval.adb, sem_prag.adb, sem_res.adb, sem_smem.adb, sem_util.adb, treepr.adb: Replace uses of Next_ functions with corresponding procedures. --- gcc/ada/checks.adb | 4 ++-- gcc/ada/einfo.adb | 16 ++++++++-------- gcc/ada/exp_aggr.adb | 8 ++++---- gcc/ada/exp_ch4.adb | 2 +- gcc/ada/exp_ch6.adb | 2 +- gcc/ada/exp_unst.adb | 2 +- gcc/ada/exp_util.adb | 4 ++-- gcc/ada/freeze.adb | 4 ++-- gcc/ada/inline.adb | 4 ++-- gcc/ada/repinfo.adb | 2 +- gcc/ada/sem_aggr.adb | 2 +- gcc/ada/sem_attr.adb | 4 ++-- gcc/ada/sem_aux.adb | 26 +++++++++++++------------- gcc/ada/sem_ch13.adb | 8 ++++---- gcc/ada/sem_ch3.adb | 8 ++++---- gcc/ada/sem_ch4.adb | 6 +++--- gcc/ada/sem_ch8.adb | 10 +++++----- gcc/ada/sem_elab.adb | 2 +- gcc/ada/sem_eval.adb | 2 +- gcc/ada/sem_prag.adb | 2 +- gcc/ada/sem_res.adb | 4 ++-- gcc/ada/sem_smem.adb | 4 ++-- gcc/ada/sem_util.adb | 12 ++++++------ gcc/ada/treepr.adb | 2 +- 24 files changed, 70 insertions(+), 70 deletions(-) diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index a2fa7d099ce..c1744208e59 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -4889,7 +4889,7 @@ package body Checks is Indx := First_Index (Atyp); for J in 2 .. Inum loop - Indx := Next_Index (Indx); + Next_Index (Indx); end loop; -- If the index type is a formal type or derived from @@ -6847,7 +6847,7 @@ package body Checks is Reason => CE_Index_Check_Failed)); end if; - A_Idx := Next_Index (A_Idx); + Next_Index (A_Idx); Ind := Ind + 1; Next (Sub); end loop; diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb index 9e7476c18eb..5c2b47bcffb 100644 --- a/gcc/ada/einfo.adb +++ b/gcc/ada/einfo.adb @@ -7405,7 +7405,7 @@ package body Einfo is Comp_Id := First_Entity (Id); while Present (Comp_Id) loop exit when Ekind (Comp_Id) = E_Component; - Comp_Id := Next_Entity (Comp_Id); + Next_Entity (Comp_Id); end loop; return Comp_Id; @@ -7428,7 +7428,7 @@ package body Einfo is Comp_Id := First_Entity (Id); while Present (Comp_Id) loop exit when Ekind_In (Comp_Id, E_Component, E_Discriminant); - Comp_Id := Next_Entity (Comp_Id); + Next_Entity (Comp_Id); end loop; return Comp_Id; @@ -7755,7 +7755,7 @@ package body Einfo is return True; end if; - Ent := Next_Entity (Ent); + Next_Entity (Ent); end loop; return False; @@ -8540,7 +8540,7 @@ package body Einfo is Comp_Id := Next_Entity (Id); while Present (Comp_Id) loop exit when Ekind (Comp_Id) = E_Component; - Comp_Id := Next_Entity (Comp_Id); + Next_Entity (Comp_Id); end loop; return Comp_Id; @@ -8557,7 +8557,7 @@ package body Einfo is Comp_Id := Next_Entity (Id); while Present (Comp_Id) loop exit when Ekind_In (Comp_Id, E_Component, E_Discriminant); - Comp_Id := Next_Entity (Comp_Id); + Next_Entity (Comp_Id); end loop; return Comp_Id; @@ -8590,7 +8590,7 @@ package body Einfo is pragma Assert (Ekind (Id) = E_Discriminant); loop - D := Next_Entity (D); + Next_Entity (D); if No (D) or else (Ekind (D) /= E_Discriminant and then not Is_Itype (D)) @@ -8715,7 +8715,7 @@ package body Einfo is N := N + 1; end if; - Ent := Next_Entity (Ent); + Next_Entity (Ent); end loop; return N; @@ -8734,7 +8734,7 @@ package body Einfo is Formal := First_Formal (Id); while Present (Formal) loop N := N + 1; - Formal := Next_Formal (Formal); + Next_Formal (Formal); end loop; return N; diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 192ac99493b..7805c2d8f85 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -7227,7 +7227,7 @@ package body Exp_Aggr is Comp := First_Component (Typ); while Chars (Comp) /= Name_uParent loop - Comp := Next_Component (Comp); + Next_Component (Comp); end loop; Parent_Name := New_Occurrence_Of (Comp, Loc); @@ -7364,7 +7364,7 @@ package body Exp_Aggr is return False; end if; - Indx := Next_Index (Indx); + Next_Index (Indx); end loop; end if; end; @@ -8888,12 +8888,12 @@ package body Exp_Aggr is Comp_Val := Comp_Val mod Uint_2 ** Comp_Size; Val := UI_To_Int (Val + Comp_Val * Uint_2 ** Shift); Shift := Shift + Incr; - One_Comp := Next (One_Comp); + Next (One_Comp); Packed_Num := Packed_Num + 1; end if; end loop; - One_Dim := Next (One_Dim); + Next (One_Dim); end loop; if Packed_Num > 0 then diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 2d63f7ee04b..66ebc531af7 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -7904,7 +7904,7 @@ package body Exp_Ch4 is if Is_Equality (E, Typ) then return E; end if; - E := Next_Entity (E); + Next_Entity (E); end loop; end loop; diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index bc05b515e03..cc9c6e3c15e 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -9636,7 +9636,7 @@ package body Exp_Ch6 is Last_Formal := First_Formal (Proc_Id); while Present (Next_Formal (Last_Formal)) loop - Last_Formal := Next_Formal (Last_Formal); + Next_Formal (Last_Formal); end loop; Actuals := Parameter_Associations (N); diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index 02d3a754887..ade5fe0cfac 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -2104,7 +2104,7 @@ package body Exp_Unst is Comp := First_Component (STJ.ARECnT); while Chars (Comp) /= Chars (Ent) loop - Comp := Next_Component (Comp); + Next_Component (Comp); end loop; Rhs := diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 5fd224be580..1f3cfcc1274 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -9549,7 +9549,7 @@ package body Exp_Util is (Next (First (Pragma_Argument_Associations (Item)))); end if; - Item := Next_Rep_Item (Item); + Next_Rep_Item (Item); end loop; return Empty; @@ -9834,7 +9834,7 @@ package body Exp_Util is Low_Bound => New_Occurrence_Of (Low_Bound, Loc), High_Bound => New_Occurrence_Of (High_Bound, Loc))); - Index_Typ := Next_Index (Index_Typ); + Next_Index (Index_Typ); end loop; elsif Is_Class_Wide_Type (Unc_Typ) then diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index a7822ed32e7..673756fb507 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -652,7 +652,7 @@ package body Freeze is while Present (Rep) and then Next_Rep_Item (Rep) /= Addr loop - Rep := Next_Rep_Item (Rep); + Next_Rep_Item (Rep); end loop; end if; @@ -1957,7 +1957,7 @@ package body Freeze is Check_Aspect_At_End_Of_Declarations (Ritem); end if; - Ritem := Next_Rep_Item (Ritem); + Next_Rep_Item (Ritem); end loop; end; end if; diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 68cf102a1da..b6e6a27d185 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -852,7 +852,7 @@ package body Inline is return; end if; - Elmt := Next_Elmt (Elmt); + Next_Elmt (Elmt); end loop; Append_Elmt (Scop, To_Clean); @@ -2787,7 +2787,7 @@ package body Inline is Expand_Cleanup_Actions (Decl); End_Scope; - Elmt := Next_Elmt (Elmt); + Next_Elmt (Elmt); end loop; end Cleanup_Scopes; diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index 84c0badd06f..d02214c5063 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -600,7 +600,7 @@ package body Repinfo is end if; end if; - E := Next_Entity (E); + Next_Entity (E); end loop; -- For a package body, the entities of the visible subprograms are diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index aec14c4cde3..1f2fd5995d9 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -3014,7 +3014,7 @@ package body Sem_Aggr is return Etype (Comp); end if; - Comp := Next_Entity (Comp); + Next_Entity (Comp); end loop; Error_Msg_NE ("type& has no component with this name", Nam, Typ); diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 7e3b64bdecc..79ba4c45ea0 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -6418,7 +6418,7 @@ package body Sem_Attr is end if; end if; - Rep := Next_Rep_Item (Rep); + Next_Rep_Item (Rep); end loop; end if; end Compute_Type_Key; @@ -6760,7 +6760,7 @@ package body Sem_Attr is exit; end if; - Comp_Or_Discr := Next_Entity (Comp_Or_Discr); + Next_Entity (Comp_Or_Discr); end loop; -- Diagnose an illegal reference diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb index 7da41a0ccec..63e94b4cbb1 100644 --- a/gcc/ada/sem_aux.adb +++ b/gcc/ada/sem_aux.adb @@ -234,7 +234,7 @@ package body Sem_Aux is -- either because the tag must be ahead of them. if Chars (Ent) = Name_uTag then - Ent := Next_Entity (Ent); + Next_Entity (Ent); end if; -- Skip all hidden stored discriminants if any @@ -243,7 +243,7 @@ package body Sem_Aux is exit when Ekind (Ent) = E_Discriminant and then not Is_Completely_Hidden (Ent); - Ent := Next_Entity (Ent); + Next_Entity (Ent); end loop; -- Call may be on a private type with unknown discriminants, in which @@ -297,7 +297,7 @@ package body Sem_Aux is return True; end if; - Ent := Next_Entity (Ent); + Next_Entity (Ent); end loop; return False; @@ -313,14 +313,14 @@ package body Sem_Aux is Ent := First_Entity (Typ); if Chars (Ent) = Name_uTag then - Ent := Next_Entity (Ent); + Next_Entity (Ent); end if; if Has_Completely_Hidden_Discriminant (Ent) then while Present (Ent) loop exit when Ekind (Ent) = E_Discriminant and then Is_Completely_Hidden (Ent); - Ent := Next_Entity (Ent); + Next_Entity (Ent); end loop; end if; @@ -423,7 +423,7 @@ package body Sem_Aux is return Comp; end if; - Comp := Next_Entity (Comp); + Next_Entity (Comp); end loop; -- No tag component found @@ -735,7 +735,7 @@ package body Sem_Aux is return True; end if; - Item := Next_Rep_Item (Item); + Next_Rep_Item (Item); end loop; return False; @@ -984,7 +984,7 @@ package body Sem_Aux is return True; end if; - C := Next_Component (C); + Next_Component (C); end loop; end; @@ -1216,7 +1216,7 @@ package body Sem_Aux is return True; end if; - C := Next_Component (C); + Next_Component (C); end loop; end; @@ -1315,7 +1315,7 @@ package body Sem_Aux is return True; end if; - C := Next_Component (C); + Next_Component (C); end loop; end; @@ -1427,7 +1427,7 @@ package body Sem_Aux is return Comp; end if; - Comp := Next_Entity (Comp); + Next_Entity (Comp); end loop; -- No tag component found @@ -1456,7 +1456,7 @@ package body Sem_Aux is while Present (Comp) loop N := N + 1; - Comp := Next_Component_Or_Discriminant (Comp); + Next_Component_Or_Discriminant (Comp); end loop; return N; @@ -1473,7 +1473,7 @@ package body Sem_Aux is begin while Present (Discr) loop N := N + 1; - Discr := Next_Discriminant (Discr); + Next_Discriminant (Discr); end loop; return N; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 9eaf70b4bce..13bed50cffe 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1085,7 +1085,7 @@ package body Sem_Ch13 is end if; end if; - N := Next_Rep_Item (N); + Next_Rep_Item (N); end loop; end Inherit_Delayed_Rep_Aspects; @@ -4657,7 +4657,7 @@ package body Sem_Ch13 is -- False if any subsequent formal has no default expression - Formal := Next_Formal (Formal); + Next_Formal (Formal); while Present (Formal) loop if No (Expression (Parent (Formal))) then return False; @@ -10203,7 +10203,7 @@ package body Sem_Ch13 is end if; Prev_Bit_Offset := Component_Bit_Offset (Comp); - Comp := Next_Component (Comp); + Next_Component (Comp); end if; Next (Clause); @@ -13437,7 +13437,7 @@ package body Sem_Ch13 is end; end if; - ASN := Next_Rep_Item (ASN); + Next_Rep_Item (ASN); end loop; end Resolve_Aspect_Expressions; diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 1e3f0b825d2..29e8964a725 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -2448,7 +2448,7 @@ package body Sem_Ch3 is end if; exit when Last_Entity (Current_Scope) = Curr; - Curr := Next_Entity (Curr); + Next_Entity (Curr); end loop; end if; @@ -2683,7 +2683,7 @@ package body Sem_Ch3 is and then Present (First_Entity (Current_Scope)) then while Is_Generic_Formal (Freeze_From) loop - Freeze_From := Next_Entity (Freeze_From); + Next_Entity (Freeze_From); end loop; Freeze_All (Freeze_From, Decl); @@ -3811,7 +3811,7 @@ package body Sem_Ch3 is while Present (Comp) loop Check_Component (Etype (Comp), Parent (Comp)); - Comp := Next_Component (Comp); + Next_Component (Comp); end loop; end if; end Check_Component; @@ -15865,7 +15865,7 @@ package body Sem_Ch3 is return True; end if; - E := Next_Entity (E); + Next_Entity (E); end loop; List := Collect_Primitive_Operations (Derived_Type); diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 787ba3ec62e..7b8548f32ac 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -6019,7 +6019,7 @@ package body Sem_Ch4 is return; end if; - Comp := First_Entity (Prefix); + Comp := First_Entity (Prefix); while Nr_Of_Suggestions <= Max_Suggestions and then Present (Comp) loop if Is_Visible_Component (Comp, Sel) then if Is_Bad_Spelling_Of (Chars (Comp), Chars (Sel)) then @@ -6033,7 +6033,7 @@ package body Sem_Ch4 is end if; end if; - Comp := Next_Entity (Comp); + Next_Entity (Comp); end loop; -- Report at most two suggestions @@ -7531,7 +7531,7 @@ package body Sem_Ch4 is Formal := First_Entity (It.Nam); if Op = Second_Op then - Formal := Next_Entity (Formal); + Next_Entity (Formal); end if; if Is_Descendant_Of_Address (Etype (Formal)) then diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 5593001a1f7..76f696b32ed 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -2605,7 +2605,7 @@ package body Sem_Ch8 is exit; end if; - F := Next_Formal (F); + Next_Formal (F); end loop; if Ekind (Formal_Spec) = E_Function @@ -2643,7 +2643,7 @@ package body Sem_Ch8 is end if; end if; - F := Next_Formal (F); + Next_Formal (F); end loop; end if; end if; @@ -5337,7 +5337,7 @@ package body Sem_Ch8 is return; end if; - Lit := Next_Literal (Lit); + Next_Literal (Lit); end if; end; end if; @@ -8526,7 +8526,7 @@ package body Sem_Ch8 is while Present (Curr) loop Mark_Use_Type (Curr); - Curr := Next_Formal (Curr); + Next_Formal (Curr); end loop; -- Handle the return type @@ -9407,7 +9407,7 @@ package body Sem_Ch8 is Set_Current_Use_Clause (Entity (N), Prev_Use_Clause (Curr)); end if; - Curr := Next_Use_Clause (Curr); + Next_Use_Clause (Curr); end loop; end Update_Chain_In_Scope; diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 55a13009b63..57761473eda 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -18794,7 +18794,7 @@ package body Sem_Elab is Comp := First_Component (Typ); while Present (Comp) loop Add_Task_Proc (Etype (Comp)); - Comp := Next_Component (Comp); + Next_Component (Comp); end loop; end if; diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index b209d4af0ef..ce0d9074052 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -954,7 +954,7 @@ package body Sem_Eval is Subs := UI_To_Int (Expr_Value (First (Expressions (N)))); for J in 2 .. Subs loop - Indx := Next_Index (Indx); + Next_Index (Indx); end loop; end if; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 09d2485ad9f..0d4c21d7005 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -20510,7 +20510,7 @@ package body Sem_Prag is exit; else - Ent := Next_Literal (Ent); + Next_Literal (Ent); end if; end loop; end if; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 61dba77457f..2cbb35f1519 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -10601,7 +10601,7 @@ package body Sem_Res is while Present (Comp1) and then Chars (Comp1) /= Chars (S) loop - Comp1 := Next_Entity (Comp1); + Next_Entity (Comp1); end loop; end if; @@ -10610,7 +10610,7 @@ package body Sem_Res is end if; end if; - Comp := Next_Entity (Comp); + Next_Entity (Comp); end loop; end if; diff --git a/gcc/ada/sem_smem.adb b/gcc/ada/sem_smem.adb index abce72485d1..38fa1fa2031 100644 --- a/gcc/ada/sem_smem.adb +++ b/gcc/ada/sem_smem.adb @@ -126,7 +126,7 @@ package body Sem_Smem is if Is_Access_Type (Etype (C)) then return True; else - C := Next_Discriminant (C); + Next_Discriminant (C); end if; end loop; end if; @@ -145,7 +145,7 @@ package body Sem_Smem is then return True; else - C := Next_Component (C); + Next_Component (C); end if; end loop; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 174bbccc387..b73c1f6e623 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -8060,8 +8060,8 @@ package body Sem_Util is return; else - Actual := Next_Actual (Actual); - Formal := Next_Formal (Formal); + Next_Actual (Actual); + Next_Formal (Formal); end if; end loop; end if; @@ -12331,7 +12331,7 @@ package body Sem_Util is return True; end if; - Comp := Next_Component (Comp); + Next_Component (Comp); end loop; end if; @@ -13033,7 +13033,7 @@ package body Sem_Util is return Ent; end if; - Ent := Next_Entity (Ent); + Next_Entity (Ent); end loop; end; end if; @@ -18276,7 +18276,7 @@ package body Sem_Util is end if; end if; - Idx := Next_Index (Idx); + Next_Index (Idx); end loop; return False; @@ -25141,7 +25141,7 @@ package body Sem_Util is begin while Present (Indx) loop Set_Debug_Info_Needed_If_Not_Set (Etype (Indx)); - Indx := Next_Index (Indx); + Next_Index (Indx); end loop; end; diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb index 9da93aefa66..d472d446890 100644 --- a/gcc/ada/treepr.adb +++ b/gcc/ada/treepr.adb @@ -2185,7 +2185,7 @@ package body Treepr is Nod := N; while Present (Nod) loop Visit_Descendant (Union_Id (Next_Entity (Nod))); - Nod := Next_Entity (Nod); + Next_Entity (Nod); end loop; end; end if; -- 2.30.2