]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Reorder components in Ada.Containers.Restricted_Doubly_Linked_Lists
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 23 Mar 2023 13:35:57 +0000 (14:35 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 26 May 2023 07:29:17 +0000 (09:29 +0200)
An instantiation of the package compiled with -gnatw.q yields:
  warning: in instantiation at a-crdlli.ads:317 [-gnatw.q]
  warning: record layout may cause performance issues [-gnatw.q]
  warning: in instantiation at a-crdlli.ads:317 [-gnatw.q]
  warning:
       component "Nodes" whose length depends on a discriminant [-gnatw.q]
  warning: in instantiation at a-crdlli.ads:317 [-gnatw.q]
  warning: comes too early and was moved down [-gnatw.q]

gcc/ada/

* libgnat/a-crdlli.ads (List): Move Nodes component to the end.

gcc/ada/libgnat/a-crdlli.ads

index d9c45177ddd125d77166734d149318cd0495c1cf..fa4fe15e4208cb207d23fb4e1d3ef6ab7b1d777e 100644 (file)
@@ -314,11 +314,11 @@ private
    type Node_Array is array (Count_Type range <>) of Node_Type;
 
    type List (Capacity : Count_Type) is tagged limited record
-      Nodes  : Node_Array (1 .. Capacity);
       Free   : Count_Type'Base := -1;
       First  : Count_Type := 0;
       Last   : Count_Type := 0;
       Length : Count_Type := 0;
+      Nodes  : Node_Array (1 .. Capacity);
    end record;
 
    type List_Access is access all List;