sem_warn.adb (Check_References): Catch more cases of unreferenced packages.
authorRobert Dewar <dewar@adacore.com>
Wed, 26 Sep 2007 10:46:43 +0000 (12:46 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 26 Sep 2007 10:46:43 +0000 (12:46 +0200)
2007-09-26  Robert Dewar  <dewar@adacore.com>

* sem_warn.adb (Check_References): Catch more cases of unreferenced
packages.

From-SVN: r128805

gcc/ada/sem_warn.adb

index 2869cfd4d87d9c30d37dbe27eaade6af81b2938a..3faf9cb09d6ec6761f2d10203768ca5fbebf5398 100644 (file)
@@ -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.