]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Avoid creating continuation messages without an intended parent
authorViljar Indus <indus@adacore.com>
Wed, 14 Aug 2024 12:24:10 +0000 (15:24 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 29 Aug 2024 13:06:27 +0000 (15:06 +0200)
The messages modified in this patch do not have a clear intended
parent. This causes a lot of issues when grouping continuation
messages together with their parent. This can be confusing as it
is not obvious what was the parent message that caused this
problem or in worst case scenarios the message not being printed
alltogether.

These modified messages do not seem to be related to any concrete
error message and thus should be treated as independent messages.

gcc/ada/

* sem_ch12.adb (Abandon_Instantiation): Remove continuation
characters from the error message.
* sem_ch13.adb (Check_False_Aspect_For_Derived_Type): Remove
continuation characters from the error message.
* sem_ch6.adb (Assert_False): Avoid creating a continuation
message without a parent. If no primary message is created then
the message is considered as primary.

gcc/testsuite/ChangeLog:

* gnat.dg/interface6.adb: Adjust test.

gcc/ada/sem_ch12.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch6.adb
gcc/testsuite/gnat.dg/interface6.adb

index 686aa3208fb5790c08e636b83dedbc9e9f96e812..b406cfce3b3285019711fadfb883df1322deb4a3 100644 (file)
@@ -2295,7 +2295,7 @@ package body Sem_Ch12 is
 
    procedure Abandon_Instantiation (N : Node_Id) is
    begin
-      Error_Msg_N ("\instantiation abandoned!", N);
+      Error_Msg_N ("instantiation abandoned!", N);
       raise Instantiation_Error;
    end Abandon_Instantiation;
 
index a55ba3c7bd9a7cbaf348179a68c93e7bf8677f17..5cea155dc1e3944de5a823dc301d8cf6989311f8 100644 (file)
@@ -1247,7 +1247,7 @@ package body Sem_Ch13 is
 
                      if Etype (Expression (ASN)) = Any_Type then
                         Error_Msg_NE
-                          ("\aspect must be fully defined before & is frozen",
+                          ("aspect must be fully defined before & is frozen",
                            ASN, E);
                      end if;
 
index 461bdfcbe4b03355357f57ee562887a2133ae852..86d784543f38f4611b31c99e2b24fcd2f6c96934 100644 (file)
@@ -7361,6 +7361,8 @@ package body Sem_Ch6 is
                   Error_Msg_N
                     ("implied return after this statement would have raised "
                      & "Program_Error", Last_Stm);
+                  Error_Msg_NE
+                    ("\procedure & is marked as No_Return!", Last_Stm, Proc);
 
                --  In normal compilation mode, do not warn on a generated call
                --  (e.g. in the body of a renaming as completion).
@@ -7369,11 +7371,15 @@ package body Sem_Ch6 is
                   Error_Msg_N
                     ("implied return after this statement will raise "
                      & "Program_Error??", Last_Stm);
+
+                  Error_Msg_NE
+                    ("\procedure & is marked as No_Return??!", Last_Stm, Proc);
+               else
+
+                  Error_Msg_NE
+                    ("procedure & is marked as No_Return!", Last_Stm, Proc);
                end if;
 
-               Error_Msg_Warn := SPARK_Mode /= On;
-               Error_Msg_NE
-                 ("\procedure & is marked as No_Return<<!", Last_Stm, Proc);
             end if;
 
             declare
index 556a0b73c92ea479f95b91eb867f0dea4e9750e9..388b00905995339b3eb5a94e2543be278b938122 100644 (file)
@@ -36,6 +36,7 @@ procedure Interface6 is
 
      procedure Test_Instance1 is new Test (T => Rec_Type);  --  { dg-error "actual must implement all interfaces of formal \"T\"" }
      procedure Test_Instance1 is new Test (T => Rec_Type1);  -- { dg-error "actual \"Rec_Type1\" must implement interface \"TI2\"" }
+     -- { dg-error "instantiation abandoned" "" { target *-*-* } 37 }
      procedure Test_Instance2 is new Test (T => Rec_Type2);
      procedure Test_Instance12 is new Test (T => Rec_Type12);