From 477b99b63b10d050198e60bf44d8c1d3d89d5a0b Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 27 Oct 2009 14:06:06 +0100 Subject: [multiple changes] 2009-10-27 Arnaud Charlet * exp_aggr.adb: Fix comment. 2009-10-27 Emmanuel Briot * prj-err.adb (Error_Msg): take into account continuation lines when computing whether we have a warning. 2009-10-27 Vasiliy Fofanov * make.adb, s-os_lib.adb, s-os_lib.ads (Create_Temp_Output_File): New routine that is designed to create temp file descriptor specifically for redirecting an output stream. From-SVN: r153591 --- gcc/ada/s-os_lib.adb | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'gcc/ada/s-os_lib.adb') diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb index 0f2081a..a3f4b49 100755 --- a/gcc/ada/s-os_lib.adb +++ b/gcc/ada/s-os_lib.adb @@ -80,6 +80,15 @@ package body System.OS_Lib is -- Returns total number of characters needed to create a string -- of all Args terminated by ASCII.NUL characters + procedure Create_Temp_File_Internal + (FD : out File_Descriptor; + Name : out String_Access; + Stdout : Boolean); + -- Internal routine to implement two Create_Temp_File routines. If Stdout + -- is set to True the created descriptor is stdout-compatible, otherwise + -- it might not be depending on the OS (VMS is one example). The first two + -- parameters are as in Create_Temp_File. + function C_String_Length (S : Address) return Integer; -- Returns the length of a C string. Does check for null address -- (returns 0). @@ -749,6 +758,27 @@ package body System.OS_Lib is (FD : out File_Descriptor; Name : out String_Access) is + begin + Create_Temp_File_Internal (FD, Name, Stdout => False); + end Create_Temp_File; + + procedure Create_Temp_Output_File + (FD : out File_Descriptor; + Name : out String_Access) + is + begin + Create_Temp_File_Internal (FD, Name, Stdout => True); + end Create_Temp_Output_File; + + ------------------------------- + -- Create_Temp_File_Internal -- + ------------------------------- + + procedure Create_Temp_File_Internal + (FD : out File_Descriptor; + Name : out String_Access; + Stdout : Boolean) + is Pos : Positive; Attempts : Natural := 0; Current : String (Current_Temp_File_Name'Range); @@ -814,7 +844,11 @@ package body System.OS_Lib is -- Attempt to create the file - FD := Create_New_File (Current, Binary); + if Stdout then + FD := Create_Output_Text_File (Current); + else + FD := Create_File (Current, Binary); + end if; if FD /= Invalid_FD then Name := new String'(Current); @@ -836,7 +870,7 @@ package body System.OS_Lib is end if; end if; end loop File_Loop; - end Create_Temp_File; + end Create_Temp_File_Internal; ----------------- -- Delete_File -- -- cgit v1.1