aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog30
-rw-r--r--gcc/ada/a-stream.ads6
-rw-r--r--gcc/ada/a-ststio.adb23
-rw-r--r--gcc/ada/cstand.adb13
-rw-r--r--gcc/ada/cstreams.c26
-rw-r--r--gcc/ada/debug.adb10
-rw-r--r--gcc/ada/g-socket.ads2
-rw-r--r--gcc/ada/g-socthi-mingw.adb9
-rw-r--r--gcc/ada/gnat1drv.adb11
-rw-r--r--gcc/ada/i-cstrea.ads5
-rw-r--r--gcc/ada/s-crtl.ads6
-rw-r--r--gcc/ada/s-direio.adb30
-rw-r--r--gcc/ada/s-direio.ads4
13 files changed, 91 insertions, 84 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 08ec13e..6f0cda8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,33 @@
+2014-07-31 Pascal Obry <obry@adacore.com>
+
+ * a-stream.ads (Stream_Element_Offset): Now a signed 64bit type.
+ * i-cstrea.ads, s-crtl.ads (fseek64): Offset is always a 64bit value.
+ (ftell64): Always returns a 64bit value.
+ * cstreams.c (int64): New definition.
+ (_FILE_OFFSET_BITS): Set to 64 to enable 64bit offset support.
+ (__gnat_ftell64): Always returns a 64bit value. The implemenation now
+ uses ftello() on UNIX.
+ (__gnat_fseek64): Offset is always a 64bit value. The
+ implementation now uses fseeko() on UNIX.
+ * a-ststio.adb, s-direio.adb (Set_Position): Simplify code,
+ always use fseek64 to set the offset.
+ (Size): Simplify code, always use fseek64/ftell64.
+ * s-direio.ads (Count): Now an int64.
+ * g-socket.ads (Vector_Element): Adjust definition for Length
+ to be a size_t. This matches the C definition and avoid using
+ a 64bit integer on 32bit platforms now that Count is always 64bit.
+ * g-socthi-mingw.adb (Ada.Streams): Removed as not used anymore.
+ (C_Recvmsg): Change some conversion to account for change in
+ Vector_Element.
+ (C_Sendmsg): Likewise.
+
+2014-07-31 Robert Dewar <dewar@adacore.com>
+
+ * cstand.adb (Create_Standard): Remove handling of -gnatdm flag.
+ * debug.adb: Remove documentation of -gnatdm flag.
+ * gnat1drv.adb (Adjust_Global_Switches): Remove handling of
+ -gnatdm flag.
+
2014-07-31 Arnaud Charlet <charlet@adacore.com>
* lib-writ.adb (Write_Unit_Information): Fix case where U =
diff --git a/gcc/ada/a-stream.ads b/gcc/ada/a-stream.ads
index 75810f3..388b5da 100644
--- a/gcc/ada/a-stream.ads
+++ b/gcc/ada/a-stream.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -41,9 +41,7 @@ package Ada.Streams is
type Stream_Element is mod 2 ** Standard'Storage_Unit;
- type Stream_Element_Offset is range
- -(2 ** (Standard'Address_Size - 1)) ..
- +(2 ** (Standard'Address_Size - 1)) - 1;
+ type Stream_Element_Offset is range -(2 ** 63) .. +(2 ** 63) - 1;
subtype Stream_Element_Count is
Stream_Element_Offset range 0 .. Stream_Element_Offset'Last;
diff --git a/gcc/ada/a-ststio.adb b/gcc/ada/a-ststio.adb
index ef8af62..fb3b59c 100644
--- a/gcc/ada/a-ststio.adb
+++ b/gcc/ada/a-ststio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -382,17 +382,10 @@ package body Ada.Streams.Stream_IO is
------------------
procedure Set_Position (File : File_Type) is
- use type System.CRTL.long;
- use type System.CRTL.ssize_t;
+ use type System.CRTL.int64;
R : int;
begin
- if Standard'Address_Size = 64 then
- R := fseek64 (File.Stream,
- System.CRTL.ssize_t (File.Index) - 1, SEEK_SET);
- else
- R := fseek (File.Stream,
- System.CRTL.long (File.Index) - 1, SEEK_SET);
- end if;
+ R := fseek64 (File.Stream, System.CRTL.int64 (File.Index) - 1, SEEK_SET);
if R /= 0 then
raise Use_Error;
@@ -410,14 +403,14 @@ package body Ada.Streams.Stream_IO is
if File.File_Size = -1 then
File.Last_Op := Op_Other;
- if fseek (File.Stream, 0, SEEK_END) /= 0 then
+ if fseek64 (File.Stream, 0, SEEK_END) /= 0 then
raise Device_Error;
end if;
- if Standard'Address_Size = 64 then
- File.File_Size := Stream_Element_Offset (ftell64 (File.Stream));
- else
- File.File_Size := Stream_Element_Offset (ftell (File.Stream));
+ File.File_Size := Stream_Element_Offset (ftell64 (File.Stream));
+
+ if File.File_Size = -1 then
+ raise Use_Error;
end if;
end if;
diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb
index f24bf79..c4a8b1d 100644
--- a/gcc/ada/cstand.adb
+++ b/gcc/ada/cstand.adb
@@ -740,17 +740,8 @@ package body CStand is
Build_Signed_Integer_Type
(Standard_Integer, Standard_Integer_Size);
- declare
- LIS : Nat;
- begin
- if Debug_Flag_M then
- LIS := 64;
- else
- LIS := Standard_Long_Integer_Size;
- end if;
-
- Build_Signed_Integer_Type (Standard_Long_Integer, LIS);
- end;
+ Build_Signed_Integer_Type
+ (Standard_Long_Integer, Standard_Long_Integer_Size);
Build_Signed_Integer_Type
(Standard_Long_Long_Integer, Standard_Long_Long_Integer_Size);
diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c
index 5d5bc8d..3de270f 100644
--- a/gcc/ada/cstreams.c
+++ b/gcc/ada/cstreams.c
@@ -31,6 +31,12 @@
/* Routines required for implementing routines in Interfaces.C.Streams. */
+#define _FILE_OFFSET_BITS 64
+/* the define above will make off_t a 64bit type on GNU/Linux */
+
+#include <stdio.h>
+#include <sys/types.h>
+
#ifdef __vxworks
#include "vxWorks.h"
#endif
@@ -247,8 +253,10 @@ __gnat_full_name (char *nam, char *buffer)
return buffer;
}
-#ifdef _WIN64
- /* On Windows 64 we want to use the fseek/fteel supporting large files. This
+#define __int64 long long
+
+#ifdef _WIN32
+ /* On Windows we want to use the fseek/fteel supporting large files. This
issue is due to the fact that a long on Win64 is still a 32 bits value */
__int64
__gnat_ftell64 (FILE *stream)
@@ -263,16 +271,22 @@ __gnat_fseek64 (FILE *stream, __int64 offset, int origin)
}
#else
-long
+__int64
__gnat_ftell64 (FILE *stream)
{
- return ftell (stream);
+ return (__int64)ftello (stream);
}
int
-__gnat_fseek64 (FILE *stream, long offset, int origin)
+__gnat_fseek64 (FILE *stream, __int64 offset, int origin)
{
- return fseek (stream, offset, origin);
+ /* make sure that the offset is not bigger than the OS off_t, if so return
+ with error as this mean that we are trying to handle files larger than
+ 2Gb on a patform not supporting it. */
+ if ((off_t)offset == offset)
+ return fseeko (stream, (off_t) offset, origin);
+ else
+ return -1;
}
#endif
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index 02f8d1f..9bf4faf 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -49,7 +49,7 @@ package body Debug is
-- dj Suppress "junk null check" for access parameter values
-- dk Generate GNATBUG message on abort, even if previous errors
-- dl Generate unit load trace messages
- -- dm Allow VMS features even if not OpenVMS version
+ -- dm
-- dn Generate messages for node/list allocation
-- do Print source from tree (original code only)
-- dp Generate messages for parser scope stack push/pops
@@ -281,14 +281,6 @@ package body Debug is
-- generated each time a request is made to the library manager to
-- load a new unit.
- -- dm Some features are permitted only in OpenVMS ports of GNAT (e.g.
- -- the specification of passing by descriptor). Normally any use
- -- of these features will be flagged as an error, but this debug
- -- flag allows acceptance of these features in non OpenVMS ports.
- -- Of course they may not have any useful effect, and in particular
- -- attempting to generate code with this flag set may blow up.
- -- The flag also forces the use of 64-bits for Long_Integer.
-
-- dn Generate messages for node/list allocation. Each time a node or
-- list header is allocated, a line of output is generated. Certain
-- other basic tree operations also cause a line of output to be
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads
index 7df5af0..d93536c 100644
--- a/gcc/ada/g-socket.ads
+++ b/gcc/ada/g-socket.ads
@@ -797,7 +797,7 @@ package GNAT.Sockets is
type Vector_Element is record
Base : Stream_Element_Reference;
- Length : Ada.Streams.Stream_Element_Count;
+ Length : Interfaces.C.size_t;
end record;
type Vector_Type is array (Integer range <>) of Vector_Element;
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb
index 719ab54..e8ee6dc 100644
--- a/gcc/ada/g-socthi-mingw.adb
+++ b/gcc/ada/g-socthi-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2013, AdaCore --
+-- Copyright (C) 2001-2014, AdaCore --
-- --
-- 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- --
@@ -35,7 +35,6 @@
-- This version is for NT
-with Ada.Streams; use Ada.Streams;
with Ada.Unchecked_Conversion;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with System; use System;
@@ -334,11 +333,11 @@ package body GNAT.Sockets.Thin is
exit;
else
- pragma Assert (Stream_Element_Count (Res) <= Current_Iovec.Length);
+ pragma Assert (Interfaces.C.size_t (Res) <= Current_Iovec.Length);
Count := Count + Res;
Current_Iovec.Length :=
- Current_Iovec.Length - Stream_Element_Count (Res);
+ Current_Iovec.Length - Interfaces.C.size_t (Res);
Current_Iovec.Base :=
To_Access (Current_Iovec.Base.all'Address
+ Storage_Offset (Res));
@@ -507,7 +506,7 @@ package body GNAT.Sockets.Thin is
-- Exit now if the buffer is not fully transmitted
- exit when Stream_Element_Count (Res) < Iovec (J).Length;
+ exit when Interfaces.C.size_t (Res) < Iovec (J).Length;
end loop;
return System.CRTL.ssize_t (Count);
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index 960f75d..a816f4e 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -38,7 +38,6 @@ with Fname; use Fname;
with Fname.UF; use Fname.UF;
with Frontend;
with Gnatvsn; use Gnatvsn;
-with Hostparm;
with Inline;
with Lib; use Lib;
with Lib.Writ; use Lib.Writ;
@@ -477,17 +476,11 @@ procedure Gnat1drv is
Ttypes.Bytes_Big_Endian := not Ttypes.Bytes_Big_Endian;
end if;
- -- Deal with forcing OpenVMS switches True if debug flag M is set, but
- -- record the setting of Targparm.Open_VMS_On_Target in True_VMS_Target
- -- before doing this, so we know if we are in real OpenVMS or not.
+ -- Temporarily set True_VMS_Target to OpenVMS_On_Target. This is just
+ -- temporary, we no longer deal with the debug flag -gnatdm here.
Opt.True_VMS_Target := Targparm.OpenVMS_On_Target;
- if Debug_Flag_M then
- Targparm.OpenVMS_On_Target := True;
- Hostparm.OpenVMS := True;
- end if;
-
-- Activate front end layout if debug flag -gnatdF is set
if Debug_Flag_FF then
diff --git a/gcc/ada/i-cstrea.ads b/gcc/ada/i-cstrea.ads
index 48fbfc4..9a00b49 100644
--- a/gcc/ada/i-cstrea.ads
+++ b/gcc/ada/i-cstrea.ads
@@ -43,6 +43,7 @@ package Interfaces.C_Streams is
subtype long is System.CRTL.long;
subtype size_t is System.CRTL.size_t;
subtype ssize_t is System.CRTL.ssize_t;
+ subtype int64 is System.CRTL.int64;
subtype voids is System.Address;
NULL_Stream : constant FILEs;
@@ -159,14 +160,14 @@ package Interfaces.C_Streams is
function fseek64
(stream : FILEs;
- offset : ssize_t;
+ offset : int64;
origin : int) return int
renames System.CRTL.fseek64;
function ftell (stream : FILEs) return long
renames System.CRTL.ftell;
- function ftell64 (stream : FILEs) return ssize_t
+ function ftell64 (stream : FILEs) return int64
renames System.CRTL.ftell64;
function fwrite
diff --git a/gcc/ada/s-crtl.ads b/gcc/ada/s-crtl.ads
index faa7031..ba7332d 100644
--- a/gcc/ada/s-crtl.ads
+++ b/gcc/ada/s-crtl.ads
@@ -62,6 +62,8 @@ package System.CRTL is
type ssize_t is range -(2 ** (Standard'Address_Size - 1))
.. +(2 ** (Standard'Address_Size - 1)) - 1;
+ type int64 is range -(2 ** 63) .. (2 ** 63) - 1;
+
type Filename_Encoding is (UTF8, ASCII_8bits, Unspecified);
for Filename_Encoding use (UTF8 => 0, ASCII_8bits => 1, Unspecified => 2);
pragma Convention (C, Filename_Encoding);
@@ -147,14 +149,14 @@ package System.CRTL is
function fseek64
(stream : FILEs;
- offset : ssize_t;
+ offset : int64;
origin : int) return int;
pragma Import (C, fseek64, "__gnat_fseek64");
function ftell (stream : FILEs) return long;
pragma Import (C, ftell, "ftell");
- function ftell64 (stream : FILEs) return ssize_t;
+ function ftell64 (stream : FILEs) return int64;
pragma Import (C, ftell64, "__gnat_ftell64");
function getenv (S : String) return System.Address;
diff --git a/gcc/ada/s-direio.adb b/gcc/ada/s-direio.adb
index 99f8ddf7..297454e 100644
--- a/gcc/ada/s-direio.adb
+++ b/gcc/ada/s-direio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -45,7 +45,7 @@ package body System.Direct_IO is
subtype AP is FCB.AFCB_Ptr;
use type FCB.Shared_Status_Type;
- use type System.CRTL.long;
+ use type System.CRTL.int64;
use type System.CRTL.size_t;
-----------------------
@@ -280,18 +280,10 @@ package body System.Direct_IO is
------------------
procedure Set_Position (File : File_Type) is
- use type System.CRTL.ssize_t;
R : int;
begin
- if Standard'Address_Size = 64 then
- R := fseek64
- (File.Stream, ssize_t (File.Bytes) *
- ssize_t (File.Index - 1), SEEK_SET);
- else
- R := fseek
- (File.Stream, long (File.Bytes) *
- long (File.Index - 1), SEEK_SET);
- end if;
+ R := fseek64
+ (File.Stream, int64 (File.Bytes) * int64 (File.Index - 1), SEEK_SET);
if R /= 0 then
raise Use_Error;
@@ -303,20 +295,22 @@ package body System.Direct_IO is
----------
function Size (File : File_Type) return Count is
- use type System.CRTL.ssize_t;
+ Pos : int64;
begin
FIO.Check_File_Open (AP (File));
File.Last_Op := Op_Other;
- if fseek (File.Stream, 0, SEEK_END) /= 0 then
+ if fseek64 (File.Stream, 0, SEEK_END) /= 0 then
raise Device_Error;
end if;
- if Standard'Address_Size = 64 then
- return Count (ftell64 (File.Stream) / ssize_t (File.Bytes));
- else
- return Count (ftell (File.Stream) / long (File.Bytes));
+ Pos := ftell64 (File.Stream);
+
+ if Pos = -1 then
+ raise Use_Error;
end if;
+
+ return Count (Pos / int64 (File.Bytes));
end Size;
-----------
diff --git a/gcc/ada/s-direio.ads b/gcc/ada/s-direio.ads
index 35fcef0..4a60ee7 100644
--- a/gcc/ada/s-direio.ads
+++ b/gcc/ada/s-direio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -45,7 +45,7 @@ package System.Direct_IO is
type Operation is (Op_Read, Op_Write, Op_Other);
-- Type used to record last operation (to optimize sequential operations)
- subtype Count is Interfaces.C_Streams.long;
+ subtype Count is Interfaces.C_Streams.int64;
-- The Count type in each instantiation is derived from this type
subtype Positive_Count is Count range 1 .. Count'Last;