OSDN Git Service

2009-10-27 Arnaud Charlet <charlet@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Oct 2009 13:06:06 +0000 (13:06 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Oct 2009 13:06:06 +0000 (13:06 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153591 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/exp_aggr.adb
gcc/ada/make.adb
gcc/ada/prj-err.adb
gcc/ada/s-os_lib.adb
gcc/ada/s-os_lib.ads

index dae8d31..d23b7c1 100644 (file)
@@ -1,3 +1,18 @@
+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
index 913e46d..75eb8f5 100644 (file)
@@ -509,7 +509,7 @@ package body Exp_Aggr is
 
    --   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);
index dacf290..c7eab81 100644 (file)
@@ -7372,7 +7372,7 @@ package body Make is
 
       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;
index 8e0d562..cf76c8f 100644 (file)
@@ -23,6 +23,7 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
+with Err_Vars;
 with Output;  use Output;
 with Stringt; use Stringt;
 
@@ -117,7 +118,12 @@ package body Prj.Err is
       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;
 
index 0f2081a..a3f4b49 100755 (executable)
@@ -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 --
index b77b3f0..034a7f0 100755 (executable)
@@ -245,9 +245,27 @@ package System.OS_Lib is
       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