[Ada] Reduce scope of local variables
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 19 May 2021 10:07:42 +0000 (12:07 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 7 Jul 2021 16:23:14 +0000 (16:23 +0000)
gcc/ada/

* sem_ch6.adb (Check_For_Primitive_Subprogram): Move
declarations of local variables after nested subprogram bodies.

gcc/ada/sem_ch6.adb

index b0db7fe..75e5a99 100644 (file)
@@ -11018,10 +11018,6 @@ package body Sem_Ch6 is
         (Is_Primitive  : out Boolean;
          Is_Overriding : Boolean := False)
       is
-         Formal : Entity_Id;
-         F_Typ  : Entity_Id;
-         B_Typ  : Entity_Id;
-
          procedure Add_Or_Replace_Untagged_Primitive (Typ : Entity_Id);
          --  Either add the new subprogram to the list of primitives for
          --  untagged type Typ, or if it overrides a primitive of Typ, then
@@ -11270,6 +11266,12 @@ package body Sem_Ch6 is
             end if;
          end Visible_Part_Type;
 
+         --  Local variables
+
+         Formal : Entity_Id;
+         F_Typ  : Entity_Id;
+         B_Typ  : Entity_Id;
+
       --  Start of processing for Check_For_Primitive_Subprogram
 
       begin