* [COMMITTED] ada: Small fix to printing of raise statements
@ 2024-05-14 8:23 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-14 8:23 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sprint.adb | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index 938b378b66b..3f73006ad6e 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -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));
--
2.43.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-14 8:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-14 8:23 [COMMITTED] ada: Small fix to printing of raise statements Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).