From: Arnaud Charlet Date: Thu, 4 Aug 2011 08:26:59 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0fb8fe8d90fee970854a3e9b72d0c5ba9f4149a;p=gcc.git [multiple changes] 2011-08-04 Pascal Obry * 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 * 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 * 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. From-SVN: r177329 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 09f342334e1..c4dd6f1dfd4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,26 @@ +2011-08-04 Pascal Obry + + * 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 + + * 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 + + * 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 * einfo.adb, einfo.ads (Formal_Proof_On): new flag set on subprogram diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index b0fd8c590ec..471dc2c2313 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -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 */ diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb index 3bcf8488029..a089f3862c4 100644 --- a/gcc/ada/back_end.adb +++ b/gcc/ada/back_end.adb @@ -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; diff --git a/gcc/ada/back_end.ads b/gcc/ada/back_end.ads index 430f2c9449f..265017df776 100644 --- a/gcc/ada/back_end.ads +++ b/gcc/ada/back_end.ads @@ -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; diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index 01637a4a31a..5aac5c237d2 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -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 diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 43362771496..dcff866229b 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -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 diff --git a/gcc/ada/osint-c.adb b/gcc/ada/osint-c.adb index 8b67befc6c6..d4333269477 100644 --- a/gcc/ada/osint-c.adb +++ b/gcc/ada/osint-c.adb @@ -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 -- ---------------------- diff --git a/gcc/ada/osint-c.ads b/gcc/ada/osint-c.ads index 1060934f79c..e8bc57a8ad1 100644 --- a/gcc/ada/osint-c.ads +++ b/gcc/ada/osint-c.ads @@ -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