public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6471] [Ada] Include generic instance names in non-visible entity errors
@ 2022-01-11 13:28 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-11 13:28 UTC (permalink / raw)
To: gcc-cvs
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-11 13:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 13:28 [gcc r12-6471] [Ada] Include generic instance names in non-visible entity errors Pierre-Marie de Rodat
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).