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.adb10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index f4ce099..4e4f83d 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -268,6 +268,8 @@ package body Sem_Ch10 is
------------------------------
procedure Analyze_Compilation_Unit (N : Node_Id) is
+ Unit_Node : constant Node_Id := Unit (N);
+
procedure Check_Redundant_Withs
(Context_Items : List_Id;
Spec_Context_Items : List_Id := No_List);
@@ -587,6 +589,13 @@ package body Sem_Ch10 is
-- Standalone package spec or body check
else
+ if Is_Ancestor_Package (Entity (Name (Clause)),
+ Defining_Entity (Unit_Node))
+ then
+ Error_Msg_N
+ ("unnecessary with of ancestor?r?", Clause);
+ end if;
+
declare
Dummy : Boolean := False;
Withed : Boolean := False;
@@ -617,7 +626,6 @@ package body Sem_Ch10 is
-- Local variables
Main_Cunit : constant Node_Id := Cunit (Main_Unit);
- Unit_Node : constant Node_Id := Unit (N);
Lib_Unit : Node_Id := Library_Unit (N);
Par_Spec_Name : Unit_Name_Type;
Spec_Id : Entity_Id;