[GHC] #9945: export list for System.Posix.Internals breaking the build on Windows

GHC ghc-devs at haskell.org
Thu Jan 1 12:23:54 UTC 2015


#9945: export list for System.Posix.Internals breaking the build on Windows
-------------------------------------+-------------------------------------
        Reporter:  MartinF           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:
Operating System:  Windows           |            Architecture:
 Type of failure:  Building GHC      |  Unknown/Multiple
  failed                             |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:  #9852             |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by MartinF):

 So apparently I just can't tear myself away - this morning I figured I
 might as well take another look at this.

 It turns out (after much `git grep -w`) that almost all of those
 conditional definitions are module-internal anyway. After dropping those
 from the export list, this is my diff (to be composed with the one I
 pasted above):

 {{{
 diff --git a/libraries/base/System/Posix/Internals.hs
 b/libraries/base/System/Posix/Internals.hs
 index d316826..ea24ec3 100644
 --- a/libraries/base/System/Posix/Internals.hs
 +++ b/libraries/base/System/Posix/Internals.hs
 @@ -39,17 +39,12 @@ module System.Posix.Internals
       s_issock, setCooked, setEcho, setNonBlockingFD, sizeof_stat, st_dev,
       st_ino, st_mode, st_mtime, st_size, statGetType, withFilePath,
  #if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
 -     c_fcntl_lock, c_fcntl_read, c_fcntl_write, c_fork, c_link, c_mkfifo,
 -     c_pipe, c_s_issock, c_sigaddset, c_sigemptyset, c_sigprocmask,
 -     c_tcgetattr, c_tcsetattr, c_utime, c_waitpid, setCloseOnExec,
 +     c_pipe, setCloseOnExec,
  #endif
  #if !defined(mingw32_HOST_OS)
       peekFilePathLen,
  #endif
 -#if defined(HTYPE_TCFLAG_T)
 -     c_lflag, get_saved_termios, poke_c_lflag, ptr_c_cc,
 set_saved_termios,
 -     sizeof_sigset_t, sizeof_termios, tcSetAttr,
 -#else
 +#if !defined(HTYPE_TCFLAG_T)
       is_console,
  #endif
       ) where
 }}}

 That compiles for me. As for the remaining conditional exports...

  `c_pipe`:: Only used in `GHC.Event.Control.newControl`. I node that
 module imports it unconditionally - but it seems all of `GHC.Event` is
 only used in non-Windows environments (if I'm reading
 `libraries/base/base.cabal` correctly), so that's fine.

  `setCloseOnExec`:: Also used in `GHC.Event.Control.newControl`, but
 additionally in `GHC.Event.EPoll.epollCreate`.

  `peekFilePathLen`:: Only used in
 `System.Environment.ExecutablePath.readSymbolicLink`, and only `#if
 defined(linux_HOST_OS)`.

  `is_console`:: As above, only used in `GHC.IO.FD.isTerminal`, and only
 `#if defined(mingw32_HOST_OS)`.

 So am I right in thinking, for the ones that are only used in one place,
 the solution would be to just move the `foreign import` to the point-of-
 use?

 That'd just leave `setCloseOnExec` (used in two places) - would
 `GHC.Event.Internal` be a good place for that one?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9945#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list