[COMMITTED] ada: Clean style in expansion of array aggregates

Message ID 20230526073543.2067746-1-poulhies@adacore.com
State Committed
Commit 8ba0b4cfeb518e4a4c5f3d3f8acc8cd700a05a93
Headers
Series [COMMITTED] ada: Clean style in expansion of array aggregates |

Commit Message

Marc Poulhiès May 26, 2023, 7:35 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

Code cleanup only; semantics is unaffected.

gcc/ada/

	* exp_aggr.adb
	(Build_Array_Aggr_Code): Change variable to constant.
	(Check_Same_Aggr_Bounds): Fix style; remove unused initial value.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_aggr.adb | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index de4d5a785fc..bbc0f408abc 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -2305,7 +2305,7 @@  package body Exp_Aggr is
       Assoc  : Node_Id;
       Choice : Node_Id;
       Expr   : Node_Id;
-      Typ    : Entity_Id;
+      Typ    : constant Entity_Id := Etype (N);
 
       Bounds : Range_Nodes;
       Low    : Node_Id renames Bounds.First;
@@ -2323,12 +2323,10 @@  package body Exp_Aggr is
    --  Start of processing for Build_Array_Aggr_Code
 
    begin
-      --  First before we start, a special case. if we have a bit packed
+      --  First before we start, a special case. If we have a bit packed
       --  array represented as a modular type, then clear the value to
       --  zero first, to ensure that unused bits are properly cleared.
 
-      Typ := Etype (N);
-
       if Present (Typ)
         and then Is_Bit_Packed_Array (Typ)
         and then Is_Modular_Integer_Type (Packed_Array_Impl_Type (Typ))
@@ -6002,8 +6000,8 @@  package body Exp_Aggr is
       ----------------------------
 
       procedure Check_Same_Aggr_Bounds (Sub_Aggr : Node_Id; Dim : Pos) is
-         Sub_Bounds : constant Range_Nodes
-           := Get_Index_Bounds (Aggregate_Bounds (Sub_Aggr));
+         Sub_Bounds : constant Range_Nodes :=
+           Get_Index_Bounds (Aggregate_Bounds (Sub_Aggr));
          Sub_Lo : Node_Id renames Sub_Bounds.First;
          Sub_Hi : Node_Id renames Sub_Bounds.Last;
          --  The bounds of this specific subaggregate
@@ -6015,7 +6013,7 @@  package body Exp_Aggr is
          Ind_Typ : constant Entity_Id := Aggr_Index_Typ (Dim);
          --  The index type for this dimension.xxx
 
-         Cond  : Node_Id := Empty;
+         Cond  : Node_Id;
          Assoc : Node_Id;
          Expr  : Node_Id;