aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPascal Obry <obry@adacore.com>2014-08-01 08:10:34 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-08-01 10:10:34 +0200
commit148c744a1789b29b3c3c32b45ea3be913fef6a52 (patch)
tree6d947b509c5720962bfcba5c62b900bab43882a0 /gcc/ada
parent479f90598ae5c20aa042e4700a98f273c8094496 (diff)
downloadgcc-148c744a1789b29b3c3c32b45ea3be913fef6a52.zip
gcc-148c744a1789b29b3c3c32b45ea3be913fef6a52.tar.gz
gcc-148c744a1789b29b3c3c32b45ea3be913fef6a52.tar.bz2
adaint.h, adaint.c (__gnat_file_length): Returns an __int64.
2014-08-01 Pascal Obry <obry@adacore.com> * adaint.h, adaint.c (__gnat_file_length): Returns an __int64. (__gnat_named_file_length): Likewise. (__gnat_file_length_attr): Likewise. * a-direct.adb (C_Size): Use size_t as returned type. * osint.adb (File_Length): Adjust spec for Internal routine (returns size_t). * s-os_lib.adb (File_Length): Now returns a CRTL.size_t. (System.CRTL): With claused moved to spec. * s-os_lib.ads (System.CRTL): With clause moved to here. From-SVN: r213412
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/a-direct.adb4
-rw-r--r--gcc/ada/adaint.c6
-rw-r--r--gcc/ada/adaint.h8
-rw-r--r--gcc/ada/osint.adb7
-rw-r--r--gcc/ada/s-os_lib.adb1
-rw-r--r--gcc/ada/s-os_lib.ads4
7 files changed, 29 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 51f9202..2248f1d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,17 @@
2014-08-01 Pascal Obry <obry@adacore.com>
+ * adaint.h, adaint.c (__gnat_file_length): Returns an __int64.
+ (__gnat_named_file_length): Likewise.
+ (__gnat_file_length_attr): Likewise.
+ * a-direct.adb (C_Size): Use size_t as returned type.
+ * osint.adb (File_Length): Adjust spec for Internal routine
+ (returns size_t).
+ * s-os_lib.adb (File_Length): Now returns a CRTL.size_t.
+ (System.CRTL): With claused moved to spec.
+ * s-os_lib.ads (System.CRTL): With clause moved to here.
+
+2014-08-01 Pascal Obry <obry@adacore.com>
+
* adaint.h, adaint.c (__gnat_open): Added.
* s-crtl.ads (open): Import __gnat_open for large file support.
diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb
index c6d2b7c..275ad7a 100644
--- a/gcc/ada/a-direct.adb
+++ b/gcc/ada/a-direct.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-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- --
@@ -1250,7 +1250,7 @@ package body Ada.Directories is
function Size (Name : String) return File_Size is
C_Name : String (1 .. Name'Length + 1);
- function C_Size (Name : Address) return Long_Integer;
+ function C_Size (Name : Address) return size_t;
pragma Import (C, C_Size, "__gnat_named_file_length");
begin
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 42a8077..e0193af 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -1308,7 +1308,7 @@ __gnat_stat_to_attr (int fd, char* name, struct file_attributes* attr)
** Return the number of bytes in the specified file
****************************************************************/
-long
+__int64
__gnat_file_length_attr (int fd, char* name, struct file_attributes* attr)
{
if (attr->file_length == -1) {
@@ -1318,7 +1318,7 @@ __gnat_file_length_attr (int fd, char* name, struct file_attributes* attr)
return attr->file_length;
}
-long
+__int64
__gnat_file_length (int fd)
{
struct file_attributes attr;
@@ -1326,7 +1326,7 @@ __gnat_file_length (int fd)
return __gnat_file_length_attr (fd, NULL, &attr);
}
-long
+__int64
__gnat_named_file_length (char *name)
{
struct file_attributes attr;
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index a870910..9b6bbca 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -98,7 +98,7 @@ struct file_attributes {
unsigned char directory;
OS_Time timestamp;
- long file_length;
+ __int64 file_length;
};
/* WARNING: changing the size here might require changing the constant
* File_Attributes_Size in osint.ads (which should be big enough to
@@ -151,8 +151,8 @@ extern int __gnat_create_output_file (char *);
extern int __gnat_create_output_file_new (char *);
extern int __gnat_open_append (char *, int);
-extern long __gnat_file_length (int);
-extern long __gnat_named_file_length (char *);
+extern __int64 __gnat_file_length (int);
+extern __int64 __gnat_named_file_length (char *);
extern void __gnat_tmp_name (char *);
extern DIR *__gnat_opendir (char *);
extern char *__gnat_readdir (DIR *, char *, int *);
@@ -177,7 +177,7 @@ extern int __gnat_is_executable_file (char *name);
extern void __gnat_reset_attributes (struct file_attributes *);
extern int __gnat_error_attributes (struct file_attributes *);
-extern long __gnat_file_length_attr (int, char *, struct file_attributes *);
+extern __int64 __gnat_file_length_attr (int, char *, struct file_attributes *);
extern OS_Time __gnat_file_time_name_attr (char *, struct file_attributes *);
extern OS_Time __gnat_file_time_fd_attr (int, struct file_attributes *);
extern int __gnat_file_exists_attr (char *, struct file_attributes *);
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 0c15982..159501d 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -1076,10 +1076,13 @@ package body Osint is
function Internal
(F : Integer;
N : C_File_Name;
- A : System.Address) return Long_Integer;
+ A : System.Address) return size_t;
pragma Import (C, Internal, "__gnat_file_length_attr");
begin
- return Internal (-1, Name, Attr.all'Address);
+ -- The conversion from size_t to Long_Integer is ok here as this
+ -- routine is only to be used by the compiler and we do not expect
+ -- a unit to be larger than a 32bit integer.
+ return Long_Integer (Internal (-1, Name, Attr.all'Address));
end File_Length;
---------------------
diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb
index 940bf51..eacc896 100644
--- a/gcc/ada/s-os_lib.adb
+++ b/gcc/ada/s-os_lib.adb
@@ -35,7 +35,6 @@ with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with System; use System;
with System.Case_Util;
-with System.CRTL;
with System.Soft_Links;
package body System.OS_Lib is
diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads
index d50d11f..7c47400 100644
--- a/gcc/ada/s-os_lib.ads
+++ b/gcc/ada/s-os_lib.ads
@@ -56,6 +56,8 @@ pragma Compiler_Unit_Warning;
with System;
with System.Strings;
+with System.CRTL;
+
package System.OS_Lib is
pragma Preelaborate;
@@ -432,7 +434,7 @@ package System.OS_Lib is
-- to the current position (origin = SEEK_CUR), end of file (origin =
-- SEEK_END), or start of file (origin = SEEK_SET).
- function File_Length (FD : File_Descriptor) return Long_Integer;
+ function File_Length (FD : File_Descriptor) return CRTL.size_t;
pragma Import (C, File_Length, "__gnat_file_length");
-- Get length of file from file descriptor FD