OSDN Git Service

2011-08-04 Pascal Obry <obry@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Aug 2011 08:26:59 +0000 (08:26 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Aug 2011 08:26:59 +0000 (08:26 +0000)
* adaint.c (__gnat_tmp_name): Use current process id to create temp
filenames, this ensures unicity of filenames across processes.

2011-08-04  Hristian Kirtchev  <kirtchev@adacore.com>

* bindgen.adb (Gen_Finalize_Library_Ada): Rename generated routine
Raise_Controlled to Raise_From_Controlled_Operation. Update the
signature of Raise_From_Controlled_Operation by adding flag From_Abort.
Add False as the actual to From_Abort in the generated call to
Raise_From_Controlled_Operation.

2011-08-04  Jerome Lambourg  <lambourg@adacore.com>

* osint-c.ads, osint-c.adb (Set_Library_Info_Name): Move to declaration
so that the ali file name can be retrieved from outside of this package.
* back_end.ads, back_end.adb (Gen_Or_Update_Object_File): New method
doing nothing in the general case, but used to update the object file
timestamp if directly generated by the backend.
* gnat1drv.adb (Gnat1drv): Make sure the object file's timestamp is set
to a later time than the ali file one.

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

gcc/ada/ChangeLog
gcc/ada/adaint.c
gcc/ada/back_end.adb
gcc/ada/back_end.ads
gcc/ada/bindgen.adb
gcc/ada/gnat1drv.adb
gcc/ada/osint-c.adb
gcc/ada/osint-c.ads

index 09f3423..c4dd6f1 100644 (file)
@@ -1,3 +1,26 @@
+2011-08-04  Pascal Obry  <obry@adacore.com>
+
+       * adaint.c (__gnat_tmp_name): Use current process id to create temp
+       filenames, this ensures unicity of filenames across processes.
+
+2011-08-04  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * bindgen.adb (Gen_Finalize_Library_Ada): Rename generated routine
+       Raise_Controlled to Raise_From_Controlled_Operation. Update the
+       signature of Raise_From_Controlled_Operation by adding flag From_Abort.
+       Add False as the actual to From_Abort in the generated call to
+       Raise_From_Controlled_Operation.
+
+2011-08-04  Jerome Lambourg  <lambourg@adacore.com>
+
+       * osint-c.ads, osint-c.adb (Set_Library_Info_Name): Move to declaration
+       so that the ali file name can be retrieved from outside of this package.
+       * back_end.ads, back_end.adb (Gen_Or_Update_Object_File): New method
+       doing nothing in the general case, but used to update the object file
+       timestamp if directly generated by the backend.
+       * gnat1drv.adb (Gnat1drv): Make sure the object file's timestamp is set
+       to a later time than the ali file one.
+
 2011-08-04  Yannick Moy  <moy@adacore.com>
 
        * einfo.adb, einfo.ads (Formal_Proof_On): new flag set on subprogram
index b0fd8c5..471dc2c 100644 (file)
@@ -1177,13 +1177,15 @@ __gnat_tmp_name (char *tmp_filename)
 #elif defined (__MINGW32__)
   {
     char *pname;
+    char prefix[25];
 
     /* tempnam tries to create a temporary file in directory pointed to by
        TMP environment variable, in c:\temp if TMP is not set, and in
        directory specified by P_tmpdir in stdio.h if c:\temp does not
        exist. The filename will be created with the prefix "gnat-".  */
 
-    pname = (char *) _tempnam ("c:\\temp", "gnat-");
+    sprintf (prefix, "gnat-%d-", (int)getpid());
+    pname = (char *) _tempnam ("c:\\temp", prefix);
 
     /* if pname is NULL, the file was not created properly, the disk is full
        or there is no more free temporary files */
index 3bcf848..a089f38 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -337,4 +337,14 @@ package body Back_End is
    begin
       Enumerate_Modes (Call_Back);
    end Register_Back_End_Types;
+
+   -------------------------------
+   -- Gen_Or_Update_Object_File --
+   -------------------------------
+
+   procedure Gen_Or_Update_Object_File is
+   begin
+      null;
+   end Gen_Or_Update_Object_File;
+
 end Back_End;
index 430f2c9..265017d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -82,4 +82,8 @@ package Back_End is
    --  Any processed switches that influence the result of a compilation must
    --  be added to the Compilation_Arguments table.
 
+   procedure Gen_Or_Update_Object_File;
+   --  Is used to generate the object file, or update it so that its timestamp
+   --  is updated.
+
 end Back_End;
index 01637a4..5aac5c2 100644 (file)
@@ -1823,16 +1823,19 @@ package body Bindgen is
             Set_String ("""__gnat_library_exception"");");
             Write_Statement_Buffer;
 
-            Set_String ("            procedure Raise_Controlled ");
-            Set_String ("(E : Ada.Exceptions.Exception_Occurrence);");
+            Set_String ("            procedure Raise_From_Controlled_");
+            Set_String ("Operation ");
+            Set_String ("(X : Ada.Exceptions.Exception_Occurrence; ");
+            Set_String (" From_Abort : Boolean);");
             Write_Statement_Buffer;
 
-            Set_String ("            pragma Import (Ada, Raise_Controlled, ");
+            Set_String ("            pragma Import (Ada, Raise_From_");
+            Set_String ("Controlled_Operation, ");
             Set_String ("""__gnat_raise_from_controlled_operation"");");
             Write_Statement_Buffer;
 
             WBI ("         begin");
-            WBI ("            Raise_Controlled (LE);");
+            WBI ("            Raise_From_Controlled_Operation (LE, False);");
             WBI ("         end;");
 
          --  VM-specific code, use regular Ada to produce the desired behavior
index 4336277..dcff866 100644 (file)
@@ -1047,6 +1047,19 @@ begin
 
       Write_ALI (Object => (Back_End_Mode = Generate_Object));
 
+      if not Compilation_Errors then
+         --  In case of ada backends, we need to make sure that the generated
+         --  object file has a timestamp greater than the ALI file.
+         --  We do this to make gnatmake happy when checking the ALI and obj
+         --  timestamps, where it expects the object file being written after
+         --  the ali file.
+         --  Gnatmake's assumption is true for gcc platforms where the gcc
+         --  wrapper needs to call the assembler after calling gnat1, but is
+         --  not true for ada backends, where the object files are created
+         --  directly by gnat1 (so are created before the ali file).
+         Back_End.Gen_Or_Update_Object_File;
+      end if;
+
       --  Generate ASIS tree after writing the ALI file, since in ASIS mode,
       --  Write_ALI may in fact result in further tree decoration from the
       --  original tree file. Note that we dump the tree just before generating
index 8b67bef..d433326 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2011, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -46,12 +46,6 @@ package body Osint.C is
    --  output file and Suffix is the desired suffix (dg/rep/xxx for debug/
    --  repinfo/list file where xxx is specified extension.
 
-   procedure Set_Library_Info_Name;
-   --  Sets a default ALI file name from the main compiler source name.
-   --  This is used by Create_Output_Library_Info, and by the version of
-   --  Read_Library_Info that takes a default file name. The name is in
-   --  Name_Buffer (with length in Name_Len) on return from the call.
-
    ----------------------
    -- Close_Debug_File --
    ----------------------
index 1060934..e8bc57a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2001-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2011, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -116,6 +116,12 @@ package Osint.C is
    --  information file for the main source file being compiled. See section
    --  above for a discussion of how library information files are stored.
 
+   procedure Set_Library_Info_Name;
+   --  Sets a default ALI file name from the main compiler source name.
+   --  This is used by Create_Output_Library_Info, and by the version of
+   --  Read_Library_Info that takes a default file name. The name is in
+   --  Name_Buffer (with length in Name_Len) on return from the call.
+
    procedure Create_Output_Library_Info;
    --  Creates the output library information file for the source file which
    --  is currently being compiled (i.e. the file which was most recently