[COMMITTED] ada: Add an assert in Posix Interrupt_Wait

Message ID 20230728073107.1852989-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Add an assert in Posix Interrupt_Wait |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Marc Poulhiès July 28, 2023, 7:31 a.m. UTC
  From: Clément Chigot <chigot@adacore.com>

All functions but Interrupt_Wait in s-inmaop__posix are checking the
result of their syscalls with an assert. However, any return code of
sigwait different than 0 means that something went wrong for it.

From sigwait man:
> RETURN VALUE
>      On success, sigwait() returns 0.  On  error,  it  returns  a
>      positive error number (listed in ERRORS).

gcc/ada/

	* libgnarl/s-inmaop__posix.adb: Add assert after sigwait in
	Interrupt_Wait

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/libgnarl/s-inmaop__posix.adb | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/gcc/ada/libgnarl/s-inmaop__posix.adb b/gcc/ada/libgnarl/s-inmaop__posix.adb
index 3171399f982..e4d07ee77eb 100644
--- a/gcc/ada/libgnarl/s-inmaop__posix.adb
+++ b/gcc/ada/libgnarl/s-inmaop__posix.adb
@@ -135,6 +135,7 @@  package body System.Interrupt_Management.Operations is
 
    begin
       Result := sigwait (Mask, Sig'Access);
+      pragma Assert (Result = 0);
 
       if Result /= 0 then
          return 0;