diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2016-12-18 10:41:48 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2016-12-18 10:41:48 -0500 |
commit | 513eb6a0638a1c64b9d76bcab39ed80cdd9dbb27 (patch) | |
tree | bdcccb5cc54a9c84c952064f544b0b55ab945aca /libraries | |
parent | b5d788aa0e73fdf22cca3f88962e7652b07073cc (diff) | |
download | haskell-513eb6a0638a1c64b9d76bcab39ed80cdd9dbb27.tar.gz |
Fix #12998 by removing CTimer
Summary:
CTimer is a wrapper around `timer_t`, which is a typedef for `void*`
on most platforms. The issue is that GHC's `FPTOOLS_CHECK_HTYPE` is not robust
enough to discern pointer types from non-pointer types, so it mistakenly labels
`timer_t` as a `Double` or `Int32` (depending on how many bits a pointer takes
up on your platform). This wreaks havoc when trying to give it certain type
class instances, as noted in
https://phabricator.haskell.org/rGHCffc2327070dbb664bdb407a804121eacb2a7c734.
For now, the simplest thing to do would be removing `CTimer`, since:
1. The original author (@DanielG) didn't have a particular use in mind for
`timer_t` when he fixed #12795.
2. `CTimer` hasn't appeared in a release of `base` yet.
Fixes #12998.
Reviewers: austin, hvr, bgamari, DanielG, trofi
Reviewed By: bgamari, trofi
Subscribers: thomie, DanielG, erikd
Differential Revision: https://phabricator.haskell.org/D2876
GHC Trac Issues: #12795, #12998
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/System/Posix/Types.hs | 17 | ||||
-rw-r--r-- | libraries/base/changelog.md | 2 | ||||
-rw-r--r-- | libraries/base/configure.ac | 1 |
3 files changed, 8 insertions, 12 deletions
diff --git a/libraries/base/System/Posix/Types.hs b/libraries/base/System/Posix/Types.hs index 0e9e2ae596..da4fc608d9 100644 --- a/libraries/base/System/Posix/Types.hs +++ b/libraries/base/System/Posix/Types.hs @@ -92,9 +92,13 @@ module System.Posix.Types ( #if defined(HTYPE_KEY_T) CKey(..), #endif -#if defined(HTYPE_TIMER_T) - CTimer(..), -#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 Fd(..), @@ -132,9 +136,6 @@ import GHC.Base import GHC.Enum import GHC.Num import GHC.Real -#if defined(HTYPE_TIMER_T) -import GHC.Float -#endif -- import GHC.Prim import GHC.Read import GHC.Show @@ -212,10 +213,6 @@ 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 -FLOATING_TYPE_WITH_CTYPE(CTimer,timer_t,HTYPE_TIMER_T) -#endif -- Make an Fd type rather than using CInt everywhere INTEGRAL_TYPE(Fd,CInt) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index d2e738b186..e0cd3845fc 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -31,7 +31,7 @@ * Added `Eq1`, `Ord1`, `Read1` and `Show1` instances for `NonEmpty`. * Add wrappers for `blksize_t`, `blkcnt_t`, `clockid_t`, `fsblkcnt_t`, - `fsfilcnt_t`, `id_t`, `key_t` and `timer_t` to System.Posix.Types (#12795) + `fsfilcnt_t`, `id_t`, and `key_t` to System.Posix.Types (#12795) * Raw buffer operations in `GHC.IO.FD` are now strict in the buffer, offset, and length operations (#9696) diff --git a/libraries/base/configure.ac b/libraries/base/configure.ac index e6c8a9b276..c99c284c93 100644 --- a/libraries/base/configure.ac +++ b/libraries/base/configure.ac @@ -155,7 +155,6 @@ FPTOOLS_CHECK_HTYPE(fsblkcnt_t) FPTOOLS_CHECK_HTYPE(fsfilcnt_t) FPTOOLS_CHECK_HTYPE(id_t) FPTOOLS_CHECK_HTYPE(key_t) -FPTOOLS_CHECK_HTYPE(timer_t) FPTOOLS_CHECK_HTYPE(intptr_t) FPTOOLS_CHECK_HTYPE(uintptr_t) |