public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1264] ada: Use context variables in expansion of aggregates
@ 2023-05-26  7:35 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-26  7:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c8def50f5cb208c29591cec14609f33d2dec92eb

commit r14-1264-gc8def50f5cb208c29591cec14609f33d2dec92eb
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Mar 16 10:39:37 2023 +0100

    ada: Use context variables in expansion of aggregates
    
    Code cleanup; semantics is unaffected.
    
    gcc/ada/
    
            * exp_aggr.adb
            (Build_Constrained_Type): Remove local constants that were shadowing
            equivalent global constants; replace a wrapper that calls
            Make_Integer_Literal with a numeric literal; remove explicit
            Aliased_Present parameter which is equivalent to the default value.
            (Check_Bounds): Remove unused initial value.
            (Expand_Array_Aggregate): Use aggregate type from the context.

Diff:
---
 gcc/ada/exp_aggr.adb | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 60449fbeb2d..1dcbfade86c 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -5835,11 +5835,9 @@ package body Exp_Aggr is
       ----------------------------
 
       procedure Build_Constrained_Type (Positional : Boolean) is
-         Loc      : constant Source_Ptr := Sloc (N);
-         Agg_Type : constant Entity_Id  := Make_Temporary (Loc, 'A');
+         Agg_Type : constant Entity_Id := Make_Temporary (Loc, 'A');
          Decl     : Node_Id;
-         Typ      : constant Entity_Id := Etype (N);
-         Indexes  : constant List_Id   := New_List;
+         Indexes  : constant List_Id := New_List;
          Num      : Nat;
          Sub_Agg  : Node_Id;
 
@@ -5851,12 +5849,12 @@ package body Exp_Aggr is
          if Positional then
             Sub_Agg := N;
 
-            for D in 1 .. Number_Dimensions (Typ) loop
+            for D in 1 .. Aggr_Dimension loop
                Num := List_Length (Expressions (Sub_Agg));
 
                Append_To (Indexes,
                  Make_Range (Loc,
-                   Low_Bound  => Make_Integer_Literal (Loc, 1),
+                   Low_Bound  => Make_Integer_Literal (Loc, Uint_1),
                    High_Bound => Make_Integer_Literal (Loc, Num)));
 
                Sub_Agg := First (Expressions (Sub_Agg));
@@ -5867,7 +5865,7 @@ package body Exp_Aggr is
             --  is not processable by the back end, therefore not necessarily
             --  positional. Retrieve each dimension bounds (computed earlier).
 
-            for D in 1 .. Number_Dimensions (Typ) loop
+            for D in 1 .. Aggr_Dimension loop
                Append_To (Indexes,
                  Make_Range (Loc,
                    Low_Bound  => Aggr_Low  (D),
@@ -5883,7 +5881,6 @@ package body Exp_Aggr is
                    Discrete_Subtype_Definitions => Indexes,
                    Component_Definition         =>
                      Make_Component_Definition (Loc,
-                       Aliased_Present    => False,
                        Subtype_Indication =>
                          New_Occurrence_Of (Component_Type (Typ), Loc))));
 
@@ -5904,7 +5901,7 @@ package body Exp_Aggr is
          Ind_Bounds  : constant Range_Nodes :=
            Get_Index_Bounds (Index_Bounds_Node);
 
-         Cond : Node_Id := Empty;
+         Cond : Node_Id;
 
       begin
          --  For a null array aggregate check that high bound (i.e., low
@@ -6954,7 +6951,7 @@ package body Exp_Aggr is
       --  If this is an array of tasks, it will be expanded into build-in-place
       --  assignments. Build an activation chain for the tasks now.
 
-      if Has_Task (Etype (N)) then
+      if Has_Task (Typ) then
          Build_Activation_Chain_Entity (N);
       end if;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-26  7:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  7:35 [gcc r14-1264] ada: Use context variables in expansion of aggregates Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).