From 4825bbfebc3584765bb9e17c925a81f1853e1a75 Mon Sep 17 00:00:00 2001 From: Viljar Indus Date: Wed, 14 Aug 2024 15:24:10 +0300 Subject: ada: Avoid creating continuation messages without an intended parent 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 | 2 +- gcc/ada/sem_ch13.adb | 2 +- gcc/ada/sem_ch6.adb | 12 +++++++++--- gcc/testsuite/gnat.dg/interface6.adb | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 686aa32..b406cfc 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -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; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index a55ba3c..5cea155 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -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; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 461bdfc..86d7845 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -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< 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); -- cgit v1.1