Commit 513eb6a0 authored by Ryan Scott's avatar Ryan Scott

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
parent b5d788aa
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment