From: Piotr Trojanek Date: Tue, 28 Oct 2025 15:45:49 +0000 (+0100) Subject: ada: Fix pretty-printing of end spans X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=57e56e9fcb359c78b7c797b925042f8578fa4931;p=thirdparty%2Fgcc.git ada: Fix pretty-printing of end spans The pretty-printed output (emitted by the debugger "pp" command and by command line switch -gnatdt) was broken for an end span, e.g. 81 (Uint = 81) p.adb:8:11 Then_Statements = List (List_Id=-99999975) and now this is printed as: End_Span = 81 (Uint = 81) p.adb:8:11 Then_Statements = List (List_Id=-99999975) No impact on the compilation. gcc/ada/ChangeLog: * treepr.adb (Print_End_Span): Print prefix, field name and line break. --- diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb index 9d789879f11..88153accc66 100644 --- a/gcc/ada/treepr.adb +++ b/gcc/ada/treepr.adb @@ -140,7 +140,10 @@ package body Treepr is procedure Print_Init; -- Initialize for printing of tree with descendants - procedure Print_End_Span (N : Node_Id); + procedure Print_End_Span + (Prefix : String; + Field : Node_Field; + N : Node_Id); -- Print contents of End_Span field of node N. The format includes the -- implicit source location as well as the value of the field. @@ -605,10 +608,16 @@ package body Treepr is -- Print_End_Span -- -------------------- - procedure Print_End_Span (N : Node_Id) is + procedure Print_End_Span + (Prefix : String; + Field : Node_Field; + N : Node_Id) + is Val : constant Uint := End_Span (N); begin + Write_Str (Prefix); + Write_Str (Image (Field) & " = "); UI_Write (Val); Write_Str (" (Uint = "); Write_Str (UI_Image (Val)); @@ -617,6 +626,8 @@ package body Treepr is if Present (Val) then Write_Location (End_Location (N)); end if; + + Write_Eol; end Print_End_Span; ------------------------ @@ -1439,7 +1450,7 @@ package body Treepr is -- End_Location. if Fields (Field_Index) = F_End_Span then - Print_End_Span (N); + Print_End_Span (Prefix, F_End_Span, N); else Print_Node_Field