public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2141] [Ada] Avoid linear search when ensuring dependency on System Date: Thu, 8 Jul 2021 13:35:58 +0000 (GMT) [thread overview] Message-ID: <20210708133558.675FE398B87E@sourceware.org> (raw) https://gcc.gnu.org/g:79a8b14237eca20a0e8256f5683d6ca092f38a0b commit r12-2141-g79a8b14237eca20a0e8256f5683d6ca092f38a0b Author: Piotr Trojanek <trojanek@adacore.com> Date: Mon May 24 16:14:40 2021 +0200 [Ada] Avoid linear search when ensuring dependency on System gcc/ada/ * lib-writ.adb (Ensure_System_Dependency): Replace search in Lib.Units with a search in Lib.Unit_Names. Diff: --- gcc/ada/lib-writ.adb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb index 416052c943e..1b2912a53b2 100644 --- a/gcc/ada/lib-writ.adb +++ b/gcc/ada/lib-writ.adb @@ -137,7 +137,8 @@ package body Lib.Writ is ------------------------------ procedure Ensure_System_Dependency is - System_Uname : Unit_Name_Type; + System_Uname : constant Unit_Name_Type := + Name_To_Unit_Name (Name_System); -- Unit name for system spec if needed for dummy entry System_Fname : File_Name_Type; @@ -146,11 +147,9 @@ package body Lib.Writ is begin -- Nothing to do if we already compiled System - for Unum in Units.First .. Last_Unit loop - if Source_Index (Unum) = System_Source_File_Index then - return; - end if; - end loop; + if Unit_Names.Get (System_Uname) /= No_Unit then + return; + end if; -- If no entry for system.ads in the units table, then add a entry -- to the units table for system.ads, which will be referenced when @@ -158,7 +157,6 @@ package body Lib.Writ is -- on system as a result of Targparm scanning the system.ads file to -- determine the target dependent parameters for the compilation. - System_Uname := Name_To_Unit_Name (Name_System); System_Fname := File_Name (System_Source_File_Index); Units.Increment_Last;
reply other threads:[~2021-07-08 13:35 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210708133558.675FE398B87E@sourceware.org \ --to=pmderodat@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).