OSDN Git Service

2005-03-29 Ed Falis <falis@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-direio.adb
index 20d44df..0c01d1a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-1998 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2004 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- --
@@ -38,6 +38,7 @@
 
 with Interfaces.C_Streams; use Interfaces.C_Streams;
 with System;               use System;
+with System.CRTL;
 with System.File_Control_Block;
 with System.File_IO;
 with System.Direct_IO;
@@ -48,7 +49,7 @@ use type System.Direct_IO.Count;
 
 package body Ada.Direct_IO is
 
-   Zeroes : System.Storage_Elements.Storage_Array :=
+   Zeroes : constant System.Storage_Elements.Storage_Array :=
               (1 .. System.Storage_Elements.Storage_Offset (Bytes) => 0);
    --  Buffer used to fill out partial records.
 
@@ -60,12 +61,13 @@ package body Ada.Direct_IO is
 
    subtype AP      is FCB.AFCB_Ptr;
    subtype FP      is DIO.File_Type;
-   subtype DCount  is DIO.Count;
    subtype DPCount is DIO.Positive_Count;
 
    function To_FCB is new Unchecked_Conversion (File_Mode, FCB.File_Mode);
    function To_DIO is new Unchecked_Conversion (FCB.File_Mode, File_Mode);
 
+   use type System.CRTL.size_t;
+
    -----------
    -- Close --
    -----------
@@ -181,9 +183,15 @@ package body Ada.Direct_IO is
       --  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;
 
@@ -203,7 +211,13 @@ package body Ada.Direct_IO 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;