From: Robert Dewar Date: Wed, 26 Sep 2007 10:46:43 +0000 (+0200) Subject: sem_warn.adb (Check_References): Catch more cases of unreferenced packages. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1cc40a1063aa7b00784da59111d9bb9a770929c1;p=gcc.git sem_warn.adb (Check_References): Catch more cases of unreferenced packages. 2007-09-26 Robert Dewar * sem_warn.adb (Check_References): Catch more cases of unreferenced packages. From-SVN: r128805 --- diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 2869cfd4d87..3faf9cb09d6 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -1140,14 +1140,21 @@ package body Sem_Warn is Ekind (E1) = E_Named_Real or else Is_Overloadable (E1) + + -- Package case, if the main unit is a package + -- spec or generic package spec, then there may + -- be a corresponding body that references this + -- package in some other file. Otherwise we can + -- be sure that there is no other reference. + or else (Ekind (E1) = E_Package - and then - (Ekind (E) = E_Function - or else Ekind (E) = E_Package_Body - or else Ekind (E) = E_Procedure - or else Ekind (E) = E_Subprogram_Body - or else Ekind (E) = E_Block))) + and then + Ekind (Cunit_Entity (Current_Sem_Unit)) /= + E_Package + and then + Ekind (Cunit_Entity (Current_Sem_Unit)) /= + E_Generic_Package)) -- Exclude instantiations, since there is no reason why every -- entity in an instantiation should be referenced.