Commit 477b99b6 by Arnaud Charlet

[multiple changes]

2009-10-27  Arnaud Charlet  <charlet@adacore.com>

	* exp_aggr.adb: Fix comment.

2009-10-27  Emmanuel Briot  <briot@adacore.com>

	* prj-err.adb (Error_Msg): take into account continuation lines when
	computing whether we have a warning.

2009-10-27  Vasiliy Fofanov  <fofanov@adacore.com>

	* 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
parent 673beced
2009-10-27 Arnaud Charlet <charlet@adacore.com>
* exp_aggr.adb: Fix comment.
2009-10-27 Emmanuel Briot <briot@adacore.com>
* prj-err.adb (Error_Msg): take into account continuation lines when
computing whether we have a warning.
2009-10-27 Vasiliy Fofanov <fofanov@adacore.com>
* 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.
2009-10-24 Eric Botcazou <ebotcazou@adacore.com> 2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: When * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: When
......
...@@ -509,7 +509,7 @@ package body Exp_Aggr is ...@@ -509,7 +509,7 @@ package body Exp_Aggr is
-- 10. No controlled actions need to be generated for components -- 10. No controlled actions need to be generated for components
-- 11. The backend is a No_VM backend and the array has aliased components -- 11. For a VM back end, the array should have no aliased components
function Backend_Processing_Possible (N : Node_Id) return Boolean is function Backend_Processing_Possible (N : Node_Id) return Boolean is
Typ : constant Entity_Id := Etype (N); Typ : constant Entity_Id := Etype (N);
......
...@@ -7372,7 +7372,7 @@ package body Make is ...@@ -7372,7 +7372,7 @@ package body Make is
Multilib_Gcc_Path := GNAT.OS_Lib.Locate_Exec_On_Path (Multilib_Gcc.all); Multilib_Gcc_Path := GNAT.OS_Lib.Locate_Exec_On_Path (Multilib_Gcc.all);
Create_Temp_File (Output_FD, Output_Name); Create_Temp_Output_File (Output_FD, Output_Name);
if Output_FD = Invalid_FD then if Output_FD = Invalid_FD then
return; return;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Err_Vars;
with Output; use Output; with Output; use Output;
with Stringt; use Stringt; with Stringt; use Stringt;
...@@ -117,7 +118,12 @@ package body Prj.Err is ...@@ -117,7 +118,12 @@ package body Prj.Err is
if Flags.Report_Error /= null then if Flags.Report_Error /= null then
Flags.Report_Error Flags.Report_Error
(Project, (Project,
Is_Warning => Msg (Msg'First) = '?' or else Msg (Msg'First) = '<'); Is_Warning => Msg (Msg'First) = '?'
or else (Msg (Msg'First) = '<'
and then Err_Vars.Error_Msg_Warn)
or else (Msg (Msg'First) = '\'
and then Msg (Msg'First + 1) = '<'
and then Err_Vars.Error_Msg_Warn));
end if; end if;
end Error_Msg; end Error_Msg;
......
...@@ -80,6 +80,15 @@ package body System.OS_Lib is ...@@ -80,6 +80,15 @@ package body System.OS_Lib is
-- Returns total number of characters needed to create a string -- Returns total number of characters needed to create a string
-- of all Args terminated by ASCII.NUL characters -- 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; function C_String_Length (S : Address) return Integer;
-- Returns the length of a C string. Does check for null address -- Returns the length of a C string. Does check for null address
-- (returns 0). -- (returns 0).
...@@ -749,6 +758,27 @@ package body System.OS_Lib is ...@@ -749,6 +758,27 @@ package body System.OS_Lib is
(FD : out File_Descriptor; (FD : out File_Descriptor;
Name : out String_Access) Name : out String_Access)
is 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; Pos : Positive;
Attempts : Natural := 0; Attempts : Natural := 0;
Current : String (Current_Temp_File_Name'Range); Current : String (Current_Temp_File_Name'Range);
...@@ -814,7 +844,11 @@ package body System.OS_Lib is ...@@ -814,7 +844,11 @@ package body System.OS_Lib is
-- Attempt to create the file -- 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 if FD /= Invalid_FD then
Name := new String'(Current); Name := new String'(Current);
...@@ -836,7 +870,7 @@ package body System.OS_Lib is ...@@ -836,7 +870,7 @@ package body System.OS_Lib is
end if; end if;
end if; end if;
end loop File_Loop; end loop File_Loop;
end Create_Temp_File; end Create_Temp_File_Internal;
----------------- -----------------
-- Delete_File -- -- Delete_File --
......
...@@ -245,9 +245,27 @@ package System.OS_Lib is ...@@ -245,9 +245,27 @@ package System.OS_Lib is
Name : out String_Access); Name : out String_Access);
-- Create and open for writing a temporary file in the current working -- Create and open for writing a temporary file in the current working
-- directory. The name of the file and the File Descriptor are returned. -- directory. The name of the file and the File Descriptor are returned.
-- No mode parameter is provided. Since this is a temporary file, there is -- It is the responsibility of the caller to deallocate the access value
-- no point in doing text translation on it. It is the responsibility of -- returned in Name.
-- the caller to deallocate the access value returned in Name. --
-- The file is opened in binary mode (no text translation).
--
-- This procedure will always succeed if the current working directory is
-- writable. If the current working directory is not writable, then
-- Invalid_FD is returned for the file descriptor and null for the Name.
-- There is no race condition problem between processes trying to create
-- temp files at the same time in the same directory.
procedure Create_Temp_Output_File
(FD : out File_Descriptor;
Name : out String_Access);
-- Create and open for writing a temporary file in the current working
-- directory suitable to redirect standard output. The name of the file
-- and the File Descriptor are returned.
-- It is the responsibility of the caller to deallocate the access value
-- returned in Name.
--
-- The file is opened in the mode specified by the With_Mode parameter.
-- --
-- This procedure will always succeed if the current working directory is -- This procedure will always succeed if the current working directory is
-- writable. If the current working directory is not writable, then -- writable. If the current working directory is not writable, then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment