[Ada] Remove redundant assignment in Formal_Is_Used_Once
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 10 Dec 2020 12:12:22 +0000 (13:12 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 28 Apr 2021 09:38:16 +0000 (05:38 -0400)
gcc/ada/

* inline.adb (Formal_Is_Used_Once): Refine type of the counter
variable; remove redundant assignment.

gcc/ada/inline.adb

index f373e89..16c4cd7 100644 (file)
@@ -2827,7 +2827,7 @@ package body Inline is
       -------------------------
 
       function Formal_Is_Used_Once (Formal : Entity_Id) return Boolean is
-         Use_Counter : Int := 0;
+         Use_Counter : Nat := 0;
 
          function Count_Uses (N : Node_Id) return Traverse_Result;
          --  Traverse the tree and count the uses of the formal parameter.
@@ -2856,13 +2856,10 @@ package body Inline is
             then
                Use_Counter := Use_Counter + 1;
 
-               if Use_Counter > 1 then
-
-                  --  Denote more than one use and abandon the traversal
+               --  If this is a second use then abandon the traversal
 
-                  Use_Counter := 2;
+               if Use_Counter > 1 then
                   return Abandon;
-
                end if;
             end if;