public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1635] [Ada] Make "gcc -gnatDGL" handle unterminated last lines properly
Date: Fri, 18 Jun 2021 08:39:42 +0000 (GMT)	[thread overview]
Message-ID: <20210618083942.4BD5C39B4416@sourceware.org> (raw)

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;


                 reply	other threads:[~2021-06-18  8:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210618083942.4BD5C39B4416@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).