summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-28 14:09:12 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-28 14:09:12 +0000
commit1623c93f9593ca08e0f8f47436f6068cfc90212a (patch)
tree536c92b8a7dfda324a00f8a487f10e93b999a8fd
parent424b0b58076ca9c0c47ff615064da0220e4d722d (diff)
downloadgcc-1623c93f9593ca08e0f8f47436f6068cfc90212a.tar.gz
2009-10-28 Vincent Celier <celier@adacore.com>
* prj-nmsc.adb (Add_To_Or_Remove_From_List): New name of procedure Add_If_Not_In_List to account to the fact that a directory may be removed from the list. Only remove directory if Removed is True. 2009-10-28 Gary Dismukes <dismukes@adacore.com> * a-textio.ads, a-textio.ads: Put back function EOF_Char in private part. Put back body of function EOF_Char. * a-tienau.adb: Remove with of Interfaces.C_Streams and change EOF back to EOF_Char. 2009-10-28 Emmanuel Briot <briot@adacore.com> * prj-tree.adb (Free): Fix memory leak. 2009-10-28 Thomas Quinot <quinot@adacore.com> * s-fileio.adb: Minor reformatting git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153661 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog21
-rw-r--r--gcc/ada/a-textio.adb9
-rw-r--r--gcc/ada/a-textio.ads6
-rw-r--r--gcc/ada/a-tienau.adb4
-rw-r--r--gcc/ada/prj-nmsc.adb26
-rw-r--r--gcc/ada/prj-tree.adb4
-rw-r--r--gcc/ada/s-fileio.adb106
7 files changed, 105 insertions, 71 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ef945d600d8..cb88c2b51bf 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,24 @@
+2009-10-28 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Add_To_Or_Remove_From_List): New name of procedure
+ Add_If_Not_In_List to account to the fact that a directory may be
+ removed from the list. Only remove directory if Removed is True.
+
+2009-10-28 Gary Dismukes <dismukes@adacore.com>
+
+ * a-textio.ads, a-textio.ads: Put back function EOF_Char in private
+ part. Put back body of function EOF_Char.
+ * a-tienau.adb: Remove with of Interfaces.C_Streams and change EOF back
+ to EOF_Char.
+
+2009-10-28 Emmanuel Briot <briot@adacore.com>
+
+ * prj-tree.adb (Free): Fix memory leak.
+
+2009-10-28 Thomas Quinot <quinot@adacore.com>
+
+ * s-fileio.adb: Minor reformatting
+
2009-10-28 Arnaud Charlet <charlet@adacore.com>
* gcc-interface/Make-lang.in: Update dependencies.
diff --git a/gcc/ada/a-textio.adb b/gcc/ada/a-textio.adb
index 417efb5f54f..ceacfe5b127 100644
--- a/gcc/ada/a-textio.adb
+++ b/gcc/ada/a-textio.adb
@@ -437,6 +437,15 @@ package body Ada.Text_IO is
return End_Of_Page (Current_In);
end End_Of_Page;
+ --------------
+ -- EOF_Char --
+ --------------
+
+ function EOF_Char return Integer is
+ begin
+ return EOF;
+ end EOF_Char;
+
-----------
-- Flush --
-----------
diff --git a/gcc/ada/a-textio.ads b/gcc/ada/a-textio.ads
index 44fe496db18..d22b2f9c635 100644
--- a/gcc/ada/a-textio.ads
+++ b/gcc/ada/a-textio.ads
@@ -458,6 +458,12 @@ private
Current_Err : aliased File_Type := Standard_Err;
-- Current files
+ function EOF_Char return Integer;
+ -- Returns the system-specific character indicating the end of a text file.
+ -- This is exported for use by child packages such as Enumeration_Aux to
+ -- eliminate their needing to depend directly on Interfaces.C_Streams,
+ -- which is not available in certain target environments (such as AAMP).
+
procedure Initialize_Standard_Files;
-- Initializes the file control blocks for the standard files. Called from
-- the elaboration routine for this package, and from Reset_Standard_Files
diff --git a/gcc/ada/a-tienau.adb b/gcc/ada/a-tienau.adb
index e04a34281e2..f0c1800f9e7 100644
--- a/gcc/ada/a-tienau.adb
+++ b/gcc/ada/a-tienau.adb
@@ -32,8 +32,6 @@
with Ada.Text_IO.Generic_Aux; use Ada.Text_IO.Generic_Aux;
with Ada.Characters.Handling; use Ada.Characters.Handling;
-with Interfaces.C_Streams; use Interfaces.C_Streams;
-
-- Note: this package does not yet deal properly with wide characters ???
package body Ada.Text_IO.Enumeration_Aux is
@@ -100,7 +98,7 @@ package body Ada.Text_IO.Enumeration_Aux is
Store_Char (File, Character'Pos (To_Upper (C)), Buf, Buflen);
ch := Getc (File);
- exit when ch = EOF;
+ exit when ch = EOF_Char;
C := Character'Val (ch);
exit when not Is_Letter (C)
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index b8d6674cc0e..5e76bce58ac 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -4708,21 +4708,22 @@ package body Prj.Nmsc is
is
Directory : constant String := Get_Name_String (From);
- procedure Add_If_Not_In_List
+ procedure Add_To_Or_Remove_From_List
(Path_Id : Name_Id;
Display_Path_Id : Name_Id);
- -- Add the directory Path_Id to the list of source_dirs if not
- -- already in the list.
+ -- When Removed = False, the directory Path_Id to the list of
+ -- source_dirs if not already in the list. When Removed = True,
+ -- removed directory Path_Id if in the list.
procedure Recursive_Find_Dirs (Path : Name_Id);
-- Find all the subdirectories (recursively) of Path and add them
-- to the list of source directories of the project.
- ------------------------
- -- Add_If_Not_In_List --
- ------------------------
+ --------------------------------
+ -- Add_To_Or_Remove_From_List --
+ --------------------------------
- procedure Add_If_Not_In_List
+ procedure Add_To_Or_Remove_From_List
(Path_Id : Name_Id;
Display_Path_Id : Name_Id)
is
@@ -4794,7 +4795,7 @@ package body Prj.Nmsc is
Data.Tree.Number_Lists.Table (Last_Src_Dir_Rank) :=
(Number => Rank, Next => No_Number_List);
- elsif List /= Nil_String then
+ elsif Removed and then List /= Nil_String then
-- Remove source dir, if present
@@ -4811,7 +4812,7 @@ package body Prj.Nmsc is
Data.Tree.Number_Lists.Table (Rank_List).Next;
end if;
end if;
- end Add_If_Not_In_List;
+ end Add_To_Or_Remove_From_List;
-------------------------
-- Recursive_Find_Dirs --
@@ -4857,7 +4858,7 @@ package body Prj.Nmsc is
end if;
end if;
- Add_If_Not_In_List
+ Add_To_Or_Remove_From_List
(Path_Id => Canonical_Path,
Display_Path_Id => Non_Canonical_Path);
@@ -5038,7 +5039,8 @@ package body Prj.Nmsc is
Directory =>
Get_Name_String (Project.Directory.Name),
Resolve_Links => Opt.Follow_Links_For_Dirs,
- Case_Sensitive => True);
+ Case_Sensitive => True) &
+ Directory_Separator;
Last_Path : constant Natural :=
Compute_Directory_Last (Path);
@@ -5062,7 +5064,7 @@ package body Prj.Nmsc is
(Display_Path'First .. Last_Display_Path));
Display_Path_Id := Name_Find;
- Add_If_Not_In_List
+ Add_To_Or_Remove_From_List
(Path_Id => Path_Id,
Display_Path_Id => Display_Path_Id);
end;
diff --git a/gcc/ada/prj-tree.adb b/gcc/ada/prj-tree.adb
index 7d77e2ab6fd..df6e5acb6cf 100644
--- a/gcc/ada/prj-tree.adb
+++ b/gcc/ada/prj-tree.adb
@@ -23,10 +23,11 @@
-- --
------------------------------------------------------------------------------
-with Ada.Unchecked_Deallocation;
with Osint; use Osint;
with Prj.Err;
+with Ada.Unchecked_Deallocation;
+
package body Prj.Tree is
Node_With_Comments : constant array (Project_Node_Kind) of Boolean :=
@@ -1000,6 +1001,7 @@ package body Prj.Tree is
if Proj /= null then
Project_Node_Table.Free (Proj.Project_Nodes);
Projects_Htable.Reset (Proj.Projects_HT);
+ Name_To_Name_HTable.Reset (Proj.External_References);
Free (Proj.Project_Path);
Unchecked_Free (Proj);
end if;
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb
index 803c2da99e7..317a97ae8aa 100644
--- a/gcc/ada/s-fileio.adb
+++ b/gcc/ada/s-fileio.adb
@@ -223,15 +223,13 @@ package body System.File_IO is
-- Sever the association between the given file and its associated
-- external file. The given file is left closed. Do not perform system
- -- closes on the standard input, output and error files and also do
- -- not attempt to close a stream that does not exist (signalled by a
- -- null stream value -- happens in some error situations).
+ -- closes on the standard input, output and error files and also do not
+ -- attempt to close a stream that does not exist (signalled by a null
+ -- stream value -- happens in some error situations).
- if not File.Is_System_File
- and then File.Stream /= NULL_Stream
- then
- -- Do not do an fclose if this is a shared file and there is
- -- at least one other instance of the stream that is open.
+ if not File.Is_System_File and then File.Stream /= NULL_Stream then
+ -- Do not do an fclose if this is a shared file and there is at least
+ -- one other instance of the stream that is open.
if File.Shared_Status = Yes then
declare
@@ -240,9 +238,7 @@ package body System.File_IO is
begin
P := Open_Files;
while P /= null loop
- if P /= File
- and then File.Stream = P.Stream
- then
+ if P /= File and then File.Stream = P.Stream then
Dup_Strm := True;
exit;
end if;
@@ -314,9 +310,9 @@ package body System.File_IO is
begin
Close (File_Ptr);
- -- Now unlink the external file. Note that we use the full name
- -- in this unlink, because the working directory may have changed
- -- since we did the open, and we want to unlink the right file!
+ -- Now unlink the external file. Note that we use the full name in
+ -- this unlink, because the working directory may have changed since
+ -- we did the open, and we want to unlink the right file!
if unlink (Filename'Address) = -1 then
raise Use_Error;
@@ -369,8 +365,8 @@ package body System.File_IO is
SSL.Lock_Task.all;
- -- First close all open files (the slightly complex form of this loop
- -- is required because Close as a side effect nulls out its argument)
+ -- First close all open files (the slightly complex form of this loop is
+ -- required because Close as a side effect nulls out its argument).
Fptr1 := Open_Files;
while Fptr1 /= null loop
@@ -379,9 +375,9 @@ package body System.File_IO is
Fptr1 := Fptr2;
end loop;
- -- Now unlink all temporary files. We do not bother to free the
- -- blocks because we are just about to terminate the program. We
- -- also ignore any errors while attempting these unlink operations.
+ -- Now unlink all temporary files. We do not bother to free the blocks
+ -- because we are just about to terminate the program. We also ignore
+ -- any errors while attempting these unlink operations.
while Temp_Files /= null loop
Discard := unlink (Temp_Files.Name'Address);
@@ -429,20 +425,20 @@ package body System.File_IO is
-- you can reset to earlier points in the file. The caller must use the
-- Append_Set routine to deal with the necessary positioning.
- -- Note: in several cases, the fopen mode used allows reading and
- -- writing, but the setting of the Ada mode is more restrictive. For
- -- instance, Create in In_File mode uses "w+" which allows writing,
- -- but the Ada mode In_File will cause any write operations to be
- -- rejected with Mode_Error in any case.
+ -- Note: in several cases, the fopen mode used allows reading and writing,
+ -- but the setting of the Ada mode is more restrictive. For instance,
+ -- Create in In_File mode uses "w+" which allows writing, but the Ada mode
+ -- In_File will cause any write operations to be rejected with Mode_Error
+ -- in any case.
- -- Note: for the Out_File/Open cases for other than the Direct_IO case,
- -- an initial call will be made by the caller to first open the file in
- -- "r" mode to be sure that it exists. The real open, in "w" mode, will
- -- then destroy this file. This is peculiar, but that's what Ada semantics
- -- require and the ACVT tests insist on!
+ -- Note: for the Out_File/Open cases for other than the Direct_IO case, an
+ -- initial call will be made by the caller to first open the file in "r"
+ -- mode to be sure that it exists. The real open, in "w" mode, will then
+ -- destroy this file. This is peculiar, but that's what Ada semantics
+ -- require and the ACATS tests insist on!
- -- If text file translation is required, then either b or t is
- -- added to the mode, depending on the setting of Text.
+ -- If text file translation is required, then either "b" or "t" is appended
+ -- to the mode, depending on the setting of Text.
procedure Fopen_Mode
(Mode : File_Mode;
@@ -591,11 +587,9 @@ package body System.File_IO is
Keyword : String;
Start : out Natural;
Stop : out Natural)
- is
+ is
Klen : constant Integer := Keyword'Length;
- -- Start of processing for Form_Parameter
-
begin
for J in Form'First + Klen .. Form'Last - 1 loop
if Form (J) = '='
@@ -661,6 +655,7 @@ package body System.File_IO is
begin
status := setvbuf (File.Stream, Null_Address, IOLBF, Line_Siz);
+ -- No error checking???
end Make_Line_Buffered;
---------------------
@@ -673,6 +668,7 @@ package body System.File_IO is
begin
status := setvbuf (File.Stream, Null_Address, IONBF, 0);
+ -- No error checking???
end Make_Unbuffered;
----------
@@ -722,7 +718,7 @@ package body System.File_IO is
procedure Tmp_Name (Buffer : Address);
pragma Import (C, Tmp_Name, "__gnat_tmp_name");
- -- set buffer (a String address) with a temporary filename
+ -- Set buffer (a String address) with a temporary filename
Stream : FILEs := C_Stream;
-- Stream which we open in response to this request
@@ -742,9 +738,9 @@ package body System.File_IO is
-- Indicates temporary file case
Namelen : constant Integer := max_path_len;
- -- Length required for file name, not including final ASCII.NUL
- -- Note that we used to reference L_tmpnam here, which is not
- -- reliable since __gnat_tmp_name does not always use tmpnam.
+ -- Length required for file name, not including final ASCII.NUL.
+ -- Note that we used to reference L_tmpnam here, which is not reliable
+ -- since __gnat_tmp_name does not always use tmpnam.
Namestr : aliased String (1 .. Namelen + 1);
-- Name as given or temporary file name with ASCII.NUL appended
@@ -900,7 +896,7 @@ package body System.File_IO is
-- Fullname is generated by calling system's full_name. The problem
-- is, full_name does nothing about the casing, so a file name
- -- comparison may generally speaking not be valid on non-case
+ -- comparison may generally speaking not be valid on non-case-
-- sensitive systems, and in particular we get unexpected failures
-- on Windows/Vista because of this. So we use s-casuti to force
-- the name to lower case.
@@ -909,8 +905,8 @@ package body System.File_IO is
To_Lower (Fullname (1 .. Full_Name_Len));
end if;
- -- If Shared=None or Shared=Yes, then check for the existence
- -- of another file with exactly the same full name.
+ -- If Shared=None or Shared=Yes, then check for the existence of
+ -- another file with exactly the same full name.
if Shared /= No then
declare
@@ -1030,8 +1026,8 @@ package body System.File_IO is
end if;
-- Stream has been successfully located or opened, so now we are
- -- committed to completing the opening of the file. Allocate block
- -- on heap and fill in its fields.
+ -- committed to completing the opening of the file. Allocate block on
+ -- heap and fill in its fields.
File_Ptr := AFCB_Allocate (Dummy_FCB);
@@ -1103,9 +1099,9 @@ package body System.File_IO is
Reset (File_Ptr, File.Mode);
end Reset;
- -- The reset with a change in mode is done using freopen, and is
- -- not permitted except for regular files (since otherwise there
- -- is no name for the freopen, and in any case it seems meaningless)
+ -- The reset with a change in mode is done using freopen, and is not
+ -- permitted except for regular files (since otherwise there is no name for
+ -- the freopen, and in any case it seems meaningless).
procedure Reset (File_Ptr : access AFCB_Ptr; Mode : File_Mode) is
File : AFCB_Ptr renames File_Ptr.all;
@@ -1126,17 +1122,17 @@ package body System.File_IO is
then
raise Use_Error;
- -- For In_File or Inout_File for a regular file, we can just do a
- -- rewind if the mode is unchanged, which is more efficient than
- -- doing a full reopen.
+ -- For In_File or Inout_File for a regular file, we can just do a rewind
+ -- if the mode is unchanged, which is more efficient than doing a full
+ -- reopen.
elsif Mode = File.Mode
and then Mode <= Inout_File
then
rewind (File.Stream);
- -- Here the change of mode is permitted, we do it by reopening the
- -- file in the new mode and replacing the stream with a new stream.
+ -- Here the change of mode is permitted, we do it by reopening the file
+ -- in the new mode and replacing the stream with a new stream.
else
Fopen_Mode
@@ -1162,10 +1158,10 @@ package body System.File_IO is
procedure Write_Buf (File : AFCB_Ptr; Buf : Address; Siz : size_t) is
begin
- -- Note: for most purposes, the Siz and 1 parameters in the fwrite
- -- call could be reversed, but on VMS, this is a better choice, since
- -- for some file formats, reversing the parameters results in records
- -- of one byte each.
+ -- Note: for most purposes, the Siz and 1 parameters in the fwrite call
+ -- could be reversed, but on VMS, this is a better choice, since for
+ -- some file formats, reversing the parameters results in records of one
+ -- byte each.
SSL.Abort_Defer.all;