public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6471] [Ada] Include generic instance names in non-visible entity errors Date: Tue, 11 Jan 2022 13:28:41 +0000 (GMT) [thread overview] Message-ID: <20220111132841.9466938A9425@sourceware.org> (raw) https://gcc.gnu.org/g:10608753db567042934872db8447f13eb15b5f8b commit r12-6471-g10608753db567042934872db8447f13eb15b5f8b Author: Justin Squirek <squirek@adacore.com> Date: Thu Dec 23 02:27:43 2021 +0000 [Ada] Include generic instance names in non-visible entity errors gcc/ada/ * sem_ch8.adb (Nvis_Messages): Add generic instance name to error message. Diff: --- gcc/ada/sem_ch8.adb | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index e5b019c3019..e5756029246 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -5689,8 +5689,27 @@ package body Sem_Ch8 is null; else - Error_Msg_N -- CODEFIX - ("non-visible declaration#!", N); + -- When the entity comes from a generic instance the + -- normal error message machinery will give the line + -- number of the generic package and the location of + -- the generic instance, but not the name of the + -- the instance. + + -- So, in order to give more descriptive error messages + -- in this case, we include the name of the generic + -- package. + + if Is_Generic_Instance (Scope (Ent)) then + Error_Msg_Name_1 := Chars (Scope (Ent)); + Error_Msg_N -- CODEFIX + ("non-visible declaration from %#!", N); + + -- Otherwise print the message normally + + else + Error_Msg_N -- CODEFIX + ("non-visible declaration#!", N); + end if; if Ekind (Scope (Ent)) /= E_Generic_Package then Found := True;
reply other threads:[~2022-01-11 13:28 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=20220111132841.9466938A9425@sourceware.org \ --to=pmderodat@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).