diff options
author | Thomas Quinot <quinot@adacore.com> | 2014-02-24 16:54:41 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-02-24 17:54:41 +0100 |
commit | 3e5b1f324798b549d61995939bf09e1728bacb95 (patch) | |
tree | 7da7de3843015498f4fd50b583ef216d74825c10 /gcc/ada/s-fileio.adb | |
parent | c6d2191a0da9f40899da20933f008242f90262e0 (diff) | |
download | gcc-3e5b1f324798b549d61995939bf09e1728bacb95.zip gcc-3e5b1f324798b549d61995939bf09e1728bacb95.tar.gz gcc-3e5b1f324798b549d61995939bf09e1728bacb95.tar.bz2 |
s-fileio.adb (Errno_Message): Remove, use shared version from s-os_lib instead.
2014-02-24 Thomas Quinot <quinot@adacore.com>
* s-fileio.adb (Errno_Message): Remove, use shared version from
s-os_lib instead.
* s-crtrun.ads, Makefile.rtl: Remove now unused unit.
* g-stseme (Socket_Error_Message): Reimplement in terms of new
s-os_lib function.
* g-socthi.ads, g-socthi.adb: Change profile of
Socket_Error_Message to return String to allow the above.
* g-socket.adb, g-socthi-mingw.adb, g-socthi-mingw.ads,
* g-socthi-vms.adb, g-socthi-vms.ads, g-socthi-vxworks.adb,
* g-socthi-vxworks.ads: Update to account for the above profile
change.
* a-tags.adb: Use strlen builtin binding provided by s-crtl.
* s-crtl.ads (strncpy): New procedure.
* s-os_lib.adb (Copy_Attributes): Import just once (strncpy):
Use import from s-crtl.
* a-envvar.adb, osint.adb: Use imports of C runtime functions
from s-crtl instead of re-importing locally.
From-SVN: r208079
Diffstat (limited to 'gcc/ada/s-fileio.adb')
-rw-r--r-- | gcc/ada/s-fileio.adb | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb index 01313a0..c166729 100644 --- a/gcc/ada/s-fileio.adb +++ b/gcc/ada/s-fileio.adb @@ -33,10 +33,9 @@ with Ada.Finalization; use Ada.Finalization; with Ada.IO_Exceptions; use Ada.IO_Exceptions; with Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; with Interfaces.C_Streams; use Interfaces.C_Streams; -with System.CRTL.Runtime; +with System.CRTL; with System.Case_Util; use System.Case_Util; with System.OS_Lib; with System.Soft_Links; @@ -130,15 +129,9 @@ package body System.File_IO is -- the access method from the Access_Method field of the FCB. function Errno_Message - (Errno : Integer := OS_Lib.Errno) return String; - function Errno_Message - (Name : String; + (Name : String; Errno : Integer := OS_Lib.Errno) return String; - -- Return a message suitable for "raise ... with Errno_Message (...)". - -- Errno defaults to the current errno, but should be passed explicitly if - -- there is significant code in between the call that sets errno and the - -- call to Errno_Message, in case that code also sets errno. The version - -- with Name includes that file name in the message. + -- Return Errno_Message for Errno, with file name prepended procedure Raise_Device_Error (File : AFCB_Ptr; @@ -241,7 +234,7 @@ package body System.File_IO is Close_Status : int := 0; Dup_Strm : Boolean := False; File : AFCB_Ptr renames File_Ptr.all; - Errno : Integer; + Errno : Integer := 0; begin -- Take a task lock, to protect the global data value Open_Files @@ -351,7 +344,7 @@ package body System.File_IO is -- we did the open, and we want to unlink the right file. if unlink (Filename'Address) = -1 then - raise Use_Error with Errno_Message; + raise Use_Error with OS_Lib.Errno_Message; end if; end; end Delete; @@ -383,23 +376,12 @@ package body System.File_IO is -- Errno_Message -- ------------------- - function Errno_Message (Errno : Integer := OS_Lib.Errno) return String is - Message : constant chars_ptr := CRTL.Runtime.strerror (Errno); - - begin - if Message = Null_Ptr then - return "errno =" & Errno'Img; - else - return Value (Message); - end if; - end Errno_Message; - function Errno_Message (Name : String; Errno : Integer := OS_Lib.Errno) return String is begin - return Name & ": " & String'(Errno_Message (Errno)); + return Name & ": " & OS_Lib.Errno_Message (Err => Errno); end Errno_Message; -------------- @@ -1321,7 +1303,7 @@ package body System.File_IO is clearerr (File.Stream); end if; - raise Device_Error with Errno_Message (Errno); + raise Device_Error with OS_Lib.Errno_Message (Err => Errno); end Raise_Device_Error; -------------- |