[commit: base] master: Build fix for iOS; fixes #7759 (93a4bda)
Ian Lynagh
igloo at earth.li
Sun Apr 21 21:53:13 CEST 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
https://github.com/ghc/packages-base/commit/93a4bdadd4d7b1428bcbbb15d9f777a5afc5c915
>---------------------------------------------------------------
commit 93a4bdadd4d7b1428bcbbb15d9f777a5afc5c915
Author: Ian Lynagh <ian at well-typed.com>
Date: Sun Apr 21 18:07:58 2013 +0100
Build fix for iOS; fixes #7759
Patch from Stephen Blackheath.
The issue here is that the #defines EVFILT_READ and EVFILT_WRITE have
the values -1 and -2. The original code translates that to
filterRead = Filter -1 which is wrong Haskell and fails to compile.
The modified code produces the correct code filterRead = Filter (-1)
>---------------------------------------------------------------
GHC/Event/KQueue.hsc | 8 ++++----
cbits/DarwinUtils.c | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/GHC/Event/KQueue.hsc b/GHC/Event/KQueue.hsc
index d157f64..fc1d679 100644
--- a/GHC/Event/KQueue.hsc
+++ b/GHC/Event/KQueue.hsc
@@ -197,10 +197,10 @@ newtype Filter = Filter Word16
#endif
deriving (Bits, Eq, Num, Show, Storable)
-#{enum Filter, Filter
- , filterRead = EVFILT_READ
- , filterWrite = EVFILT_WRITE
- }
+filterRead :: Filter
+filterRead = Filter (#const EVFILT_READ)
+filterWrite :: Filter
+filterWrite = Filter (#const EVFILT_WRITE)
data TimeSpec = TimeSpec {
tv_sec :: {-# UNPACK #-} !CTime
diff --git a/cbits/DarwinUtils.c b/cbits/DarwinUtils.c
index de1f352..d080934 100644
--- a/cbits/DarwinUtils.c
+++ b/cbits/DarwinUtils.c
@@ -1,6 +1,7 @@
#include "HsBase.h"
-#ifdef darwin_HOST_OS
+#if defined(darwin_HOST_OS) || defined(ios_HOST_OS)
+#include <mach/mach_time.h>
static double scaling_factor = 0.0;
More information about the ghc-commits
mailing list