public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Yannick Moy <moy@adacore.com>
Subject: [COMMITTED] ada: Allow warnings with explain code
Date: Tue, 18 Jul 2023 15:13:23 +0200	[thread overview]
Message-ID: <20230718131323.80823-1-poulhies@adacore.com> (raw)

From: Yannick Moy <moy@adacore.com>

Change the way explain codes are handled to generate the command for the
user to get the explanations, as this was not working for warnings.

gcc/ada/

	* errout.adb (Error_Msg_Internal): Remove call to
	Prescan_Message on the special continuation for the explain code
	command, as this does not play well with the setting of global
	variables for the message (like its status as a warning or not).
	Instead, set directly the global variables regarding content of
	the message in terms of special characters.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/errout.adb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index adc260843ec..ac6491cf299 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -1451,10 +1451,12 @@ package body Errout is
       if Has_Error_Code then
          declare
             Msg : constant String :=
-              "launch ""gnatprove --explain=[]"" for more information";
+              "\launch ""gnatprove --explain=[]"" for more information";
          begin
-            Prescan_Message (Msg);
+            Has_Double_Exclam := False;
             Has_Error_Code := False;
+            Has_Insertion_Line := False;
+
             Error_Msg_Internal
               (Msg      => Msg,
                Span     => Span,
-- 
2.40.0


                 reply	other threads:[~2023-07-18 13:13 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=20230718131323.80823-1-poulhies@adacore.com \
    --to=poulhies@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=moy@adacore.com \
    /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).