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-5042] [Ada] Invalid GPR_PROJECT_PATH_FILE confuses gnatls Date: Tue, 9 Nov 2021 09:47:42 +0000 (GMT) [thread overview] Message-ID: <20211109094742.68A0C3858415@sourceware.org> (raw) https://gcc.gnu.org/g:a2e4ebe02b1be5ee81b24ff504f58ac9078953c0 commit r12-5042-ga2e4ebe02b1be5ee81b24ff504f58ac9078953c0 Author: Justin Squirek <squirek@adacore.com> Date: Fri Oct 29 15:42:28 2021 -0400 [Ada] Invalid GPR_PROJECT_PATH_FILE confuses gnatls gcc/ada/ * gnatls.adb (Initialize_Default_Project_Path): Remove early abort on invalid path. Diff: --- gcc/ada/gnatls.adb | 82 ++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/gcc/ada/gnatls.adb b/gcc/ada/gnatls.adb index 68990e19605..b20cda4fdd6 100644 --- a/gcc/ada/gnatls.adb +++ b/gcc/ada/gnatls.adb @@ -1339,61 +1339,57 @@ procedure Gnatls is if Gpr_Prj_Path_File.all /= "" then FD := Open_Read (Gpr_Prj_Path_File.all, GNAT.OS_Lib.Text); - if FD = Invalid_FD then - Osint.Fail - ("warning: could not read project path file """ - & Gpr_Prj_Path_File.all & """"); - end if; + if FD /= Invalid_FD then + Len := Integer (File_Length (FD)); - Len := Integer (File_Length (FD)); + declare + Buffer : String (1 .. Len); + Index : Positive := 1; + Last : Positive; + Tmp : String_Access; - declare - Buffer : String (1 .. Len); - Index : Positive := 1; - Last : Positive; - Tmp : String_Access; + begin + -- Read the file - begin - -- Read the file + Len := Read (FD, Buffer (1)'Address, Len); + Close (FD); - Len := Read (FD, Buffer (1)'Address, Len); - Close (FD); + -- Scan the file line by line - -- Scan the file line by line + while Index < Buffer'Last loop - while Index < Buffer'Last loop + -- Find the end of line - -- Find the end of line + Last := Index; + while Last <= Buffer'Last + and then Buffer (Last) /= ASCII.LF + and then Buffer (Last) /= ASCII.CR + loop + Last := Last + 1; + end loop; - Last := Index; - while Last <= Buffer'Last - and then Buffer (Last) /= ASCII.LF - and then Buffer (Last) /= ASCII.CR - loop - Last := Last + 1; - end loop; - - -- Ignore empty lines + -- Ignore empty lines - if Last > Index then - Tmp := Self; - Self := - new String' - (Tmp.all & Path_Separator & - Buffer (Index .. Last - 1)); - Free (Tmp); - end if; + if Last > Index then + Tmp := Self; + Self := + new String' + (Tmp.all & Path_Separator & + Buffer (Index .. Last - 1)); + Free (Tmp); + end if; - -- Find the beginning of the next line + -- Find the beginning of the next line - Index := Last; - while Buffer (Index) = ASCII.CR or else - Buffer (Index) = ASCII.LF - loop - Index := Index + 1; + Index := Last; + while Buffer (Index) = ASCII.CR or else + Buffer (Index) = ASCII.LF + loop + Index := Index + 1; + end loop; end loop; - end loop; - end; + end; + end if; end if;
reply other threads:[~2021-11-09 9:47 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=20211109094742.68A0C3858415@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).