Cleanup related to loading of compilation units.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * lib.adb (Remove_Unit): Replace defensive code with an
        assertion.
        * par-load.adb (Load): Address a question mark in the comment.
diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb
--- a/gcc/ada/lib.adb
+++ b/gcc/ada/lib.adb
@@ -1174,10 +1174,9 @@ package body Lib is
 
    procedure Remove_Unit (U : Unit_Number_Type) is
    begin
-      if U = Units.Last then
-         Unit_Names.Set (Unit_Name (U), No_Unit);
-         Units.Decrement_Last;
-      end if;
+      pragma Assert (U = Units.Last);
+      Unit_Names.Set (Unit_Name (U), No_Unit);
+      Units.Decrement_Last;
    end Remove_Unit;
 
    ----------------------------------


diff --git a/gcc/ada/par-load.adb b/gcc/ada/par-load.adb
--- a/gcc/ada/par-load.adb
+++ b/gcc/ada/par-load.adb
@@ -234,8 +234,7 @@ begin
          Error_Msg ("\\found unit $!", Loc);
       end if;
 
-      --  In both cases, remove the unit if it is the last unit (which it
-      --  normally (always?) will be) so that it is out of the way later.
+      --  In both cases, remove the unit so that it is out of the way later
 
       Remove_Unit (Cur_Unum);
    end if;


Reply via email to