aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2019-08-13 08:07:08 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-13 08:07:08 +0000
commit3fee1dcfc7df9b393c019f289b6a28f7ad7f8f8c (patch)
treefee2dc29f5d93f78d71f8a6bae606716a516cdb9 /gcc
parent07c6ed01a7822229280329fd99587a35dc2acc83 (diff)
downloadgcc-3fee1dcfc7df9b393c019f289b6a28f7ad7f8f8c.zip
gcc-3fee1dcfc7df9b393c019f289b6a28f7ad7f8f8c.tar.gz
gcc-3fee1dcfc7df9b393c019f289b6a28f7ad7f8f8c.tar.bz2
[Ada] Fix incorrect binding to MapViewOfFile in s-win32.ads
Despite the "dw" prefix on the name, the dwNumberOfBytesToMap argument to MapViewOfFile was changed from DWORD to SIZE_T when 64bit Windows came about. This change adjusts the binding we have for it in System.Win32 accordingly. For consistency with established practice, an s-win32 specific version of size_t is introduced and g-sercom__mingw.adb is adjusted to disambiguate between this new size_t and the one already exposed in System.CRTL. 2019-08-13 Olivier Hainque <hainque@adacore.com> gcc/ada/ * libgnat/s-win32.ads: Define size_t and fix the MapViewOfFile binding to use it instead of DWORD for the dwNumberOfBytesToMap argument. * libgnat/g-sercom__mingw.adb (Read): State which definition of size_t to fetch in call to Last_Index. From-SVN: r274341
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/libgnat/g-sercom__mingw.adb2
-rw-r--r--gcc/ada/libgnat/s-win32.ads3
3 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a67cc5d..75d3d7b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2019-08-13 Olivier Hainque <hainque@adacore.com>
+
+ * libgnat/s-win32.ads: Define size_t and fix the MapViewOfFile
+ binding to use it instead of DWORD for the dwNumberOfBytesToMap
+ argument.
+ * libgnat/g-sercom__mingw.adb (Read): State which definition of
+ size_t to fetch in call to Last_Index.
+
2019-08-13 Arnaud Charlet <charlet@adacore.com>
* gcc-interface/Make-lang.in: Remove unused TRACE variable. Pass
diff --git a/gcc/ada/libgnat/g-sercom__mingw.adb b/gcc/ada/libgnat/g-sercom__mingw.adb
index c13e7b3..d5e2344 100644
--- a/gcc/ada/libgnat/g-sercom__mingw.adb
+++ b/gcc/ada/libgnat/g-sercom__mingw.adb
@@ -167,7 +167,7 @@ package body GNAT.Serial_Communications is
Raise_Error ("read error");
end if;
- Last := Last_Index (Buffer'First, size_t (Read_Last));
+ Last := Last_Index (Buffer'First, CRTL.size_t (Read_Last));
end Read;
---------
diff --git a/gcc/ada/libgnat/s-win32.ads b/gcc/ada/libgnat/s-win32.ads
index d09c4b3..ab832cd 100644
--- a/gcc/ada/libgnat/s-win32.ads
+++ b/gcc/ada/libgnat/s-win32.ads
@@ -63,6 +63,7 @@ package System.Win32 is
type BYTE is new Interfaces.C.unsigned_char;
type LONG is new Interfaces.C.long;
type CHAR is new Interfaces.C.char;
+ type SIZE_T is new Interfaces.C.size_t;
type BOOL is new Interfaces.C.int;
for BOOL'Size use Interfaces.C.int'Size;
@@ -238,7 +239,7 @@ package System.Win32 is
dwDesiredAccess : DWORD;
dwFileOffsetHigh : DWORD;
dwFileOffsetLow : DWORD;
- dwNumberOfBytesToMap : DWORD) return System.Address;
+ dwNumberOfBytesToMap : SIZE_T) return System.Address;
pragma Import (Stdcall, MapViewOfFile, "MapViewOfFile");
function UnmapViewOfFile (lpBaseAddress : System.Address) return BOOL;