From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 874BF3857C43; Tue, 20 Jun 2023 07:46:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 874BF3857C43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687247181; bh=DI856Qod33TcYTLLWLzAgEEfB+QtAZX4jWPIe0GsMJk=; h=From:To:Subject:Date:From; b=IQEwUc0OwJH0J0gTdRt2YhL7L3nF11EiDuu3/BNsk3Q0nlM0Fr7Kk1mNglhE5TdtK AwhROi81UvoV2pmSK772uGYLaFowR4VML/wDCbdzW9Oe00wbNxD4FSlscHGiqD5tkc P41e8qKi7vDq2CfD2e7PTU8iP+T27D6jsQh/DKdU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1967] ada: Fix -fdiagnostics-format=json not printing all messages X-Act-Checkin: gcc X-Git-Author: Ghjuvan Lacambre X-Git-Refname: refs/heads/master X-Git-Oldrev: 298a486c58180adddd99c81217b394f7e4d4bd35 X-Git-Newrev: 3404e481d09d49311ef74a8de15d8a72ed240cce Message-Id: <20230620074621.874BF3857C43@sourceware.org> Date: Tue, 20 Jun 2023 07:46:21 +0000 (GMT) List-Id: https://gcc.gnu.org/g:3404e481d09d49311ef74a8de15d8a72ed240cce commit r14-1967-g3404e481d09d49311ef74a8de15d8a72ed240cce Author: Ghjuvan Lacambre 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;