public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-1967] ada: Fix -fdiagnostics-format=json not printing all messages
Date: Tue, 20 Jun 2023 07:46:21 +0000 (GMT)	[thread overview]
Message-ID: <20230620074621.874BF3857C43@sourceware.org> (raw)

https://gcc.gnu.org/g:3404e481d09d49311ef74a8de15d8a72ed240cce

commit r14-1967-g3404e481d09d49311ef74a8de15d8a72ed240cce
Author: Ghjuvan Lacambre <lacambre@adacore.com>
Date:   Fri May 26 13:26:21 2023 +0200

    ada: Fix -fdiagnostics-format=json not printing all messages
    
    The previous version of this code stopped printing messages as soon as
    it encountered a deleted or continuation message. This was wrong,
    continuation and deleted messages can be followed by live messages that
    do need to be printed.
    
    gcc/ada/
    
            * errout.adb (Output_Messages): Fix loop termination condition.

Diff:
---
 gcc/ada/errout.adb | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 1c6222b3a29..6e378a60731 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -3062,16 +3062,19 @@ package body Errout is
 
             E := Errors.Table (E).Next;
 
-            --  Skip deleted messages.
-            --  Also skip continuation messages, as they have already been
-            --  printed along the message they're attached to.
+            while E /= No_Error_Msg loop
+
+               --  Skip deleted messages.
+               --  Also skip continuation messages, as they have already been
+               --  printed along the message they're attached to.
+
+               if not Errors.Table (E).Deleted
+                 and then not Errors.Table (E).Msg_Cont
+               then
+                  Write_Char (',');
+                  Output_JSON_Message (E);
+               end if;
 
-            while E /= No_Error_Msg
-              and then not Errors.Table (E).Deleted
-              and then not Errors.Table (E).Msg_Cont
-            loop
-               Write_Char (',');
-               Output_JSON_Message (E);
                E := Errors.Table (E).Next;
             end loop;
          end if;

                 reply	other threads:[~2023-06-20  7:46 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=20230620074621.874BF3857C43@sourceware.org \
    --to=dkm@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).