diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-09-08 15:44:39 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-09-08 15:44:39 +0200 |
commit | 9c5719f69cf99842be94eb18315a802cbb7b246e (patch) | |
tree | 2e7704d122d153fb2bf24e6b84a5e2462c9ed3e4 /gcc/ada/sprint.adb | |
parent | 410abeeb0dde4aa71e47a507aa517ff4a4dbb6a1 (diff) | |
download | gcc-9c5719f69cf99842be94eb18315a802cbb7b246e.zip gcc-9c5719f69cf99842be94eb18315a802cbb7b246e.tar.gz gcc-9c5719f69cf99842be94eb18315a802cbb7b246e.tar.bz2 |
[multiple changes]
2017-09-08 Eric Botcazou <ebotcazou@adacore.com>
* sem_util.adb (NCT_Tables_In_Use): Move to library level from...
(New_Copy_Tree): ...there. Reset the hash tables only if they
were used in the previous invocation.
* s-htable.adb: Fix typo.
2017-09-08 Bob Duff <duff@adacore.com>
* a-ssicst.adb (Open): Set File.Last_Op to the appropriate value.
2017-09-08 Arnaud Charlet <charlet@adacore.com>
* sem_aggr.adb: minor style fix.
2017-09-08 Bob Duff <duff@adacore.com>
* sprint.adb (Write_Corresponding_Source): Ignore if there is
no current source file.
(Write_Name_With_Col_Check, Write_Name_With_Col_Check_Sloc):
Print something helpful in case N is invalid.
* sprint.ads: Minor comment fix.
From-SVN: r251897
Diffstat (limited to 'gcc/ada/sprint.adb')
-rw-r--r-- | gcc/ada/sprint.adb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index 85908cb..d97a1f7 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -3749,9 +3749,13 @@ package body Sprint is Src : Source_Buffer_Ptr; begin - -- Ignore if not in dump source text mode, or if in freeze actions + -- Ignore if there is no current source file, or we're not in dump + -- source text mode, or if in freeze actions. - if Dump_Source_Text and then Freeze_Indent = 0 then + if Current_Source_File /= No_Source_File + and then Dump_Source_Text + and then Freeze_Indent = 0 + then -- Ignore null string @@ -4504,6 +4508,15 @@ package body Sprint is L : Natural; begin + -- Avoid crashing on invalid Name_Ids + + if not Is_Valid_Name (N) then + Write_Str ("<invalid name "); + Write_Int (Int (N)); + Write_Str (">"); + return; + end if; + Get_Name_String (N); -- Deal with -gnatdI which replaces any sequence Cnnnb where C is an @@ -4552,6 +4565,15 @@ package body Sprint is procedure Write_Name_With_Col_Check_Sloc (N : Name_Id) is begin + -- Avoid crashing on invalid Name_Ids + + if not Is_Valid_Name (N) then + Write_Str ("<invalid name "); + Write_Int (Int (N)); + Write_Str (">"); + return; + end if; + Get_Name_String (N); Write_Str_With_Col_Check_Sloc (Name_Buffer (1 .. Name_Len)); end Write_Name_With_Col_Check_Sloc; |