diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-27 13:16:48 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-27 13:16:48 +0000 |
commit | df40eeb00be859852d4267c611e3f507cff243d0 (patch) | |
tree | 75fc96285c761beaf46e117da46ba26e1193adfb /gcc/ada/s-os_lib.adb | |
parent | a18832dd17dad648ef0f20441e821bf91ffc1711 (diff) | |
download | gcc-df40eeb00be859852d4267c611e3f507cff243d0.tar.gz |
2009-10-27 Vincent Celier <celier@adacore.com>
* makeutl.adb (Check_Source_Info_In_ALI): Do not recompile if a subunit
from the runtime is found, except if gnatmake switch -a is used and this
subunit cannot be found.
2009-10-27 Ed Schonberg <schonberg@adacore.com>
* gnatbind.adb (gnatbind): When the -R option is selected, list subunits
as well, for tools that need the complete closure of the main program.
2009-10-27 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Minor updates.
2009-10-27 Emmanuel Briot <briot@adacore.com>
* prj-tree.adb (Free): Fix memory leak.
2009-10-27 Vasiliy Fofanov <fofanov@adacore.com>
* adaint.c, s-os_lib.adb (__gnat_create_output_file_new): New function
that ensures the file that is created is new. Use this function to make
sure there is no race condition if several processes are creating temp
files concurrently.
* s-os_lib.ads: Update comment.
2009-10-27 Thomas Quinot <quinot@adacore.com>
* sem_ch12.adb: Minor reformatting
2009-10-27 Javier Miranda <miranda@adacore.com>
* exp_ch4.ads (Integer_Promotion_Possible): New subprogram.
* exp_ch4.adb (Integer_Promotion_Possible): New subprogram.
(Expand_N_Type_Conversion): Replace code that checks if the integer
promotion of the operands is possible by a call to the new function
Integer_Promotion_Possible. Minor reformating because an enclosing
block is now not needed.
* checks.adb (Apply_Arithmetic_Overflow_Check): Add missing check to
see if the integer promotion is possible; in such case the runtime
checks are not generated.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153592 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-os_lib.adb')
-rwxr-xr-x | gcc/ada/s-os_lib.adb | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb index a3f4b499347..a3e51cd5e97 100755 --- a/gcc/ada/s-os_lib.adb +++ b/gcc/ada/s-os_lib.adb @@ -783,6 +783,32 @@ package body System.OS_Lib is Attempts : Natural := 0; Current : String (Current_Temp_File_Name'Range); + --------------------------------- + -- Create_New_Output_Text_File -- + --------------------------------- + + function Create_New_Output_Text_File + (Name : String) return File_Descriptor; + -- Similar to Create_Output_Text_File, except it fails if the file + -- already exists. We need this behavior to ensure we don't accidentally + -- open a temp file that has just been created by a concurrently running + -- process. There is no point exposing this function, as it's generally + -- not particularly useful. + + function Create_New_Output_Text_File + (Name : String) return File_Descriptor is + function C_Create_File + (Name : C_File_Name) return File_Descriptor; + pragma Import (C, C_Create_File, "__gnat_create_output_file_new"); + + C_Name : String (1 .. Name'Length + 1); + + begin + C_Name (1 .. Name'Length) := Name; + C_Name (C_Name'Last) := ASCII.NUL; + return C_Create_File (C_Name (C_Name'First)'Address); + end Create_New_Output_Text_File; + begin -- Loop until a new temp file can be created @@ -845,9 +871,9 @@ package body System.OS_Lib is -- Attempt to create the file if Stdout then - FD := Create_Output_Text_File (Current); + FD := Create_New_Output_Text_File (Current); else - FD := Create_File (Current, Binary); + FD := Create_New_File (Current, Binary); end if; if FD /= Invalid_FD then |