From: Tonu Naks <naks@adacore.com>
gcc/ada/ChangeLog:
* libgnat/s-crtl.ads: define unsigned
* libgnat/s-crtl__mingw.adb (read, write): change arg type
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/libgnat/s-crtl.ads | 3 +++
gcc/ada/libgnat/s-crtl__mingw.adb | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
@@ -50,6 +50,9 @@ package System.CRTL is
subtype int is Integer;
+ type unsigned is mod 2 ** 32;
+ for unsigned'Size use 32;
+
type long is range -(2 ** (System.Parameters.long_bits - 1))
.. +(2 ** (System.Parameters.long_bits - 1)) - 1;
@@ -40,10 +40,10 @@ package body System.CRTL is
function read (fd : int; buffer : chars; count : size_t) return ssize_t
is
function read_raw
- (fd : int; buffer : chars; count : size_t) return int;
+ (fd : int; buffer : chars; count : unsigned) return int;
pragma Import (C, read_raw, "read");
begin
- return ssize_t (read_raw (fd, buffer, count));
+ return ssize_t (read_raw (fd, buffer, unsigned (count)));
end read;
-----------
@@ -53,10 +53,10 @@ package body System.CRTL is
function write (fd : int; buffer : chars; count : size_t) return ssize_t
is
function write_raw
- (fd : int; buffer : chars; count : size_t) return int;
+ (fd : int; buffer : chars; count : unsigned) return int;
pragma Import (C, write_raw, "write");
begin
- return ssize_t (write_raw (fd, buffer, count));
+ return ssize_t (write_raw (fd, buffer, unsigned (count)));
end write;
end System.CRTL;