From: Ronan Desplanques Date: Mon, 15 Apr 2024 16:07:49 +0000 (+0200) Subject: ada: Fix usage of SetThreadIdealProcessor X-Git-Tag: basepoints/gcc-16~8409 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aec9d8c9f5d673ff745f7b0560966e98b1404a53;p=thirdparty%2Fgcc.git ada: Fix usage of SetThreadIdealProcessor This patches fixes the way the run-time library checks the return value of SetThreadIdealProcessor. gcc/ada/ * libgnarl/s-taprop__mingw.adb (Set_Task_Affinity): Fix usage of SetThreadIdealProcessor. --- diff --git a/gcc/ada/libgnarl/s-taprop__mingw.adb b/gcc/ada/libgnarl/s-taprop__mingw.adb index 3a124ba78d0..38e281cb721 100644 --- a/gcc/ada/libgnarl/s-taprop__mingw.adb +++ b/gcc/ada/libgnarl/s-taprop__mingw.adb @@ -1308,7 +1308,13 @@ package body System.Task_Primitives.Operations is Result := SetThreadIdealProcessor (T.Common.LL.Thread, ProcessorId (T.Common.Base_CPU) - 1); - pragma Assert (Result = 1); + + -- The documentation for SetThreadIdealProcessor states: + -- + -- If the function fails, the return value is (DWORD) - 1. + -- + -- That should map to DWORD'Last in Ada. + pragma Assert (Result /= DWORD'Last); -- Task_Info @@ -1317,7 +1323,10 @@ package body System.Task_Primitives.Operations is Result := SetThreadIdealProcessor (T.Common.LL.Thread, T.Common.Task_Info.CPU); - pragma Assert (Result = 1); + + -- See the comment above about the return value of + -- SetThreadIdealProcessor. + pragma Assert (Result /= DWORD'Last); end if; -- Dispatching domains