diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2016-01-30 23:14:23 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2016-01-31 00:19:53 +0100 |
commit | 2a49ad87b7b5d92bf62035d410c4bcde817d30a6 (patch) | |
tree | 6cba2a97efac7cea6153e6dd10bdc04cd6e669c6 /System | |
parent | 716eccb11f324abc120c24ce0344b7094f1aa435 (diff) |
Drop redundant __GLASGOW_HASKELL__ conditionals for GHC>=7.4
Diffstat (limited to 'System')
39 files changed, 35 insertions, 100 deletions
diff --git a/System/Posix.hs b/System/Posix.hs index 09bdde6..b5b221a 100644 --- a/System/Posix.hs +++ b/System/Posix.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Safe #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix diff --git a/System/Posix/ByteString.hs b/System/Posix/ByteString.hs index 793020c..7f0b266 100644 --- a/System/Posix/ByteString.hs +++ b/System/Posix/ByteString.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Safe #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.ByteString diff --git a/System/Posix/ByteString/FilePath.hsc b/System/Posix/ByteString/FilePath.hsc index 5e3692a..b6768fc 100644 --- a/System/Posix/ByteString/FilePath.hsc +++ b/System/Posix/ByteString/FilePath.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc index 7a3d52a..f1caaaf 100644 --- a/System/Posix/Directory.hsc +++ b/System/Posix/Directory.hsc @@ -1,8 +1,6 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} -#endif ----------------------------------------------------------------------------- -- | diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc index b67ad46..3f96831 100644 --- a/System/Posix/Directory/ByteString.hsc +++ b/System/Posix/Directory/ByteString.hsc @@ -1,8 +1,6 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} -#endif ----------------------------------------------------------------------------- -- | diff --git a/System/Posix/Directory/Common.hsc b/System/Posix/Directory/Common.hsc index 9fb5ac4..aba20af 100644 --- a/System/Posix/Directory/Common.hsc +++ b/System/Posix/Directory/Common.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif diff --git a/System/Posix/DynamicLinker.hsc b/System/Posix/DynamicLinker.hsc index a2b7336..656054c 100644 --- a/System/Posix/DynamicLinker.hsc +++ b/System/Posix/DynamicLinker.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/DynamicLinker/ByteString.hsc b/System/Posix/DynamicLinker/ByteString.hsc index 2111aa2..1693fed 100644 --- a/System/Posix/DynamicLinker/ByteString.hsc +++ b/System/Posix/DynamicLinker/ByteString.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif diff --git a/System/Posix/DynamicLinker/Common.hsc b/System/Posix/DynamicLinker/Common.hsc index 8a44d95..32bfccc 100644 --- a/System/Posix/DynamicLinker/Common.hsc +++ b/System/Posix/DynamicLinker/Common.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/DynamicLinker/Module.hsc b/System/Posix/DynamicLinker/Module.hsc index d971fa7..eb4938b 100644 --- a/System/Posix/DynamicLinker/Module.hsc +++ b/System/Posix/DynamicLinker/Module.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/DynamicLinker/Module/ByteString.hsc b/System/Posix/DynamicLinker/Module/ByteString.hsc index d5973a8..3a902bc 100644 --- a/System/Posix/DynamicLinker/Module/ByteString.hsc +++ b/System/Posix/DynamicLinker/Module/ByteString.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif diff --git a/System/Posix/DynamicLinker/Prim.hsc b/System/Posix/DynamicLinker/Prim.hsc index e737918..67d4aa8 100644 --- a/System/Posix/DynamicLinker/Prim.hsc +++ b/System/Posix/DynamicLinker/Prim.hsc @@ -1,9 +1,8 @@ -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} #if __GLASGOW_HASKELL__ >= 709 {-# OPTIONS_GHC -fno-warn-trustworthy-safe #-} #endif -#endif + ----------------------------------------------------------------------------- -- | -- Module : System.Posix.DynamicLinker.Prim diff --git a/System/Posix/Env.hsc b/System/Posix/Env.hsc index 95b7bc8..6d7f61b 100644 --- a/System/Posix/Env.hsc +++ b/System/Posix/Env.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/Env/ByteString.hsc b/System/Posix/Env/ByteString.hsc index 9217525..0bbcfd8 100644 --- a/System/Posix/Env/ByteString.hsc +++ b/System/Posix/Env/ByteString.hsc @@ -1,9 +1,7 @@ -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} #if __GLASGOW_HASKELL__ >= 709 {-# OPTIONS_GHC -fno-warn-trustworthy-safe #-} #endif -#endif ----------------------------------------------------------------------------- -- | diff --git a/System/Posix/Error.hs b/System/Posix/Error.hs index d3b10a7..9d2ac70 100644 --- a/System/Posix/Error.hs +++ b/System/Posix/Error.hs @@ -1,7 +1,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/Fcntl.hsc b/System/Posix/Fcntl.hsc index 749826f..2d8ef12 100644 --- a/System/Posix/Fcntl.hsc +++ b/System/Posix/Fcntl.hsc @@ -1,7 +1,7 @@ {-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index d0ff4bf..7c637cc 100644 --- a/System/Posix/Files.hsc +++ b/System/Posix/Files.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif {-# LANGUAGE CApiFFI #-} diff --git a/System/Posix/Files/ByteString.hsc b/System/Posix/Files/ByteString.hsc index 12bd39a..872817e 100644 --- a/System/Posix/Files/ByteString.hsc +++ b/System/Posix/Files/ByteString.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif {-# LANGUAGE CApiFFI #-} diff --git a/System/Posix/Files/Common.hsc b/System/Posix/Files/Common.hsc index 963008f..a1a4278 100644 --- a/System/Posix/Files/Common.hsc +++ b/System/Posix/Files/Common.hsc @@ -1,6 +1,5 @@ -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} -#endif + ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Files.Common diff --git a/System/Posix/IO.hsc b/System/Posix/IO.hsc index 41e0b3b..b3f4c84 100644 --- a/System/Posix/IO.hsc +++ b/System/Posix/IO.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/IO/ByteString.hsc b/System/Posix/IO/ByteString.hsc index b8bc87a..d387f0e 100644 --- a/System/Posix/IO/ByteString.hsc +++ b/System/Posix/IO/ByteString.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/IO/Common.hsc b/System/Posix/IO/Common.hsc index abcd19b..8f8ddb9 100644 --- a/System/Posix/IO/Common.hsc +++ b/System/Posix/IO/Common.hsc @@ -1,7 +1,7 @@ {-# LANGUAGE NondecreasingIndentation, RecordWildCards #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif @@ -70,14 +70,12 @@ import qualified System.Posix.Internals as Base import Foreign import Foreign.C -#ifdef __GLASGOW_HASKELL__ import GHC.IO.Handle.Internals import GHC.IO.Handle.Types import qualified GHC.IO.FD as FD import qualified GHC.IO.Handle.FD as FD import GHC.IO.Exception import Data.Typeable (cast) -#endif #include "HsUnix.h" @@ -206,8 +204,8 @@ handleToFd :: Handle -> IO Fd -- | Converts an 'Fd' into a 'Handle' that can be used with the -- standard Haskell IO library (see "System.IO"). fdToHandle :: Fd -> IO Handle +fdToHandle fd = FD.fdToHandle (fromIntegral fd) -#ifdef __GLASGOW_HASKELL__ handleToFd h@(FileHandle _ m) = do withHandle' "handleToFd" h m $ handleToFd' h handleToFd h@(DuplexHandle _ r w) = do @@ -231,8 +229,6 @@ handleToFd' h h_@Handle__{haType=_,..} = do FD.release fd return (Handle__{haType=ClosedHandle,..}, Fd (FD.fdFD fd)) -fdToHandle fd = FD.fdToHandle (fromIntegral fd) -#endif -- ----------------------------------------------------------------------------- -- Fd options diff --git a/System/Posix/Process.hsc b/System/Posix/Process.hsc index 72da1c6..afdb164 100644 --- a/System/Posix/Process.hsc +++ b/System/Posix/Process.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- @@ -22,10 +22,8 @@ module System.Posix.Process ( -- * Processes -- ** Forking and executing -#ifdef __GLASGOW_HASKELL__ forkProcess, forkProcessWithUnmask, -#endif executeFile, -- ** Exiting diff --git a/System/Posix/Process/ByteString.hsc b/System/Posix/Process/ByteString.hsc index 64fc71e..39da5ba 100644 --- a/System/Posix/Process/ByteString.hsc +++ b/System/Posix/Process/ByteString.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif @@ -23,10 +23,8 @@ module System.Posix.Process.ByteString ( -- * Processes -- ** Forking and executing -#ifdef __GLASGOW_HASKELL__ forkProcess, forkProcessWithUnmask, -#endif executeFile, -- ** Exiting diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc index d0d2b09..59212e4 100644 --- a/System/Posix/Process/Common.hsc +++ b/System/Posix/Process/Common.hsc @@ -1,8 +1,7 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE InterruptibleFFI, RankNTypes #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} -#endif + ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Process.Common @@ -22,10 +21,8 @@ module System.Posix.Process.Common ( -- * Processes -- ** Forking and executing -#ifdef __GLASGOW_HASKELL__ forkProcess, forkProcessWithUnmask, -#endif -- ** Exiting exitImmediately, @@ -82,11 +79,9 @@ import System.Posix.Process.Internals import System.Posix.Types import Control.Monad -#ifdef __GLASGOW_HASKELL__ import Control.Exception.Base ( bracket, getMaskingState, MaskingState(..) ) -- used by forkProcess import GHC.TopHandler ( runIO ) import GHC.IO ( unsafeUnmask, uninterruptibleMask_ ) -#endif -- ----------------------------------------------------------------------------- -- Process environment @@ -271,7 +266,6 @@ foreign import ccall unsafe "setpriority" -- ----------------------------------------------------------------------------- -- Forking, execution -#ifdef __GLASGOW_HASKELL__ {- | 'forkProcess' corresponds to the POSIX @fork@ system call. The 'IO' action passed as an argument is executed in the child process; no other threads will be copied to the child process. @@ -311,8 +305,6 @@ foreign import ccall "forkProcess" forkProcessPrim :: StablePtr (IO ()) -> IO CP forkProcessWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ProcessID forkProcessWithUnmask action = forkProcess (action unsafeUnmask) -#endif /* __GLASGOW_HASKELL__ */ - -- ----------------------------------------------------------------------------- -- Waiting for process termination diff --git a/System/Posix/Process/Internals.hs b/System/Posix/Process/Internals.hs index 970bc9f..fd0e68d 100644 --- a/System/Posix/Process/Internals.hs +++ b/System/Posix/Process/Internals.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE CPP #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} -#endif module System.Posix.Process.Internals ( pPrPr_disableITimers, c_execvpe, diff --git a/System/Posix/Resource.hsc b/System/Posix/Resource.hsc index 280c25f..3418ecf 100644 --- a/System/Posix/Resource.hsc +++ b/System/Posix/Resource.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/Semaphore.hsc b/System/Posix/Semaphore.hsc index 02959ae..12db924 100644 --- a/System/Posix/Semaphore.hsc +++ b/System/Posix/Semaphore.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/SharedMem.hsc b/System/Posix/SharedMem.hsc index ff43b97..a6326a7 100644 --- a/System/Posix/SharedMem.hsc +++ b/System/Posix/SharedMem.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/Signals.hsc b/System/Posix/Signals.hsc index e8fc1c5..222911a 100644 --- a/System/Posix/Signals.hsc +++ b/System/Posix/Signals.hsc @@ -1,8 +1,6 @@ {-# LANGUAGE CApiFFI, CPP, DeriveDataTypeable, NondecreasingIndentation #-} {-# OPTIONS_GHC -fno-cse #-} -- global variables -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Signals @@ -66,12 +64,10 @@ module System.Posix.Signals ( signalProcess, signalProcessGroup, -#ifdef __GLASGOW_HASKELL__ -- * Handling signals Handler(Default,Ignore,Catch,CatchOnce,CatchInfo,CatchInfoOnce), SignalInfo(..), SignalSpecificInfo(..), installHandler, -#endif -- * Signal sets SignalSet, @@ -88,10 +84,8 @@ module System.Posix.Signals ( getPendingSignals, awaitSignal, -#ifdef __GLASGOW_HASKELL__ -- * The @NOCLDSTOP@ flag setStoppedChildFlag, queryStoppedChildFlag, -#endif -- MISSING FUNCTIONALITY: -- sigaction(), (inc. the sigaction structure + flags etc.) @@ -114,11 +108,9 @@ import System.Posix.Process import System.Posix.Process.Internals import Data.Dynamic -#ifdef __GLASGOW_HASKELL__ ##include "rts/Signals.h" import GHC.Conc hiding (Signal) -#endif -- ----------------------------------------------------------------------------- -- Specific signals @@ -298,7 +290,7 @@ foreign import ccall unsafe "killpg" raiseSignal :: Signal -> IO () raiseSignal sig = throwErrnoIfMinus1_ "raiseSignal" (c_raise sig) -#if defined(__GLASGOW_HASKELL__) && (defined(openbsd_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(darwin_HOST_OS)) +#if (defined(openbsd_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(darwin_HOST_OS)) foreign import ccall unsafe "genericRaise" c_raise :: CInt -> IO CInt #else @@ -306,9 +298,8 @@ foreign import ccall unsafe "raise" c_raise :: CInt -> IO CInt #endif -#ifdef __GLASGOW_HASKELL__ -type Signal = CInt +type Signal = CInt -- | The actions to perform when a signal is received. data Handler = Default @@ -448,7 +439,6 @@ unmarshalSigInfo fp = do siginfoSpecific = extra } #endif /* !__PARALLEL_HASKELL__ */ -#endif /* __GLASGOW_HASKELL__ */ -- ----------------------------------------------------------------------------- -- Alarms @@ -463,7 +453,6 @@ scheduleAlarm secs = do foreign import ccall unsafe "alarm" c_alarm :: CUInt -> IO CUInt -#ifdef __GLASGOW_HASKELL__ -- ----------------------------------------------------------------------------- -- The NOCLDSTOP flag @@ -482,7 +471,6 @@ queryStoppedChildFlag :: IO Bool queryStoppedChildFlag = do rc <- peek nocldstop return (rc == (0::Int)) -#endif /* __GLASGOW_HASKELL__ */ -- ----------------------------------------------------------------------------- -- Manipulating signal sets diff --git a/System/Posix/Signals/Exts.hsc b/System/Posix/Signals/Exts.hsc index 95796a2..3634277 100644 --- a/System/Posix/Signals/Exts.hsc +++ b/System/Posix/Signals/Exts.hsc @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Safe #-} -#endif ----------------------------------------------------------------------------- -- | diff --git a/System/Posix/Temp.hsc b/System/Posix/Temp.hsc index 2d7ca52..473364c 100644 --- a/System/Posix/Temp.hsc +++ b/System/Posix/Temp.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- @@ -33,10 +33,8 @@ import System.Posix.IO import System.Posix.Types import System.Posix.Internals (withFilePath, peekFilePath) -#if defined(__GLASGOW_HASKELL__) foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" c_mkstemp :: CString -> IO CInt -#endif -- | Make a unique filename and open it for reading\/writing. The returned -- 'FilePath' is the (possibly relative) path of the created file, which is @@ -48,17 +46,11 @@ foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" mkstemp :: String -> IO (FilePath, Handle) mkstemp template' = do let template = template' ++ "XXXXXX" -#if defined(__GLASGOW_HASKELL__) withFilePath template $ \ ptr -> do fd <- throwErrnoIfMinus1 "mkstemp" (c_mkstemp ptr) name <- peekFilePath ptr h <- fdToHandle (Fd fd) return (name, h) -#else - name <- mktemp template - h <- openFile name ReadWriteMode - return (name, h) -#endif #if HAVE_MKSTEMPS foreign import ccall unsafe "HsUnix.h __hscore_mkstemps" @@ -114,7 +106,7 @@ mkdtemp template' = do return name #endif -#if !defined(__GLASGOW_HASKELL__) || !HAVE_MKDTEMP +#if !HAVE_MKDTEMP foreign import ccall unsafe "mktemp" c_mktemp :: CString -> IO CString diff --git a/System/Posix/Temp/ByteString.hsc b/System/Posix/Temp/ByteString.hsc index 84ad49e..67442fc 100644 --- a/System/Posix/Temp/ByteString.hsc +++ b/System/Posix/Temp/ByteString.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- @@ -38,10 +38,8 @@ import System.Posix.Directory (createDirectory) import System.Posix.IO import System.Posix.Types -#if defined(__GLASGOW_HASKELL__) foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" c_mkstemp :: CString -> IO CInt -#endif -- | Make a unique filename and open it for reading\/writing. The returned -- 'RawFilePath' is the (possibly relative) path of the created file, which is @@ -53,17 +51,11 @@ foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" mkstemp :: ByteString -> IO (RawFilePath, Handle) mkstemp template' = do let template = template' `B.append` (BC.pack "XXXXXX") -#if defined(__GLASGOW_HASKELL__) withFilePath template $ \ ptr -> do fd <- throwErrnoIfMinus1 "mkstemp" (c_mkstemp ptr) name <- peekFilePath ptr h <- fdToHandle (Fd fd) return (name, h) -#else - name <- mktemp template - h <- openFile (BC.unpack name) ReadWriteMode - return (name, h) -#endif #if HAVE_MKSTEMPS foreign import ccall unsafe "HsUnix.h __hscore_mkstemps" @@ -114,7 +106,7 @@ mkdtemp template' = do return name #endif -#if !defined(__GLASGOW_HASKELL__) || !HAVE_MKDTEMP +#if !HAVE_MKDTEMP foreign import ccall unsafe "mktemp" c_mktemp :: CString -> IO CString diff --git a/System/Posix/Terminal.hsc b/System/Posix/Terminal.hsc index 88bd93f..c1b3ff8 100644 --- a/System/Posix/Terminal.hsc +++ b/System/Posix/Terminal.hsc @@ -1,7 +1,7 @@ {-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/Terminal/ByteString.hsc b/System/Posix/Terminal/ByteString.hsc index 3c7abfb..d98a9c0 100644 --- a/System/Posix/Terminal/ByteString.hsc +++ b/System/Posix/Terminal/ByteString.hsc @@ -1,7 +1,7 @@ {-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc index 5d81ec5..573df16 100644 --- a/System/Posix/Terminal/Common.hsc +++ b/System/Posix/Terminal/Common.hsc @@ -1,7 +1,6 @@ {-# LANGUAGE CApiFFI #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} -#endif + ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Terminal.Common diff --git a/System/Posix/Time.hs b/System/Posix/Time.hs index 7a2232f..b6ed885 100644 --- a/System/Posix/Time.hs +++ b/System/Posix/Time.hs @@ -2,7 +2,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/System/Posix/Unistd.hsc b/System/Posix/Unistd.hsc index 7f79113..84bd472 100644 --- a/System/Posix/Unistd.hsc +++ b/System/Posix/Unistd.hsc @@ -2,7 +2,7 @@ {-# LANGUAGE NondecreasingIndentation #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- @@ -118,9 +118,7 @@ sleep :: Int -> IO Int sleep 0 = return 0 sleep secs = do r <- c_sleep (fromIntegral secs); return (fromIntegral r) -#ifdef __GLASGOW_HASKELL__ {-# WARNING sleep "This function has several shortcomings (see documentation). Please consider using Control.Concurrent.threadDelay instead." #-} -#endif foreign import ccall safe "sleep" c_sleep :: CUInt -> IO CUInt diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc index 3e11389..01a417d 100644 --- a/System/Posix/User.hsc +++ b/System/Posix/User.hsc @@ -1,6 +1,4 @@ -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy, CApiFFI #-} -#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.User |