From: Ronan Desplanques <[email protected]>
This patches fixes the signature of the binding to SetThreadAffinityMask
in the run-time library. It also fixes the error checking after calls
to SetThreadAffinityMask. The previous code behaved as if
SetThreadAffinityMask returned 1 on success, but it in fact returns a
pointer value on success and 0 on failure.
gcc/ada/
* libgnarl/s-taprop__mingw.adb (Set_Task_Affinity): Fix usage of
SetThreadAffinityMask.
* libgnat/s-winext.ads (SetThreadAffinityMask): Fix binding
signature.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/libgnarl/s-taprop__mingw.adb | 6 +++---
gcc/ada/libgnat/s-winext.ads | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/libgnarl/s-taprop__mingw.adb
b/gcc/ada/libgnarl/s-taprop__mingw.adb
index 38e281cb721..f77d71970b8 100644
--- a/gcc/ada/libgnarl/s-taprop__mingw.adb
+++ b/gcc/ada/libgnarl/s-taprop__mingw.adb
@@ -1340,7 +1340,7 @@ package body System.Task_Primitives.Operations is
then
declare
CPU_Set : DWORD := 0;
-
+ Mask_Result : DWORD_PTR;
begin
for Proc in T.Common.Domain'Range loop
if T.Common.Domain (Proc) then
@@ -1352,8 +1352,8 @@ package body System.Task_Primitives.Operations is
end if;
end loop;
- Result := SetThreadAffinityMask (T.Common.LL.Thread, CPU_Set);
- pragma Assert (Result = 1);
+ Mask_Result := SetThreadAffinityMask (T.Common.LL.Thread, CPU_Set);
+ pragma Assert (Mask_Result /= 0);
end;
end if;
end Set_Task_Affinity;
diff --git a/gcc/ada/libgnat/s-winext.ads b/gcc/ada/libgnat/s-winext.ads
index 3f14fc04e60..b402a5615c9 100644
--- a/gcc/ada/libgnat/s-winext.ads
+++ b/gcc/ada/libgnat/s-winext.ads
@@ -55,7 +55,7 @@ package System.Win32.Ext is
function SetThreadAffinityMask
(hThread : HANDLE;
- dwThreadAffinityMask : DWORD) return DWORD;
+ dwThreadAffinityMask : DWORD) return DWORD_PTR;
pragma Import (Stdcall, SetThreadAffinityMask, "SetThreadAffinityMask");
--------------
--
2.45.1