aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-10-03 21:08:29 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-11-07 10:15:01 +0100
commit68040a6947971937bfaec08d8e4a229ceb5d7571 (patch)
treed27f253a488cad4568974febb126b6996b67e35b
parent3335c4cdc7916fc1b000ed0c35da65d8f958370f (diff)
downloadgcc-68040a6947971937bfaec08d8e4a229ceb5d7571.zip
gcc-68040a6947971937bfaec08d8e4a229ceb5d7571.tar.gz
gcc-68040a6947971937bfaec08d8e4a229ceb5d7571.tar.bz2
ada: Change local variables to constants in expansion of packed arrays
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.
-rw-r--r--gcc/ada/exp_pakd.adb10
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index 2d3abbd..1641e8a 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -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);