* [Ada] Tune discovery of No_Elaboration_Code restriction
@ 2021-07-07 16:24 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-07 16:24 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 452 bytes --]
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-07 16:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 16:24 [Ada] Tune discovery of No_Elaboration_Code restriction Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).