]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Reduce span of variable
authorRonan Desplanques <desplanques@adacore.com>
Fri, 3 Mar 2023 11:33:21 +0000 (12:33 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 25 May 2023 07:44:16 +0000 (09:44 +0200)
This patch does not change the behavior of the compiler, but is
intended to improve readability. It seizes an opportunity to move
a variable declaration to a smaller scope, so that it's clearer
that the variable is not used outside of that scope.

gcc/ada/

* sem_ch3.adb (Replace_Type): Reduce span of variable.

gcc/ada/sem_ch3.adb

index a0783195b8bdbfd63a2ca39c1b957813e3c29902..c8af679b404c7b2a2339d76c85f348ca78bb481c 100644 (file)
@@ -15901,7 +15901,6 @@ package body Sem_Ch3 is
 
       procedure Replace_Type (Id, New_Id : Entity_Id) is
          Id_Type  : constant Entity_Id := Etype (Id);
-         Acc_Type : Entity_Id;
          Par      : constant Node_Id := Parent (Derived_Type);
 
       begin
@@ -15913,6 +15912,7 @@ package body Sem_Ch3 is
 
          if Ekind (Id_Type) = E_Anonymous_Access_Type then
             declare
+               Acc_Type  : Entity_Id;
                Desig_Typ : Entity_Id := Designated_Type (Id_Type);
 
             begin