From ca5cdc9053ffe033e8ece1c4be7882c67b3f5a39 Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Mon, 22 Mar 2021 16:22:49 -0400 Subject: [PATCH] [Ada] Make "gcc -gnatDGL" handle unterminated last lines properly gcc/ada/ * sprint.adb (Write_Source_Line): Check for EOF in Line_Terminator loop. Note that when a source file is read in, an EOF character is added to the end. --- gcc/ada/sprint.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index 5f2d027dfaf9..7fc73409d1a6 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -4847,7 +4847,10 @@ package body Sprint is Write_Int (Int (L)); Write_Str (": "); - while Src (Loc) not in Line_Terminator loop + -- We need to check for EOF here, in case the last line of the source + -- file does not have a Line_Terminator. + + while Src (Loc) not in Line_Terminator | EOF loop Write_Char (Src (Loc)); Loc := Loc + 1; end loop; -- 2.47.2