diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-01-15 11:53:34 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-01-15 11:53:34 -0500 |
commit | db91d17edfbe7deecb62bbb89c804249f9c4a4bd (patch) | |
tree | 7c01e3256c19a009625f96bc5e977ac5b673cd4c /libraries/base/System/Posix | |
parent | 331f88d0d878eae926b3c1c61a3ff344916b62ed (diff) | |
download | haskell-db91d17edfbe7deecb62bbb89c804249f9c4a4bd.tar.gz |
Properly introduce CTimer to System.Posix.Types
Summary:
In ffc2327070dbb664bdb407a804121eacb2a7c734, an attempt was made at
adding a Haskell wrapper around the C `timer_t` type. Unfortunately, GHC's
autoconf macros weren't sophisticated enough at the time to properly detect
that `timer_t` is represented by a `void *` (i.e., a pointer) on most OSes.
This is a second attempt at `CTimer`, this time using `AC_COMPILE_IFELSE` to
detect if a type is a pointer type by compiling the following program:
```
type val;
*val;
```
This also only derives a small subset of class instances for `CTimer` that are
known to be compatible with `Ptr` using a new `OPAQUE_TYPE_WITH_CTYPE` macro.
Test Plan: ./validate
Reviewers: erikd, hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2952
GHC Trac Issues: #12795, #12998
Diffstat (limited to 'libraries/base/System/Posix')
-rw-r--r-- | libraries/base/System/Posix/Types.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libraries/base/System/Posix/Types.hs b/libraries/base/System/Posix/Types.hs index da4fc608d9..a02a5b94e4 100644 --- a/libraries/base/System/Posix/Types.hs +++ b/libraries/base/System/Posix/Types.hs @@ -92,13 +92,9 @@ module System.Posix.Types ( #if defined(HTYPE_KEY_T) CKey(..), #endif --- We can't support CTimer (timer_t) yet, as FPTOOLS_CHECK_HTYPE doesn't have --- the ability to discern pointer types (like void*, which timer_t usually is) --- from non-pointer types. See GHC Trac #12998. --- --- #if defined(HTYPE_TIMER_T) --- CTimer(..), --- #endif +#if defined(HTYPE_TIMER_T) + CTimer(..), +#endif Fd(..), @@ -213,6 +209,10 @@ INTEGRAL_TYPE_WITH_CTYPE(CId,id_t,HTYPE_ID_T) -- | @since 4.10.0.0 INTEGRAL_TYPE_WITH_CTYPE(CKey,key_t,HTYPE_KEY_T) #endif +#if defined(HTYPE_TIMER_T) +-- | @since 4.10.0.0 +OPAQUE_TYPE_WITH_CTYPE(CTimer,timer_t,HTYPE_TIMER_T) +#endif -- Make an Fd type rather than using CInt everywhere INTEGRAL_TYPE(Fd,CInt) |