aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch10.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch10.adb')
-rw-r--r--gcc/ada/sem_ch10.adb21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index a443e410052..d3cab12326d 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -2334,12 +2334,10 @@ package body Sem_Ch10 is
end if;
-- Check for inappropriate with of internal implementation unit if we
- -- are currently compiling the main unit and the main unit is itself
- -- not an internal unit. We do not issue this message for implicit
- -- with's generated by the compiler itself.
+ -- are not compiling an internal unit. We do not issue this message
+ -- for implicit with's generated by the compiler itself.
if Implementation_Unit_Warnings
- and then Current_Sem_Unit = Main_Unit
and then not Intunit
and then not Implicit_With (N)
then
@@ -2350,10 +2348,17 @@ package body Sem_Ch10 is
begin
if U_Kind = Implementation_Unit then
Error_Msg_F ("& is an internal 'G'N'A'T unit?", Name (N));
- Error_Msg_F
- ("\use of this unit is non-portable " &
- "and version-dependent?",
- Name (N));
+
+ -- Add alternative name if available, otherwise issue a
+ -- general warning message.
+
+ if Error_Msg_Strlen /= 0 then
+ Error_Msg_F ("\use ""~"" instead", Name (N));
+ else
+ Error_Msg_F
+ ("\use of this unit is non-portable " &
+ "and version-dependent?", Name (N));
+ end if;
elsif U_Kind = Ada_05_Unit
and then Ada_Version < Ada_05