diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-02-08 15:45:11 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-14 10:19:51 +0200 |
commit | 4dd6f75e35065f2f0732c4cfbaf412b50c51e26e (patch) | |
tree | 120ce65583002fb4adce8693f13aa06c06e244ac | |
parent | df48963b9553a51023c0d115bdf6205309e04bfe (diff) | |
download | gcc-4dd6f75e35065f2f0732c4cfbaf412b50c51e26e.zip gcc-4dd6f75e35065f2f0732c4cfbaf412b50c51e26e.tar.gz gcc-4dd6f75e35065f2f0732c4cfbaf412b50c51e26e.tar.bz2 |
ada: Small fix to printing of raise statements
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.
-rw-r--r-- | gcc/ada/sprint.adb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index 938b378..3f73006 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)); |