]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Small fix to printing of raise statements
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 8 Feb 2024 14:45:11 +0000 (15:45 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 14 May 2024 08:19:51 +0000 (10:19 +0200)
The Name is optional on these nodes and a superflous space is printed if
it is not present on them.

gcc/ada/

* sprint.adb (Sprint_Node_Actual) <N_Raise_Statement>: Be prepared
for an empty Name.
<N_Raise_When_Statement>: Likewise.

gcc/ada/sprint.adb

index 938b378b66b2e6e41c4266e2e3f24c9bb2996e4e..3f73006ad6e0063279ac959958aac8984b305d9f 100644 (file)
@@ -3116,8 +3116,12 @@ package body Sprint is
             Write_Condition_And_Reason (Node);
 
          when N_Raise_Statement =>
-            Write_Indent_Str_Sloc ("raise ");
-            Sprint_Node (Name (Node));
+            if Present (Name (Node)) then
+               Write_Indent_Str_Sloc ("raise ");
+               Sprint_Node (Name (Node));
+            else
+               Write_Indent_Str_Sloc ("raise");
+            end if;
 
             if Present (Expression (Node)) then
                Write_Str_With_Col_Check_Sloc (" with ");
@@ -3127,8 +3131,12 @@ package body Sprint is
             Write_Char (';');
 
          when N_Raise_When_Statement =>
-            Write_Indent_Str_Sloc ("raise ");
-            Sprint_Node (Name (Node));
+            if Present (Name (Node)) then
+               Write_Indent_Str_Sloc ("raise ");
+               Sprint_Node (Name (Node));
+            else
+               Write_Indent_Str_Sloc ("raise");
+            end if;
             Write_Str (" when ");
             Sprint_Node (Condition (Node));