]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix -fdiagnostics-format=json not printing all messages
authorGhjuvan Lacambre <lacambre@adacore.com>
Fri, 26 May 2023 11:26:21 +0000 (13:26 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 20 Jun 2023 07:30:49 +0000 (09:30 +0200)
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.

gcc/ada/errout.adb

index 1c6222b3a2945775f7b941789c25eae3404a6664..6e378a607315dd7a5bb7161f5282fabec80d700f 100644 (file)
@@ -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;