OSDN Git Service

2006-10-31 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-direio.adb
index 3c5743b..5674339 100644 (file)
@@ -1,12 +1,12 @@
 ------------------------------------------------------------------------------
 --                                                                          --
---                         GNAT RUNTIME COMPONENTS                          --
+--                         GNAT RUN-TIME COMPONENTS                         --
 --                                                                          --
 --                        A D A . D I R E C T _ I O                         --
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2003 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2006, 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- --
@@ -16,8 +16,8 @@
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
+-- Boston, MA 02110-1301, USA.                                              --
 --                                                                          --
 -- As a special exception,  if other files  instantiate  generics from this --
 -- unit, or you link  this unit with other files  to produce an executable, --
@@ -51,7 +51,7 @@ package body Ada.Direct_IO is
 
    Zeroes : constant System.Storage_Elements.Storage_Array :=
               (1 .. System.Storage_Elements.Storage_Offset (Bytes) => 0);
-   --  Buffer used to fill out partial records.
+   --  Buffer used to fill out partial records
 
    package FCB renames System.File_Control_Block;
    package FIO renames System.File_IO;
@@ -83,9 +83,9 @@ package body Ada.Direct_IO is
 
    procedure Create
      (File : in out File_Type;
-      Mode : in File_Mode := Inout_File;
-      Name : in String := "";
-      Form : in String := "")
+      Mode : File_Mode := Inout_File;
+      Name : String := "";
+      Form : String := "")
    is
    begin
       DIO.Create (FP (File), To_FCB (Mode), Name, Form);
@@ -105,7 +105,7 @@ package body Ada.Direct_IO is
    -- End_Of_File --
    -----------------
 
-   function End_Of_File (File : in File_Type) return Boolean is
+   function End_Of_File (File : File_Type) return Boolean is
    begin
       return DIO.End_Of_File (FP (File));
    end End_Of_File;
@@ -114,7 +114,7 @@ package body Ada.Direct_IO is
    -- Form --
    ----------
 
-   function Form (File : in File_Type) return String is
+   function Form (File : File_Type) return String is
    begin
       return FIO.Form (AP (File));
    end Form;
@@ -123,7 +123,7 @@ package body Ada.Direct_IO is
    -- Index --
    -----------
 
-   function Index (File : in File_Type) return Positive_Count is
+   function Index (File : File_Type) return Positive_Count is
    begin
       return Positive_Count (DIO.Index (FP (File)));
    end Index;
@@ -132,7 +132,7 @@ package body Ada.Direct_IO is
    -- Is_Open --
    -------------
 
-   function Is_Open (File : in File_Type) return Boolean is
+   function Is_Open (File : File_Type) return Boolean is
    begin
       return FIO.Is_Open (AP (File));
    end Is_Open;
@@ -141,7 +141,7 @@ package body Ada.Direct_IO is
    -- Mode --
    ----------
 
-   function Mode (File : in File_Type) return File_Mode is
+   function Mode (File : File_Type) return File_Mode is
    begin
       return To_DIO (FIO.Mode (AP (File)));
    end Mode;
@@ -150,7 +150,7 @@ package body Ada.Direct_IO is
    -- Name --
    ----------
 
-   function Name (File : in File_Type) return String is
+   function Name (File : File_Type) return String is
    begin
       return FIO.Name (AP (File));
    end Name;
@@ -161,9 +161,9 @@ package body Ada.Direct_IO is
 
    procedure Open
      (File : in out File_Type;
-      Mode : in File_Mode;
-      Name : in String;
-      Form : in String := "")
+      Mode : File_Mode;
+      Name : String;
+      Form : String := "")
    is
    begin
       DIO.Open (FP (File), To_FCB (Mode), Name, Form);
@@ -175,17 +175,23 @@ package body Ada.Direct_IO is
    ----------
 
    procedure Read
-     (File : in File_Type;
+     (File : File_Type;
       Item : out Element_Type;
-      From : in Positive_Count)
+      From : Positive_Count)
    is
    begin
       --  For a non-constrained variant record type, we read into an
       --  intermediate buffer, since we may have the case of discriminated
       --  records where a discriminant check is required, and we may need
-      --  to assign only part of the record buffer originally written
+      --  to assign only part of the record buffer originally written.
 
+      --  Note: we have to turn warnings on/off because this use of
+      --  the Constrained attribute is an obsolescent feature.
+
+      pragma Warnings (Off);
       if not Element_Type'Constrained then
+         pragma Warnings (On);
+
          declare
             Buf : Element_Type;
 
@@ -201,11 +207,17 @@ package body Ada.Direct_IO is
       end if;
    end Read;
 
-   procedure Read (File : in File_Type; Item : out Element_Type) is
+   procedure Read (File : File_Type; Item : out Element_Type) is
    begin
       --  Same processing for unconstrained case as above
 
+      --  Note: we have to turn warnings on/off because this use of
+      --  the Constrained attribute is an obsolescent feature.
+
+      pragma Warnings (Off);
       if not Element_Type'Constrained then
+         pragma Warnings (On);
+
          declare
             Buf : Element_Type;
 
@@ -223,7 +235,7 @@ package body Ada.Direct_IO is
    -- Reset --
    -----------
 
-   procedure Reset (File : in out File_Type; Mode : in File_Mode) is
+   procedure Reset (File : in out File_Type; Mode : File_Mode) is
    begin
       DIO.Reset (FP (File), To_FCB (Mode));
    end Reset;
@@ -237,7 +249,7 @@ package body Ada.Direct_IO is
    -- Set_Index --
    ---------------
 
-   procedure Set_Index (File : in File_Type; To : in Positive_Count) is
+   procedure Set_Index (File : File_Type; To : Positive_Count) is
    begin
       DIO.Set_Index (FP (File), DPCount (To));
    end Set_Index;
@@ -246,7 +258,7 @@ package body Ada.Direct_IO is
    -- Size --
    ----------
 
-   function Size (File : in File_Type) return Count is
+   function Size (File : File_Type) return Count is
    begin
       return Count (DIO.Size (FP (File)));
    end Size;
@@ -256,16 +268,16 @@ package body Ada.Direct_IO is
    -----------
 
    procedure Write
-     (File : in File_Type;
-      Item : in Element_Type;
-      To   : in Positive_Count)
+     (File : File_Type;
+      Item : Element_Type;
+      To   : Positive_Count)
    is
    begin
       DIO.Set_Index (FP (File), DPCount (To));
       DIO.Write (FP (File), Item'Address, Item'Size / SU, Zeroes);
    end Write;
 
-   procedure Write (File : in File_Type; Item : in Element_Type) is
+   procedure Write (File : File_Type; Item : Element_Type) is
    begin
       DIO.Write (FP (File), Item'Address, Item'Size / SU, Zeroes);
    end Write;