]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Reduce runtime dependencies on stage1
authorArnaud Charlet <charlet@adacore.com>
Mon, 29 Nov 2021 10:04:36 +0000 (10:04 +0000)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 5 Jan 2022 11:32:33 +0000 (11:32 +0000)
gcc/ada/

* osint.adb (File_Names_Equal): Declare To_Lower locally.
* osint.ads (Null_FD): New.
* fmap.adb, sinput-l.adb, targparm.adb: Adapt to changes above.
* switch-b.adb (Scan_Debug_Switches): Use Is_Regular_File to
simplify the bootstrap dependencies.

gcc/ada/fmap.adb
gcc/ada/osint.adb
gcc/ada/osint.ads
gcc/ada/sinput-l.adb
gcc/ada/switch-b.adb
gcc/ada/targparm.adb

index 7a8e082cbb1c8e2fbba05957de488a71aac3df7f..7597eba9cd88e9e8a9ab56e4b0453790d263739b 100644 (file)
@@ -301,7 +301,7 @@ package body Fmap is
       Read_Source_File (Name_Enter (File_Name), 1, Hi, Src, FD, Config);
 
       if Null_Source_Buffer_Ptr (Src) then
-         if FD = Null_FD then
+         if FD = Osint.Null_FD then
             Write_Str ("warning: could not locate mapping file """);
          else
             Write_Str ("warning: no read access for mapping file """);
index cf39128fb7b4e5a8eb9defbeed62a5030d4960cb..a8a6801f9e4045d6bf34ea24d38178b5bbbbe08b 100644 (file)
@@ -1059,6 +1059,21 @@ package body Osint is
    ----------------------
 
    function File_Names_Equal (File1, File2 : String) return Boolean is
+
+      function To_Lower (A : String) return String;
+      --  For bootstrap reasons, we cannot use To_Lower from System.Case_Util
+
+      --------------
+      -- To_Lower --
+      --------------
+
+      function To_Lower (A : String) return String is
+         Result : String := A;
+      begin
+         To_Lower (Result);
+         return Result;
+      end To_Lower;
+
    begin
       if File_Names_Case_Sensitive then
          return File1 = File2;
index f1a9f848c2502ac1cebba66e6219bbcd67513049..f733e65d330f69cb64ea4680c4aa952f59764962 100644 (file)
@@ -52,6 +52,10 @@ package Osint is
    Project_Include_Path_File : constant String := "ADA_PRJ_INCLUDE_FILE";
    Project_Objects_Path_File : constant String := "ADA_PRJ_OBJECTS_FILE";
 
+   Null_FD : constant File_Descriptor := -2;
+   --  Uninitialized file descriptor. Copied from System.OS_Lib for bootstrap
+   --  reasons.
+
    Output_FD : File_Descriptor;
    --  File descriptor for current library info, list, tree, C, H, or binder
    --  output. Only one of these is open at a time, so we need only one FD.
index 2d5efb004244cebd799a51024a51641ba2189515..6a939bc6a880e8f65372155a624805177136efb0 100644 (file)
@@ -420,7 +420,7 @@ package body Sinput.L is
       if Null_Source_Buffer_Ptr (Src) then
          Source_File.Decrement_Last;
 
-         if FD = Null_FD then
+         if FD = Osint.Null_FD then
             return No_Source_File;
          else
             return No_Access_To_Source_File;
index a7359789e5aa156e03d7a2ae9a49d04cfd765921..bea6ab3dc6c28aedaa7888f86ca5cb6a3d3971a2 100644 (file)
@@ -312,7 +312,7 @@ package body Switch.B is
 
             Ptr := Max + 1;
 
-            if not Is_Read_Accessible_File (Force_Elab_Order_File.all) then
+            if not Is_Regular_File (Force_Elab_Order_File.all) then
                Osint.Fail (Force_Elab_Order_File.all & ": file not found");
             end if;
 
index 4390c0ea3e064b3c2add36198d0c83a98dac7625..ade05c25795251ccd405b52835d953c1f1638011 100644 (file)
@@ -165,7 +165,7 @@ package body Targparm is
       if Null_Source_Buffer_Ptr (Text) then
          Write_Line ("fatal error, run-time library not installed correctly");
 
-         if FD = Null_FD then
+         if FD = Osint.Null_FD then
             Write_Line ("cannot locate file system.ads");
          else
             Write_Line ("no read access for file system.ads");