]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Change local variables to constants in expansion of packed arrays
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 3 Oct 2023 19:08:29 +0000 (21:08 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 7 Nov 2023 09:15:01 +0000 (10:15 +0100)
Cleanup; semantics is unaffected.

gcc/ada/

* exp_pakd.adb
(Expand_Bit_Packed_Element_Set): Change local Decl object from
variable to constant.
(Setup_Inline_Packed_Array_Reference): Likewise for Csiz.

gcc/ada/exp_pakd.adb

index 2d3abbd349db8abb17117230cd2c0dd17b220b5f..1641e8a51c2748ec12d3f461bf1006fc6fe0c88b 100644 (file)
@@ -1137,14 +1137,12 @@ package body Exp_Pakd is
 
       if Nkind (Rhs) = N_String_Literal then
          declare
-            Decl : Node_Id;
-         begin
-            Decl :=
+            Decl : constant Node_Id :=
               Make_Object_Declaration (Loc,
                 Defining_Identifier => Make_Temporary (Loc, 'T', Rhs),
                 Object_Definition   => New_Occurrence_Of (Ctyp, Loc),
                 Expression          => New_Copy_Tree (Rhs));
-
+         begin
             Insert_Actions (N, New_List (Decl));
             Rhs := New_Occurrence_Of (Defining_Identifier (Decl), Loc);
          end;
@@ -2481,12 +2479,10 @@ package body Exp_Pakd is
       Loc  : constant Source_Ptr := Sloc (N);
       PAT  : Entity_Id;
       Otyp : Entity_Id;
-      Csiz : Uint;
+      Csiz : constant Uint := Component_Size (Atyp);
       Osiz : Uint;
 
    begin
-      Csiz := Component_Size (Atyp);
-
       Convert_To_PAT_Type (Obj);
       PAT := Etype (Obj);