From: Viljar Indus Date: Thu, 7 Aug 2025 10:36:55 +0000 (+0300) Subject: ada: Add location info to policy difference errors X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a1b7ea3ef93a5cef11d8202ffd9160dd623e82be;p=thirdparty%2Fgcc.git ada: Add location info to policy difference errors gcc/ada/ChangeLog: * ghost.adb (Check_Ghost_Completion): Add location info to the policy messages. (Check_Ghost_Policy): Likwise. --- diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index 9474beb26b2..f0c62f3dc06 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -216,19 +216,19 @@ package body Ghost is if Is_Checked_Ghost_Entity (Prev_Id) and then Policy = Name_Ignore then - Error_Msg_Sloc := Sloc (Compl_Id); - Error_Msg_N (Ghost_Policy_Error_Msg, Prev_Id); - Error_Msg_N ("\& declared with ghost policy `Check`", Prev_Id); + Error_Msg_Sloc := Sloc (Prev_Id); + Error_Msg_N ("\& declared # with ghost policy `Check`", Prev_Id); + Error_Msg_Sloc := Sloc (Compl_Id); Error_Msg_N ("\& completed # with ghost policy `Ignore`", Prev_Id); elsif Is_Ignored_Ghost_Entity (Prev_Id) and then Policy = Name_Check then - Error_Msg_Sloc := Sloc (Compl_Id); - Error_Msg_N (Ghost_Policy_Error_Msg, Prev_Id); - Error_Msg_N ("\& declared with ghost policy `Ignore`", Prev_Id); + Error_Msg_Sloc := Sloc (Prev_Id); + Error_Msg_N ("\& declared # with ghost policy `Ignore`", Prev_Id); + Error_Msg_Sloc := Sloc (Compl_Id); Error_Msg_N ("\& completed # with ghost policy `Check`", Prev_Id); end if; end Check_Ghost_Completion; @@ -871,7 +871,8 @@ package body Ghost is and then Known_To_Be_Assigned (Ref) then Error_Msg_N (Ghost_Policy_Error_Msg, Ref); - Error_Msg_NE ("\& declared with ghost policy `Check`", Ref, Id); + Error_Msg_Sloc := Sloc (Id); + Error_Msg_NE ("\& declared # with ghost policy `Check`", Ref, Id); Error_Msg_Sloc := Sloc (Ref); Error_Msg_NE ("\& used # with ghost policy `Ignore`", Ref, Id); end if; @@ -892,7 +893,8 @@ package body Ghost is if Is_Ignored_Ghost_Entity (Id) and then Applic_Policy = Check then Error_Msg_N (Ghost_Policy_Error_Msg, Ref); - Error_Msg_NE ("\& declared with ghost policy `Ignore`", Ref, Id); + Error_Msg_Sloc := Sloc (Id); + Error_Msg_NE ("\& declared # with ghost policy `Ignore`", Ref, Id); Error_Msg_Sloc := Sloc (Ref); Error_Msg_NE ("\& used # with ghost policy `Check`", Ref, Id); end if;