]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Do not create an empty list of nodes that confuses GNATprove
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 5 Feb 2020 16:22:17 +0000 (17:22 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 5 Jun 2020 12:17:51 +0000 (08:17 -0400)
2020-06-05  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_aggr.adb (Resolve_Record_Aggregate): Create the
N_Aggregate node with its Expressions field set to No_List and
not to an empty list.

gcc/ada/sem_aggr.adb

index 5e43417d8e131dc22f0e4fd29022b358809fa9e8..88df5355570780691dd3cda112d4ec53d2460d1f 100644 (file)
@@ -147,9 +147,10 @@ package body Sem_Aggr is
    --
    --  Once this new Component_Association_List is built and all the semantic
    --  checks performed, the original aggregate subtree is replaced with the
-   --  new named record aggregate just built. Note that subtree substitution is
-   --  performed with Rewrite so as to be able to retrieve the original
-   --  aggregate.
+   --  new named record aggregate just built. This new record aggregate has no
+   --  positional associations, so its Expressions field is set to No_List.
+   --  Note that subtree substitution is performed with Rewrite so as to be
+   --  able to retrieve the original aggregate.
    --
    --  The aggregate subtree manipulation performed by Resolve_Record_Aggregate
    --  yields the aggregate format expected by Gigi. Typically, this kind of
@@ -3990,7 +3991,7 @@ package body Sem_Aggr is
 
          begin
             if Is_Record_Type (T) and then Has_Discriminants (T) then
-               New_Aggr := Make_Aggregate (Loc, New_List, New_List);
+               New_Aggr := Make_Aggregate (Loc, No_List, New_List);
                Set_Etype (New_Aggr, T);
 
                Add_Association
@@ -5043,7 +5044,7 @@ package body Sem_Aggr is
                         Expr : Node_Id;
 
                      begin
-                        Expr := Make_Aggregate (Loc, New_List, New_List);
+                        Expr := Make_Aggregate (Loc, No_List, New_List);
                         Set_Etype (Expr, Ctyp);
 
                         --  If the enclosing type has discriminants, they have