sem_ch10.adb (Optional_Subunit): If file of expected subunit is empty, post message...
authorEd Schonberg <schonber@gnat.com>
Wed, 27 Oct 2004 13:40:29 +0000 (15:40 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 27 Oct 2004 13:40:29 +0000 (15:40 +0200)
2004-10-26  Ed Schonberg  <schonberg@gnat.com>

* sem_ch10.adb (Optional_Subunit): If file of expected subunit is
empty, post message on stub.

From-SVN: r89666

gcc/ada/sem_ch10.adb

index cbdfbc272d953306ed1ae87c69738d6d7d810f3c..b790a936fa88bd09691950a43a40c02d9608c5ef 100644 (file)
@@ -980,7 +980,14 @@ package body Sem_Ch10 is
          then
             Comp_Unit := Cunit (Unum);
 
-            if Nkind (Unit (Comp_Unit)) /= N_Subunit then
+            --  If the file was empty or seriously mangled, the unit
+            --  itself may be missing.
+
+            if No (Unit (Comp_Unit)) then
+               Error_Msg_N
+                 ("subunit does not contain expected proper body", N);
+
+            elsif Nkind (Unit (Comp_Unit)) /= N_Subunit then
                Error_Msg_N
                  ("expected SEPARATE subunit, found child unit",
                   Cunit_Entity (Unum));