diff options
author | Cheng Shao <astrohavoc@gmail.com> | 2022-10-21 13:49:15 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-11-11 00:26:55 -0500 |
commit | 00124d12d3ab21951104b279dbc6999b8ea42fba (patch) | |
tree | 49b7d0469d636ca4a46ff347c62d338258603451 | |
parent | 07e92c92673c48db0325f101d07d73134ed79fe9 (diff) | |
download | haskell-00124d12d3ab21951104b279dbc6999b8ea42fba.tar.gz |
testsuite: correct sleep() signature in T5611
In libc, sleep() returns an integer. The ccall type signature should
match the libc definition, otherwise it causes linker error on wasm.
-rw-r--r-- | testsuite/tests/concurrent/should_run/T5611.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/concurrent/should_run/T5611a.hs | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/testsuite/tests/concurrent/should_run/T5611.hs b/testsuite/tests/concurrent/should_run/T5611.hs index 1b056178a2..174da10e53 100644 --- a/testsuite/tests/concurrent/should_run/T5611.hs +++ b/testsuite/tests/concurrent/should_run/T5611.hs @@ -1,6 +1,7 @@ {-# LANGUAGE CPP,ForeignFunctionInterface #-} import Control.Concurrent +import Data.Functor import Foreign.C import System.IO @@ -8,8 +9,8 @@ import System.IO sleep n = sleepBlock (n*1000) foreign import stdcall safe "Sleep" sleepBlock :: Int -> IO () #else -sleep n = sleepBlock n -foreign import ccall safe "sleep" sleepBlock :: Int -> IO () +sleep n = void $ sleepBlock n +foreign import ccall safe "sleep" sleepBlock :: Int -> IO Int #endif main :: IO () diff --git a/testsuite/tests/concurrent/should_run/T5611a.hs b/testsuite/tests/concurrent/should_run/T5611a.hs index 81e6cc957e..6020c50a9d 100644 --- a/testsuite/tests/concurrent/should_run/T5611a.hs +++ b/testsuite/tests/concurrent/should_run/T5611a.hs @@ -3,6 +3,7 @@ {-# LANGUAGE CPP,ForeignFunctionInterface #-} import Control.Concurrent +import Data.Functor import Foreign.C import System.IO @@ -10,8 +11,8 @@ import System.IO sleep n = sleepBlock (n*1000) foreign import stdcall unsafe "Sleep" sleepBlock :: Int -> IO () #else -sleep n = sleepBlock n -foreign import ccall unsafe "sleep" sleepBlock :: Int -> IO () +sleep n = void $ sleepBlock n +foreign import ccall unsafe "sleep" sleepBlock :: Int -> IO Int #endif main :: IO () |