diff options
Diffstat (limited to 'gcc/ada/osint.adb')
-rw-r--r-- | gcc/ada/osint.adb | 79 |
1 files changed, 64 insertions, 15 deletions
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb index 04e2919cc24..00d0eb88d71 100644 --- a/gcc/ada/osint.adb +++ b/gcc/ada/osint.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -29,6 +29,8 @@ with System.Case_Util; use System.Case_Util; with GNAT.HTable; +with Alloc; +with Debug; with Fmap; use Fmap; with Gnatvsn; use Gnatvsn; with Hostparm; @@ -111,6 +113,9 @@ package body Osint is -- Converts a C String to an Ada String. Are we doing this to avoid withing -- Interfaces.C.Strings ??? + function Include_Dir_Default_Prefix return String_Access; + -- Same as exported version, except returns a String_Access + ------------------------------ -- Other Local Declarations -- ------------------------------ @@ -137,6 +142,20 @@ package body Osint is -- latest source, library and object files opened by Read_Source_File and -- Read_Library_Info. + package File_Name_Chars is new Table.Table ( + Table_Component_Type => Character, + Table_Index_Type => Int, + Table_Low_Bound => 1, + Table_Initial => Alloc.File_Name_Chars_Initial, + Table_Increment => Alloc.File_Name_Chars_Increment, + Table_Name => "File_Name_Chars"); + -- Table to store text to be printed by Dump_Source_File_Names + + The_Include_Dir_Default_Prefix : String_Access := null; + -- Value returned by Include_Dir_Default_Prefix. We don't initialize it + -- here, because that causes an elaboration cycle with Sdefault; we + -- initialize it lazily instead. + ------------------ -- Search Paths -- ------------------ @@ -717,6 +736,16 @@ package body Osint is end if; end Dir_In_Src_Search_Path; + ---------------------------- + -- Dump_Source_File_Names -- + ---------------------------- + + procedure Dump_Source_File_Names is + subtype Rng is Int range File_Name_Chars.First .. File_Name_Chars.Last; + begin + Write_Str (String (File_Name_Chars.Table (Rng))); + end Dump_Source_File_Names; + --------------------- -- Executable_Name -- --------------------- @@ -1392,22 +1421,19 @@ package body Osint is -- Include_Dir_Default_Prefix -- -------------------------------- - function Include_Dir_Default_Prefix return String is - Include_Dir : String_Access := - String_Access (Update_Path (Include_Dir_Default_Name)); - + function Include_Dir_Default_Prefix return String_Access is begin - if Include_Dir = null then - return ""; - - else - declare - Result : constant String := Include_Dir.all; - begin - Free (Include_Dir); - return Result; - end; + if The_Include_Dir_Default_Prefix = null then + The_Include_Dir_Default_Prefix := + String_Access (Update_Path (Include_Dir_Default_Name)); end if; + + return The_Include_Dir_Default_Prefix; + end Include_Dir_Default_Prefix; + + function Include_Dir_Default_Prefix return String is + begin + return Include_Dir_Default_Prefix.all; end Include_Dir_Default_Prefix; ---------------- @@ -2268,6 +2294,29 @@ package body Osint is return; end if; + -- Print out the file name, if requested, and if it's not part of the + -- runtimes, store it in File_Name_Chars. + + declare + Name : String renames Name_Buffer (1 .. Name_Len); + Inc : String renames Include_Dir_Default_Prefix.all; + begin + if Debug.Debug_Flag_Dot_N then + Write_Line (Name); + end if; + + if Inc /= "" + and then Inc'Length < Name_Len + and then Name_Buffer (1 .. Inc'Length) = Inc + then + null; -- Part of runtimes, so ignore it + + else + File_Name_Chars.Append_All (File_Name_Chars.Table_Type (Name)); + File_Name_Chars.Append (ASCII.LF); + end if; + end; + -- Prepare to read data from the file Len := Integer (File_Length (Source_File_FD)); |