public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/guojiufu-branch)] [Ada] Iterate with procedural version of Next routine where possible
@ 2020-06-13  2:56 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-06-13  2:56 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:cbbe41d1f7b87e4f1889d0412ee46517bb7d5674

commit cbbe41d1f7b87e4f1889d0412ee46517bb7d5674
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Mar 18 23:57:10 2020 +0100

    [Ada] Iterate with procedural version of Next routine where possible
    
    2020-06-11  Piotr Trojanek  <trojanek@adacore.com>
    
    gcc/ada/
    
            * checks.adb, exp_ch7.adb, exp_ch9.adb, exp_smem.adb, lib.adb,
            nlists.adb, sem.adb, sem_aggr.adb, sem_ch3.adb, sem_ch6.adb,
            sem_ch8.adb, sem_dim.adb, sem_res.adb, sem_util.adb,
            sem_warn.adb: Replace uses of Next function with procedure.

Diff:
---
 gcc/ada/checks.adb   |  2 +-
 gcc/ada/exp_ch7.adb  |  4 ++--
 gcc/ada/exp_ch9.adb  |  4 ++--
 gcc/ada/exp_smem.adb |  2 +-
 gcc/ada/lib.adb      |  4 ++--
 gcc/ada/nlists.adb   | 16 ++++++++--------
 gcc/ada/sem.adb      |  2 +-
 gcc/ada/sem_aggr.adb |  2 +-
 gcc/ada/sem_ch3.adb  |  2 +-
 gcc/ada/sem_ch6.adb  |  4 ++--
 gcc/ada/sem_ch8.adb  |  2 +-
 gcc/ada/sem_dim.adb  |  2 +-
 gcc/ada/sem_res.adb  |  4 ++--
 gcc/ada/sem_util.adb | 14 +++++++-------
 gcc/ada/sem_warn.adb |  2 +-
 15 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 641a5b28174..808a419ae9b 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -3531,7 +3531,7 @@ package body Checks is
 
          --  Move to next subscript
 
-         Sub := Next (Sub);
+         Next (Sub);
       end loop;
    end Apply_Subscript_Validity_Checks;
 
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index ed4e8c570e6..5eec472302a 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -2852,7 +2852,7 @@ package body Exp_Ch7 is
                      exit;
                   end if;
 
-                  Result := Next (Result);
+                  Next (Result);
                end loop;
 
                return Result;
@@ -2895,7 +2895,7 @@ package body Exp_Ch7 is
             if No_Initialization (Decl) then
                if No (Expression (Last_Init)) then
                   loop
-                     Last_Init := Next (Last_Init);
+                     Next (Last_Init);
                      exit when No (Last_Init);
                      exit when Nkind (Last_Init) = N_Object_Declaration
                        and then Nkind (Expression (Last_Init)) = N_Reference
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 3d417ff995c..8d4bf233cf1 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -2130,7 +2130,7 @@ package body Exp_Ch9 is
             if Present (First_Formal (Iface_Op))
               and then Is_Controlling_Formal (First_Formal (Iface_Op))
             then
-               Iface_Op_Param := Next (Iface_Op_Param);
+               Next (Iface_Op_Param);
             end if;
 
             Wrapper_Param := First (Wrapper_Params);
@@ -2215,7 +2215,7 @@ package body Exp_Ch9 is
          if Is_Private_Primitive_Subprogram (Subp_Id)
            and then not Has_Controlling_Result (Subp_Id)
          then
-            Formal := Next (Formal);
+            Next (Formal);
          end if;
 
          while Present (Formal) loop
diff --git a/gcc/ada/exp_smem.adb b/gcc/ada/exp_smem.adb
index 6755d72ec3e..adce44a6ae4 100644
--- a/gcc/ada/exp_smem.adb
+++ b/gcc/ada/exp_smem.adb
@@ -454,7 +454,7 @@ package body Exp_Smem is
 
       begin
          while Next (Nod) /= After loop
-            Nod := Next (Nod);
+            Next (Nod);
          end loop;
 
          return Nod;
diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb
index 3a42e02209e..fd0f16731be 100644
--- a/gcc/ada/lib.adb
+++ b/gcc/ada/lib.adb
@@ -1335,7 +1335,7 @@ package body Lib is
            and then (Nkind (Context_Item) /= N_With_Clause
                       or else Limited_Present (Context_Item))
          loop
-            Context_Item := Next (Context_Item);
+            Next (Context_Item);
          end loop;
 
          if Present (Context_Item) then
@@ -1359,7 +1359,7 @@ package body Lib is
                   Write_Eol;
                end if;
 
-               Context_Item := Next (Context_Item);
+               Next (Context_Item);
             end loop;
 
             Outdent;
diff --git a/gcc/ada/nlists.adb b/gcc/ada/nlists.adb
index a51b191c8da..874d144bf23 100644
--- a/gcc/ada/nlists.adb
+++ b/gcc/ada/nlists.adb
@@ -243,7 +243,7 @@ package body Nlists is
             N := F;
             loop
                Set_List_Link (N, To);
-               N := Next (N);
+               Next (N);
                exit when No (N);
             end loop;
 
@@ -530,7 +530,7 @@ package body Nlists is
             loop
                Set_List_Link (N, LC);
                exit when N = L;
-               N := Next (N);
+               Next (N);
             end loop;
 
             if Present (Before) then
@@ -597,7 +597,7 @@ package body Nlists is
             loop
                Set_List_Link (N, LC);
                exit when N = L;
-               N := Next (N);
+               Next (N);
             end loop;
 
             if Present (After) then
@@ -699,7 +699,7 @@ package body Nlists is
       Node := First (List);
       while Present (Node) loop
          Result := Result + 1;
-         Node := Next (Node);
+         Next (Node);
       end loop;
 
       return Result;
@@ -756,7 +756,7 @@ package body Nlists is
 
          while Present (E) loop
             Append (New_Copy (E), NL);
-            E := Next (E);
+            Next (E);
          end loop;
 
          return NL;
@@ -784,7 +784,7 @@ package body Nlists is
                Append (New_Copy (E), NL);
             end if;
 
-            E := Next (E);
+            Next (E);
          end loop;
 
          return NL;
@@ -990,7 +990,7 @@ package body Nlists is
    begin
       N := Node;
       loop
-         N := Next (N);
+         Next (N);
          exit when not Nkind_In (N, N_Pragma, N_Null_Statement);
       end loop;
 
@@ -1040,7 +1040,7 @@ package body Nlists is
    begin
       Elmt := First (List);
       for J in 1 .. Index - 1 loop
-         Elmt := Next (Elmt);
+         Next (Elmt);
       end loop;
 
       return Elmt;
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index 5a723f34a95..39542ec7e7c 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -2377,7 +2377,7 @@ package body Sem is
             Action (Lib_Unit);
          end if;
 
-         Context_Item := Next (Context_Item);
+         Next (Context_Item);
       end loop;
    end Walk_Withs_Immediate;
 
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index a0f878442f4..84695b4bf60 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -4170,7 +4170,7 @@ package body Sem_Aggr is
                   raise Unrecoverable_Error;
                end if;
 
-               Assoc := Next (Assoc);
+               Next (Assoc);
             end loop;
          end;
       end if;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index f38d6e798ba..538796efcb9 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -1032,7 +1032,7 @@ package body Sem_Ch3 is
                Param := First (Parameter_Specifications (Def));
                while Present (Param) loop
                   Check_For_Premature_Usage (Parameter_Type (Param));
-                  Param := Next (Param);
+                  Next (Param);
                end loop;
             end if;
 
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index e4374453efc..576e33e6bb1 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -7340,10 +7340,10 @@ package body Sem_Ch6 is
          --  rest of the parameters.
 
          if not In_Scope then
-            Prim_Param := Next (Prim_Param);
+            Next (Prim_Param);
          end if;
 
-         Iface_Param := Next (Iface_Param);
+         Next (Iface_Param);
          while Present (Iface_Param) and then Present (Prim_Param) loop
             Iface_Id  := Defining_Identifier (Iface_Param);
             Iface_Typ := Find_Parameter_Type (Iface_Param);
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index e8d5a90c23e..e62be5599f8 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -7230,7 +7230,7 @@ package body Sem_Ch8 is
                return True;
             end if;
 
-            Clause := Next (Clause);
+            Next (Clause);
          end loop;
 
          return False;
diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb
index d2fae2761ca..378f4492d5d 100644
--- a/gcc/ada/sem_dim.adb
+++ b/gcc/ada/sem_dim.adb
@@ -681,7 +681,7 @@ package body Sem_Dim is
       --  Skip the symbol expression when present
 
       if Present (Symbol_Expr) and then Num_Choices = 0 then
-         Expr := Next (Expr);
+         Next (Expr);
       end if;
 
       Position := Low_Position_Bound;
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index acc997871a4..71c9ed2b0f0 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -4960,7 +4960,7 @@ package body Sem_Res is
             Expr := Next (First (Expressions (Disc_Exp)));
             if Present (Expr) then
                Check_Allocator_Discrim_Accessibility_Exprs (Expr, Alloc_Typ);
-               Expr := Next (Expr);
+               Next (Expr);
                if Present (Expr) then
                   Check_Allocator_Discrim_Accessibility_Exprs
                     (Expr, Alloc_Typ);
@@ -9276,7 +9276,7 @@ package body Sem_Res is
                      end loop;
                   end if;
 
-                  Alt := Next (Alt);
+                  Next (Alt);
                end loop;
             end;
          end if;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 76eb6653fb1..207d9d23ba1 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -10169,7 +10169,7 @@ package body Sem_Util is
                return Entity (Expression (Assoc));
             end if;
 
-            Assoc := Next (Assoc);
+            Next (Assoc);
          end loop;
 
          return Empty;
@@ -13824,7 +13824,7 @@ package body Sem_Util is
               Defining_Identifier (Decl));
          end if;
 
-         Decl := Next (Decl);
+         Next (Decl);
       end loop;
    end Inspect_Deferred_Constant_Completion;
 
@@ -20661,7 +20661,7 @@ package body Sem_Util is
 
          while Present (E) loop
             Append (New_Copy_Tree (E), NL);
-            E := Next (E);
+            Next (E);
          end loop;
 
          return NL;
@@ -28309,7 +28309,7 @@ package body Sem_Util is
             begin
                for Idx in Result'Range loop
                   Result (Idx) := Chosen_Interval (Range_Or_Expr);
-                  Range_Or_Expr := Next (Range_Or_Expr);
+                  Next (Range_Or_Expr);
                end loop;
                pragma Assert (not Present (Range_Or_Expr));
                Check_Consistency (Result);
@@ -28492,7 +28492,7 @@ package body Sem_Util is
                   Count := Count + 1;  -- an ordinary expression or range
                end if;
 
-               Choice := Next (Choice);
+               Next (Choice);
             end loop;
             return Count;
          end Unmerged_Choice_Count;
@@ -28510,14 +28510,14 @@ package body Sem_Util is
                   while Present (Others_Choice) loop
                      Count := Count + 1;
                      Result (Count) := Chosen_Interval (Others_Choice);
-                     Others_Choice := Next (Others_Choice);
+                     Next (Others_Choice);
                   end loop;
                end;
             else
                Count := Count + 1;
                Result (Count) := Chosen_Interval (Choice);
             end if;
-            Choice := Next (Choice);
+            Next (Choice);
          end loop;
          pragma Assert (Count = Result'Last);
          Normalize_Interval_List (Result, Count);
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 9a4a4d05f2f..8ca61757031 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -4734,7 +4734,7 @@ package body Sem_Warn is
                               return;
                            end if;
 
-                           X := Next (X);
+                           Next (X);
                         end loop;
                      end if;
                   end if;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-13  2:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13  2:56 [gcc(refs/users/guojiufu/heads/guojiufu-branch)] [Ada] Iterate with procedural version of Next routine where possible Jiu Fu Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).