[COMMITTED] ada: Allow warnings with explain code

Message ID 20230718131323.80823-1-poulhies@adacore.com
State Unresolved
Headers
Series [COMMITTED] ada: Allow warnings with explain code |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Marc Poulhiès July 18, 2023, 1:13 p.m. UTC
  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(-)
  

Patch

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,