]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Factorize initialization of local variable
authorRonan Desplanques <desplanques@adacore.com>
Mon, 17 Mar 2025 16:15:29 +0000 (17:15 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 10 Jun 2025 07:32:01 +0000 (09:32 +0200)
gcc/ada/ChangeLog:

* sem_ch3.adb (Process_Subtype): Factorize initialization of variable.

gcc/ada/sem_ch3.adb

index 1263d7004d9fac8df0a452b666390b23b45a290a..0c262aa40f36851b371a35a1077ef69cf7bbaccb 100644 (file)
@@ -22555,7 +22555,7 @@ package body Sem_Ch3 is
 
       --  Local variables
 
-      P               : Node_Id;
+      P               : constant Node_Id := Parent (S);
       Def_Id          : Entity_Id;
       Error_Node      : Node_Id;
       Full_View_Id    : Entity_Id;
@@ -22579,7 +22579,6 @@ package body Sem_Ch3 is
          end if;
 
          Check_Incomplete (S);
-         P := Parent (S);
 
          if Excludes_Null then
             --  Create an Itype that is a duplicate of Entity (S) but with the
@@ -22652,7 +22651,6 @@ package body Sem_Ch3 is
             Check_Incomplete (Subtype_Mark (S));
          end if;
 
-         P := Parent (S);
          Subtype_Mark_Id := Entity (Subtype_Mark (S));
 
          --  Explicit subtype declaration case