From: Bob Duff Date: Mon, 22 Mar 2021 20:22:49 +0000 (-0400) Subject: [Ada] Make "gcc -gnatDGL" handle unterminated last lines properly X-Git-Tag: basepoints/gcc-13~6678 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca5cdc9053ffe033e8ece1c4be7882c67b3f5a39;p=thirdparty%2Fgcc.git [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. --- 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;