]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix Put_Image for Multiway_Trees
authorViljar Indus <indus@adacore.com>
Tue, 14 Oct 2025 09:02:13 +0000 (12:02 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 3 Nov 2025 14:15:17 +0000 (15:15 +0100)
Put_Image should start printing the tree from the Root instead
of the First_Child.

gcc/ada/ChangeLog:

* libgnat/a-cbmutr.adb (Put_Image): Fix the condition and starting point
for printing the tree.
* libgnat/a-cimutr.adb (Put_Image): Likewise.
* libgnat/a-comutr.adb (Put_Image): Likewise.

gcc/ada/libgnat/a-cbmutr.adb
gcc/ada/libgnat/a-cimutr.adb
gcc/ada/libgnat/a-comutr.adb

index 9d9d21d2c39e82081097503b1dc18674731edc58..bd6b1359f9648dfaa3c53d75564b20549a83004b 100644 (file)
@@ -2357,11 +2357,11 @@ is
       end Rec;
 
    begin
-      if First_Child (Root (V)) = No_Element then
+      if Is_Empty (V) then
          Array_Before (S);
          Array_After (S);
       else
-         Rec (First_Child (Root (V)));
+         Rec (Root (V));
       end if;
    end Put_Image;
 
index b84eb16024be20f81c1b97d43e9e593565060a52..0c6d33828b1aa225d9384fd52b1b850b95629ffc 100644 (file)
@@ -1910,11 +1910,11 @@ is
       end Rec;
 
    begin
-      if First_Child (Root (V)) = No_Element then
+      if Is_Empty (V) then
          Array_Before (S);
          Array_After (S);
       else
-         Rec (First_Child (Root (V)));
+         Rec (Root (V));
       end if;
    end Put_Image;
 
index df3741bbbb07bba93ac495a9b9a4561ca42f4ba9..2d6393db35aa0e7f3ad2310a4bd6be3d2a7a115d 100644 (file)
@@ -1844,11 +1844,11 @@ is
       end Rec;
 
    begin
-      if First_Child (Root (V)) = No_Element then
+      if Is_Empty (V) then
          Array_Before (S);
          Array_After (S);
       else
-         Rec (First_Child (Root (V)));
+         Rec (Root (V));
       end if;
    end Put_Image;