Skip to content
  • Ryan Scott's avatar
    Properly introduce CTimer to System.Posix.Types · db91d17e
    Ryan Scott authored
    Summary:
    In ffc23270, 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
    db91d17e