+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>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: When
-- 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
Typ : constant Entity_Id := Etype (N);
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
return;
-- --
------------------------------------------------------------------------------
+with Err_Vars;
with Output; use Output;
with Stringt; use Stringt;
if Flags.Report_Error /= null then
Flags.Report_Error
(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 Error_Msg;
-- 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).
procedure Create_Temp_File
(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;
-- 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);
end if;
end if;
end loop File_Loop;
- end Create_Temp_File;
+ end Create_Temp_File_Internal;
-----------------
-- Delete_File --
Name : out String_Access);
-- Create and open for writing a temporary file in the current working
-- 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
- -- no point in doing text translation on it. It is the responsibility of
- -- the caller to deallocate the access value returned in Name.
+ -- It is the responsibility of 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
-- writable. If the current working directory is not writable, then