[commit: packages/process] less-cpp, master: Fix Windows build again (9d923c5)

git at git.haskell.org git at git.haskell.org
Tue Dec 15 13:34:49 UTC 2015


Repository : ssh://git@git.haskell.org/process

On branches: less-cpp,master
Link       : http://ghc.haskell.org/trac/ghc/changeset/9d923c57adfa75626ee4c2c9d3d76bf137414233/process

>---------------------------------------------------------------

commit 9d923c57adfa75626ee4c2c9d3d76bf137414233
Author: Michael Snoyman <michael at snoyman.com>
Date:   Mon Nov 2 11:29:10 2015 -0800

    Fix Windows build again


>---------------------------------------------------------------

9d923c57adfa75626ee4c2c9d3d76bf137414233
 System/Process/{Windows.hs => Windows.hsc} | 37 +++++++++++++-----------------
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/System/Process/Windows.hs b/System/Process/Windows.hsc
similarity index 93%
rename from System/Process/Windows.hs
rename to System/Process/Windows.hsc
index 4c1d7ce..a984bae 100644
--- a/System/Process/Windows.hs
+++ b/System/Process/Windows.hsc
@@ -25,14 +25,9 @@ import System.IO.Unsafe
 
 import System.Posix.Internals
 import GHC.IO.Exception
-import GHC.IO.Encoding
-import qualified GHC.IO.FD as FD
-import GHC.IO.Device
 import GHC.IO.Handle.FD
-import GHC.IO.Handle.Internals
 import GHC.IO.Handle.Types hiding (ClosedHandle)
 import System.IO.Error
-import Data.Typeable
 import GHC.IO.IOMode
 
 import System.Directory         ( doesFileExist )
@@ -40,19 +35,11 @@ import System.Environment       ( getEnv )
 import System.FilePath
 import System.Win32.Console (generateConsoleCtrlEvent, cTRL_BREAK_EVENT)
 import System.Win32.Process (getProcessId)
-# include <fcntl.h>     /* for _O_BINARY */
 
-import System.Process.Common
-
-#if defined(i386_HOST_ARCH)
-# define WINDOWS_CCONV stdcall
-#elif defined(x86_64_HOST_ARCH)
-# define WINDOWS_CCONV ccall
-#endif
+-- The double hash is used so that hsc does not process this include file
+##include "processFlags.h"
 
-#include <io.h>        /* for _close and _pipe */
-#include "HsProcessConfig.h"
-#include "processFlags.h"
+#include <fcntl.h>     /* for _O_BINARY */
 
 throwErrnoIfBadPHandle :: String -> IO PHANDLE -> IO PHANDLE
 throwErrnoIfBadPHandle = throwErrnoIfNull
@@ -76,7 +63,15 @@ processHandleFinaliser m =
 closePHANDLE :: PHANDLE -> IO ()
 closePHANDLE ph = c_CloseHandle ph
 
-foreign import WINDOWS_CCONV unsafe "CloseHandle"
+foreign import
+#if defined(i386_HOST_ARCH)
+  stdcall
+#elif defined(x86_64_HOST_ARCH)
+  ccall
+#else
+#error "Unknown architecture"
+#endif
+  unsafe "CloseHandle"
   c_CloseHandle
         :: PHANDLE
         -> IO ()
@@ -241,7 +236,7 @@ translateInternal xs = '"' : snd (foldr escape (True,"\"") xs)
 
 withCEnvironment :: [(String,String)] -> (Ptr CWString -> IO a) -> IO a
 withCEnvironment envir act =
-  let env' = foldr (\(name, val) env -> name ++ ('=':val)++'\0':env) "\0" envir
+  let env' = foldr (\(name, val) env0 -> name ++ ('=':val)++'\0':env0) "\0" envir
   in withCWString env' (act . castPtr)
 
 isDefaultSignal :: CLong -> Bool
@@ -256,10 +251,10 @@ createPipeInternal = do
         return (readfd, writefd)
     (do readh <- fdToHandle readfd
         writeh <- fdToHandle writefd
-        return (readh, writeh)) `onException` (close readfd >> close writefd)
+        return (readh, writeh)) `onException` (close' readfd >> close' writefd)
 
-close :: CInt -> IO ()
-close = throwErrnoIfMinus1_ "_close" . c__close
+close' :: CInt -> IO ()
+close' = throwErrnoIfMinus1_ "_close" . c__close
 
 foreign import ccall "io.h _pipe" c__pipe ::
     Ptr CInt -> CUInt -> CInt -> IO CInt



More information about the ghc-commits mailing list