When discovering violation of the No_Elaboration_Code restriction it is
enough to find one unit that violates it; we don't need to examine all
units.

Code cleanup; semantics is unaffected.

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

gcc/ada/

        * lib-writ.adb (Write_ALI): Exit from loop after seeing first
        unit that violates No_Elaboration_Code restriction.
diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb
--- a/gcc/ada/lib-writ.adb
+++ b/gcc/ada/lib-writ.adb
@@ -1256,6 +1256,7 @@ package body Lib.Writ is
          if Units.Table (Unit).Generate_Code or else Unit = Main_Unit then
             if not Has_No_Elaboration_Code (Cunit (Unit)) then
                Main_Restrictions.Violated (No_Elaboration_Code) := True;
+               exit;
             end if;
          end if;
       end loop;


Reply via email to