From: Bob Duff Date: Wed, 18 Dec 2019 07:14:07 +0000 (+0000) Subject: [Ada] Bad "already use-visible" warning re: use in private part X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f691cb20d7a83dc332ae538f23fcae14a07522d;p=gcc.git [Ada] Bad "already use-visible" warning re: use in private part 2019-12-18 Bob Duff 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 --- 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 + + * 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 * 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