public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1635] [Ada] Make "gcc -gnatDGL" handle unterminated last lines properly
@ 2021-06-18  8:39 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-18  8:39 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ca5cdc9053ffe033e8ece1c4be7882c67b3f5a39

commit r12-1635-gca5cdc9053ffe033e8ece1c4be7882c67b3f5a39
Author: Bob Duff <duff@adacore.com>
Date:   Mon Mar 22 16:22:49 2021 -0400

    [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:
---
 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 5f2d027dfaf..7fc73409d1a 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-18  8:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  8:39 [gcc r12-1635] [Ada] Make "gcc -gnatDGL" handle unterminated last lines properly Pierre-Marie de Rodat

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).