diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-21 13:11:41 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-21 13:11:41 +0000 |
commit | 6d081ca682d17682b70f7ba62ef64659f27d12ff (patch) | |
tree | 87c0a4e21c018577dc730113e375474d9d50f886 /gcc/ada/gnatcmd.adb | |
parent | 5eabd16b31b0ef13bc7f3a04fdd6dad04b62f1fe (diff) | |
download | gcc-6d081ca682d17682b70f7ba62ef64659f27d12ff.tar.gz |
2009-06-21 Ed Falis <falis@adacore.com>
* env.c (__gnat_environ): return NULL for vThreads - unimplemented
2009-06-21 Eric Botcazou <ebotcazou@adacore.com>
* einfo.ads: Update comments.
2009-06-21 Hristian Kirtchev <kirtchev@adacore.com>
* sem_disp.adb (Check_Direct_Call): New routine. Dispatching calls
where the controlling formal is of private class-wide type whose
completion is a synchronized type can be converted into direct calls.
2009-06-21 Vincent Celier <celier@adacore.com>
* gnatcmd.adb (Check_Files): When all sources of the project are to be
indicated to gnatcheck, gnatpp or gnatmetric, always specify the list
of sources using -files=, so that the distinction can be made by the
tool of a call with no source (to display the usage) from a call with
a project file that contains no source.
2009-06-21 Jerome Lambourg <lambourg@adacore.com>
* exp_ch3.adb (Build_Array_Init_Proc): Do not build the init proc in
case of VM convention arrays.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148763 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gnatcmd.adb')
-rw-r--r-- | gcc/ada/gnatcmd.adb | 112 |
1 files changed, 48 insertions, 64 deletions
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index 8194a42ed8d..9e335d1b5df 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -71,12 +71,9 @@ procedure GNATCmd is -- an old fashioned project file. -p cannot be used in conjunction -- with -P. - Max_Files_On_The_Command_Line : constant := 30; -- Arbitrary - - Temp_File_Name : String_Access := null; + Temp_File_Name : Path_Name_Type := No_Path; -- The name of the temporary text file to put a list of source/object - -- files to pass to a tool, when there are more than - -- Max_Files_On_The_Command_Line files. + -- files to pass to a tool. ASIS_Main : String_Access := null; -- Main for commands Check, Metric and Pretty, when -U is used @@ -311,6 +308,9 @@ procedure GNATCmd is Add_Sources : Boolean := True; Unit_Data : Prj.Unit_Data; Subunit : Boolean := False; + FD : File_Descriptor := Invalid_FD; + Status : Integer; + Success : Boolean; begin -- Check if there is at least one argument that is not a switch @@ -326,8 +326,22 @@ procedure GNATCmd is -- of the main project. if Add_Sources then + + -- For gnatcheck, gnatpp and gnatmetric , create a temporary file and + -- put the list of sources in it. + + if The_Command = Check + or else The_Command = Pretty + or else The_Command = Metric + then + Tempdir.Create_Temp_File (FD, Temp_File_Name); + Last_Switches.Increment_Last; + Last_Switches.Table (Last_Switches.Last) := + new String'("-files=" & Get_Name_String (Temp_File_Name)); + + end if; + declare - Current_Last : constant Integer := Last_Switches.Last; Proj : Project_List; begin @@ -572,70 +586,40 @@ procedure GNATCmd is and then Unit_Data.File_Names (Kind).Name /= No_File and then Unit_Data.File_Names (Kind).Path.Name /= Slash then - Last_Switches.Increment_Last; - Last_Switches.Table (Last_Switches.Last) := - new String' - (Get_Name_String - (Unit_Data.File_Names - (Kind).Path.Display_Name)); - end if; - end loop; - end if; - end loop; - - -- If the list of files is too long, create a temporary text file - -- that lists these files, and pass this temp file to gnatcheck, - -- gnatpp or gnatmetric using switch -files=. - - if Last_Switches.Last - Current_Last > - Max_Files_On_The_Command_Line - then - declare - Temp_File_FD : File_Descriptor; - Buffer : String (1 .. 1_000); - Len : Natural; - OK : Boolean := True; + Get_Name_String + (Unit_Data.File_Names + (Kind).Path.Display_Name); - begin - Create_Temp_File (Temp_File_FD, Temp_File_Name); + if FD /= Invalid_FD then + Name_Len := Name_Len + 1; + Name_Buffer (Name_Len) := ASCII.LF; + Status := + Write (FD, Name_Buffer (1)'Address, Name_Len); - if Temp_File_Name /= null then - for Index in Current_Last + 1 .. - Last_Switches.Last - loop - Len := Last_Switches.Table (Index)'Length; - Buffer (1 .. Len) := Last_Switches.Table (Index).all; - Len := Len + 1; - Buffer (Len) := ASCII.LF; - Buffer (Len + 1) := ASCII.NUL; - OK := - Write (Temp_File_FD, - Buffer (1)'Address, - Len) = Len; - exit when not OK; - end loop; + if Status /= Name_Len then + Osint.Fail ("disk full"); + end if; - if OK then - Close (Temp_File_FD, OK); - else - Close (Temp_File_FD, OK); - OK := False; + else + Last_Switches.Increment_Last; + Last_Switches.Table (Last_Switches.Last) := + new String' + (Get_Name_String + (Unit_Data.File_Names + (Kind).Path.Display_Name)); + end if; end if; + end loop; - -- If there were any problem creating the temp file, then - -- pass the list of files. - - if OK then - - -- Replace list of files with -files=<temp file name> + if FD /= Invalid_FD then + Close (FD, Success); - Last_Switches.Set_Last (Current_Last + 1); - Last_Switches.Table (Last_Switches.Last) := - new String'("-files=" & Temp_File_Name.all); + if not Success then + Osint.Fail ("disk full"); end if; end if; - end; - end if; + end if; + end loop; end; end if; end Check_Files; @@ -752,8 +736,8 @@ procedure GNATCmd is -- If a temporary text file that contains a list of files for a tool -- has been created, delete this temporary file. - if Temp_File_Name /= null then - Delete_File (Temp_File_Name.all, Success); + if Temp_File_Name /= No_Path then + Delete_File (Get_Name_String (Temp_File_Name), Success); end if; end Delete_Temp_Config_Files; |