summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2019-12-18 07:14:07 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-12-18 07:14:07 +0000
commit4f691cb20d7a83dc332ae538f23fcae14a07522d (patch)
treeca17caeeca59444158c079437e7ea7b1d920039f /gcc/ada
parent63fdce854307045801a86e9ef242db1612438ec6 (diff)
[Ada] Bad "already use-visible" warning re: use in private part
2019-12-18 Bob Duff <duff@adacore.com> gcc/ada/ * sem_ch8.adb (Note_Redundant_Use): It was already checking for a use clause in the visible part of the child. Add an additional check for a use clause in the context clause of the child. From-SVN: r279504
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_ch8.adb12
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5b1b98c639f..36e5d00b2e8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-18 Bob Duff <duff@adacore.com>
+
+ * sem_ch8.adb (Note_Redundant_Use): It was already checking for
+ a use clause in the visible part of the child. Add an additional
+ check for a use clause in the context clause of the child.
+
2019-12-16 Bob Duff <duff@adacore.com>
* errout.adb (Handle_Serious_Error): Disable the above-mentioned
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index a1a5274d078..f083f7c16e7 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -9607,15 +9607,16 @@ package body Sem_Ch8 is
Par : constant Entity_Id := Defining_Entity (Parent (Decl));
Spec : constant Node_Id :=
Specification (Unit (Cunit (Current_Sem_Unit)));
-
+ Cur_List : constant List_Id := List_Containing (Cur_Use);
begin
if Is_Compilation_Unit (Par)
and then Par /= Cunit_Entity (Current_Sem_Unit)
- and then Parent (Cur_Use) = Spec
- and then List_Containing (Cur_Use) =
- Visible_Declarations (Spec)
then
- return;
+ if Cur_List = Context_Items (Cunit (Current_Sem_Unit))
+ or else Cur_List = Visible_Declarations (Spec)
+ then
+ return;
+ end if;
end if;
end;
end if;
@@ -9629,7 +9630,6 @@ package body Sem_Ch8 is
then
Redundant := Clause;
Prev_Use := Cur_Use;
-
end if;
if Present (Redundant) and then Parent (Redundant) /= Prev_Use then