aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2021-12-23 02:27:43 +0000
committerPierre-Marie de Rodat <derodat@adacore.com>2022-01-11 13:24:49 +0000
commit10608753db567042934872db8447f13eb15b5f8b (patch)
treebf955ffd2b06beb6cd777c41229c163405cdde3a /gcc
parent805655c137088519751e4ca18df722355a512d88 (diff)
downloadgcc-10608753db567042934872db8447f13eb15b5f8b.zip
gcc-10608753db567042934872db8447f13eb15b5f8b.tar.gz
gcc-10608753db567042934872db8447f13eb15b5f8b.tar.bz2
[Ada] Include generic instance names in non-visible entity errors
gcc/ada/ * sem_ch8.adb (Nvis_Messages): Add generic instance name to error message.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch8.adb23
1 files changed, 21 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index e5b019c..e575602 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;