summaryrefslogtreecommitdiff
path: root/libraries/base
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base')
-rw-r--r--libraries/base/Control/Concurrent.hs12
-rw-r--r--libraries/base/Data/Bits.hs2
-rw-r--r--libraries/base/Data/OldList.hs10
-rw-r--r--libraries/base/Data/Semigroup.hs4
-rw-r--r--libraries/base/Foreign/C/String.hs2
-rw-r--r--libraries/base/GHC/Conc.hs8
-rw-r--r--libraries/base/GHC/Conc/IO.hs22
-rw-r--r--libraries/base/GHC/Conc/Windows.hs2
-rw-r--r--libraries/base/GHC/Environment.hs4
-rw-r--r--libraries/base/GHC/Event/KQueue.hsc4
-rw-r--r--libraries/base/GHC/Event/Poll.hsc2
-rw-r--r--libraries/base/GHC/IO/Buffer.hs12
-rw-r--r--libraries/base/GHC/IO/Encoding/CodePage.hs2
-rw-r--r--libraries/base/GHC/IO/Encoding/CodePage/API.hs10
-rw-r--r--libraries/base/GHC/IO/Encoding/Iconv.hs2
-rw-r--r--libraries/base/GHC/IO/FD.hs30
-rw-r--r--libraries/base/GHC/IO/Handle.hs2
-rw-r--r--libraries/base/GHC/IO/Handle/FD.hs6
-rw-r--r--libraries/base/GHC/IO/Handle/Text.hs2
-rw-r--r--libraries/base/GHC/IO/Handle/Types.hs6
-rw-r--r--libraries/base/GHC/List.hs28
-rw-r--r--libraries/base/GHC/Real.hs4
-rw-r--r--libraries/base/GHC/TopHandler.hs6
-rw-r--r--libraries/base/System/Environment.hs28
-rw-r--r--libraries/base/System/IO.hs8
-rw-r--r--libraries/base/System/Posix/Internals.hs6
-rw-r--r--libraries/base/System/Timeout.hs4
-rw-r--r--libraries/base/cbits/SetEnv.c4
-rw-r--r--libraries/base/cbits/iconv.c2
-rw-r--r--libraries/base/cbits/primFloat.c2
-rw-r--r--libraries/base/include/HsBase.h54
-rw-r--r--libraries/base/include/ieee-flpt.h14
32 files changed, 152 insertions, 152 deletions
diff --git a/libraries/base/Control/Concurrent.hs b/libraries/base/Control/Concurrent.hs
index ada825d0f0..cc39ddeccf 100644
--- a/libraries/base/Control/Concurrent.hs
+++ b/libraries/base/Control/Concurrent.hs
@@ -117,7 +117,7 @@ import System.Posix.Types ( Fd )
import Foreign.StablePtr
import Foreign.C.Types
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
import Foreign.C
import System.IO
import Data.Functor ( void )
@@ -401,7 +401,7 @@ unsafeResult = either Exception.throwIO return
-- 'GHC.Conc.closeFdWith'.
threadWaitRead :: Fd -> IO ()
threadWaitRead fd
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
-- we have no IO manager implementing threadWaitRead on Windows.
-- fdReady does the right thing, but we have to call it in a
-- separate thread, otherwise threadWaitRead won't be interruptible,
@@ -426,7 +426,7 @@ threadWaitRead fd
-- 'GHC.Conc.closeFdWith'.
threadWaitWrite :: Fd -> IO ()
threadWaitWrite fd
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
| threaded = withThread (waitFd fd 1)
| otherwise = errorWithoutStackTrace "threadWaitWrite requires -threaded on Windows"
#else
@@ -441,7 +441,7 @@ threadWaitWrite fd
-- @since 4.7.0.0
threadWaitReadSTM :: Fd -> IO (STM (), IO ())
threadWaitReadSTM fd
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
| threaded = do v <- newTVarIO Nothing
mask_ $ void $ forkIO $ do result <- try (waitFd fd 0)
atomically (writeTVar v $ Just result)
@@ -465,7 +465,7 @@ threadWaitReadSTM fd
-- @since 4.7.0.0
threadWaitWriteSTM :: Fd -> IO (STM (), IO ())
threadWaitWriteSTM fd
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
| threaded = do v <- newTVarIO Nothing
mask_ $ void $ forkIO $ do result <- try (waitFd fd 1)
atomically (writeTVar v $ Just result)
@@ -481,7 +481,7 @@ threadWaitWriteSTM fd
= GHC.Conc.threadWaitWriteSTM fd
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool
withThread :: IO a -> IO a
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs
index 525f098524..d12d6dc4bd 100644
--- a/libraries/base/Data/Bits.hs
+++ b/libraries/base/Data/Bits.hs
@@ -57,7 +57,7 @@ module Data.Bits (
#include "MachDeps.h"
-#ifdef MIN_VERSION_integer_gmp
+#if defined(MIN_VERSION_integer_gmp)
# define HAVE_INTEGER_GMP1 MIN_VERSION_integer_gmp(1,0,0)
#endif
diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs
index ec937e729b..bee1b6f98a 100644
--- a/libraries/base/Data/OldList.hs
+++ b/libraries/base/Data/OldList.hs
@@ -276,7 +276,7 @@ findIndex p = listToMaybe . findIndices p
-- | The 'findIndices' function extends 'findIndex', by returning the
-- indices of all elements satisfying the predicate, in ascending order.
findIndices :: (a -> Bool) -> [a] -> [Int]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
findIndices p xs = [ i | (x,i) <- zip xs [0..], p x]
#else
-- Efficient definition, adapted from Data.Sequence
@@ -346,7 +346,7 @@ nub = nubBy (==)
-- user-supplied equality predicate instead of the overloaded '=='
-- function.
nubBy :: (a -> a -> Bool) -> [a] -> [a]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
nubBy eq [] = []
nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs)
#else
@@ -824,7 +824,7 @@ sort :: (Ord a) => [a] -> [a]
-- | The 'sortBy' function is the non-overloaded version of 'sort'.
sortBy :: (a -> a -> Ordering) -> [a] -> [a]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
sort = sortBy compare
sortBy cmp = foldr (insertBy cmp) []
#else
@@ -1083,7 +1083,7 @@ lines s = cons (case break (== '\n') s of
-- | 'unlines' is an inverse operation to 'lines'.
-- It joins lines, after appending a terminating newline to each.
unlines :: [String] -> String
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
unlines = concatMap (++ "\n")
#else
-- HBC version (stolen)
@@ -1118,7 +1118,7 @@ wordsFB c n = go
-- | 'unwords' is an inverse operation to 'words'.
-- It joins words with separating spaces.
unwords :: [String] -> String
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
unwords [] = ""
unwords ws = foldr1 (\w s -> w ++ ' ':s) ws
#else
diff --git a/libraries/base/Data/Semigroup.hs b/libraries/base/Data/Semigroup.hs
index ec68683799..fae207ef97 100644
--- a/libraries/base/Data/Semigroup.hs
+++ b/libraries/base/Data/Semigroup.hs
@@ -85,7 +85,7 @@ import Data.Monoid (Alt (..))
import qualified Data.Monoid as Monoid
import Data.Ord (Down(..))
import Data.Void
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import GHC.Event (Event, Lifetime)
#endif
import GHC.Generics
@@ -725,7 +725,7 @@ instance Semigroup (Proxy s) where
instance Semigroup a => Semigroup (IO a) where
(<>) = liftA2 (<>)
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
-- | @since 4.10.0.0
instance Semigroup Event where
(<>) = mappend
diff --git a/libraries/base/Foreign/C/String.hs b/libraries/base/Foreign/C/String.hs
index a162460b25..a8eb60c5a3 100644
--- a/libraries/base/Foreign/C/String.hs
+++ b/libraries/base/Foreign/C/String.hs
@@ -420,7 +420,7 @@ wNUL = 0
cWcharsToChars :: [CWchar] -> [Char]
charsToCWchars :: [Char] -> [CWchar]
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
-- On Windows, wchar_t is 16 bits wide and CWString uses the UTF-16 encoding.
diff --git a/libraries/base/GHC/Conc.hs b/libraries/base/GHC/Conc.hs
index 74d14badf6..8c5c1536d9 100644
--- a/libraries/base/GHC/Conc.hs
+++ b/libraries/base/GHC/Conc.hs
@@ -86,7 +86,7 @@ module GHC.Conc
-- * Miscellaneous
, withMVar
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
, asyncRead
, asyncWrite
, asyncDoProc
@@ -95,14 +95,14 @@ module GHC.Conc
, asyncWriteBA
#endif
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
, Signal, HandlerFun, setHandler, runHandlers
#endif
, ensureIOManagerIsRunning
, ioManagerCapabilitiesChanged
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
, ConsoleEvent(..)
, win32ConsoleHandler
, toWin32ConsoleEvent
@@ -116,6 +116,6 @@ module GHC.Conc
import GHC.Conc.IO
import GHC.Conc.Sync
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import GHC.Conc.Signal
#endif
diff --git a/libraries/base/GHC/Conc/IO.hs b/libraries/base/GHC/Conc/IO.hs
index be773132ee..eb0bffe8b4 100644
--- a/libraries/base/GHC/Conc/IO.hs
+++ b/libraries/base/GHC/Conc/IO.hs
@@ -39,7 +39,7 @@ module GHC.Conc.IO
, threadWaitWriteSTM
, closeFdWith
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
, asyncRead
, asyncWrite
, asyncDoProc
@@ -59,7 +59,7 @@ import GHC.Conc.Sync as Sync
import GHC.Real ( fromIntegral )
import System.Posix.Types
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
import qualified GHC.Conc.Windows as Windows
import GHC.Conc.Windows (asyncRead, asyncWrite, asyncDoProc, asyncReadBA,
asyncWriteBA, ConsoleEvent(..), win32ConsoleHandler,
@@ -69,14 +69,14 @@ import qualified GHC.Event.Thread as Event
#endif
ensureIOManagerIsRunning :: IO ()
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
ensureIOManagerIsRunning = Event.ensureIOManagerIsRunning
#else
ensureIOManagerIsRunning = Windows.ensureIOManagerIsRunning
#endif
ioManagerCapabilitiesChanged :: IO ()
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
ioManagerCapabilitiesChanged = Event.ioManagerCapabilitiesChanged
#else
ioManagerCapabilitiesChanged = return ()
@@ -90,7 +90,7 @@ ioManagerCapabilitiesChanged = return ()
-- that has been used with 'threadWaitRead', use 'closeFdWith'.
threadWaitRead :: Fd -> IO ()
threadWaitRead fd
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
| threaded = Event.threadWaitRead fd
#endif
| otherwise = IO $ \s ->
@@ -106,7 +106,7 @@ threadWaitRead fd
-- that has been used with 'threadWaitWrite', use 'closeFdWith'.
threadWaitWrite :: Fd -> IO ()
threadWaitWrite fd
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
| threaded = Event.threadWaitWrite fd
#endif
| otherwise = IO $ \s ->
@@ -120,7 +120,7 @@ threadWaitWrite fd
-- in the file descriptor.
threadWaitReadSTM :: Fd -> IO (Sync.STM (), IO ())
threadWaitReadSTM fd
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
| threaded = Event.threadWaitReadSTM fd
#endif
| otherwise = do
@@ -139,7 +139,7 @@ threadWaitReadSTM fd
-- in the file descriptor.
threadWaitWriteSTM :: Fd -> IO (Sync.STM (), IO ())
threadWaitWriteSTM fd
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
| threaded = Event.threadWaitWriteSTM fd
#endif
| otherwise = do
@@ -164,7 +164,7 @@ closeFdWith :: (Fd -> IO ()) -- ^ Low-level action that performs the real close.
-> Fd -- ^ File descriptor to close.
-> IO ()
closeFdWith close fd
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
| threaded = Event.closeFdWith close fd
#endif
| otherwise = close fd
@@ -178,7 +178,7 @@ closeFdWith close fd
--
threadDelay :: Int -> IO ()
threadDelay time
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
| threaded = Windows.threadDelay time
#else
| threaded = Event.threadDelay time
@@ -193,7 +193,7 @@ threadDelay time
--
registerDelay :: Int -> IO (TVar Bool)
registerDelay usecs
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
| threaded = Windows.registerDelay usecs
#else
| threaded = Event.registerDelay usecs
diff --git a/libraries/base/GHC/Conc/Windows.hs b/libraries/base/GHC/Conc/Windows.hs
index 4cbb8cadc2..6b87b06fe7 100644
--- a/libraries/base/GHC/Conc/Windows.hs
+++ b/libraries/base/GHC/Conc/Windows.hs
@@ -53,7 +53,7 @@ import GHC.Show (Show)
import GHC.Word (Word32, Word64)
import GHC.Windows
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
# if defined(i386_HOST_ARCH)
# define WINDOWS_CCONV stdcall
# elif defined(x86_64_HOST_ARCH)
diff --git a/libraries/base/GHC/Environment.hs b/libraries/base/GHC/Environment.hs
index 97005eb770..a077f6f8c4 100644
--- a/libraries/base/GHC/Environment.hs
+++ b/libraries/base/GHC/Environment.hs
@@ -9,7 +9,7 @@ import Foreign.C
import GHC.Base
import GHC.Real ( fromIntegral )
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
import GHC.IO (finally)
import GHC.Windows
@@ -30,7 +30,7 @@ import qualified GHC.Foreign as GHC
-- command line arguments, starting with the program name, and
-- including those normally eaten by the RTS (+RTS ... -RTS).
getFullArgs :: IO [String]
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
-- Ignore the arguments to hs_init on Windows for the sake of Unicode compat
getFullArgs = do
p_arg_string <- c_GetCommandLine
diff --git a/libraries/base/GHC/Event/KQueue.hsc b/libraries/base/GHC/Event/KQueue.hsc
index a76cc51b52..e9c8419ea7 100644
--- a/libraries/base/GHC/Event/KQueue.hsc
+++ b/libraries/base/GHC/Event/KQueue.hsc
@@ -56,7 +56,7 @@ import Data.Int (Int64)
-- Handle brokenness on some BSD variants, notably OS X up to at least
-- 10.6. If NOTE_EOF isn't available, we have no way to receive a
-- notification from the kernel when we reach EOF on a plain file.
-#ifndef NOTE_EOF
+#if !defined(NOTE_EOF)
# define NOTE_EOF 0
#endif
@@ -132,7 +132,7 @@ data Event = KEvent {
, filter :: {-# UNPACK #-} !Filter
, flags :: {-# UNPACK #-} !Flag
, fflags :: {-# UNPACK #-} !FFlag
-#ifdef netbsd_HOST_OS
+#if defined(netbsd_HOST_OS)
, data_ :: {-# UNPACK #-} !Int64
#else
, data_ :: {-# UNPACK #-} !CIntPtr
diff --git a/libraries/base/GHC/Event/Poll.hsc b/libraries/base/GHC/Event/Poll.hsc
index 5c5ad494ca..74525c6b40 100644
--- a/libraries/base/GHC/Event/Poll.hsc
+++ b/libraries/base/GHC/Event/Poll.hsc
@@ -158,7 +158,7 @@ newtype Event = Event CShort
-- We have to duplicate the whole enum like this in order for the
-- hsc2hs cross-compilation mode to work
-#ifdef POLLRDHUP
+#if defined(POLLRDHUP)
#{enum Event, Event
, pollIn = POLLIN
, pollOut = POLLOUT
diff --git a/libraries/base/GHC/IO/Buffer.hs b/libraries/base/GHC/IO/Buffer.hs
index 50de06e97e..33eee6363d 100644
--- a/libraries/base/GHC/IO/Buffer.hs
+++ b/libraries/base/GHC/IO/Buffer.hs
@@ -101,7 +101,7 @@ readWord8Buf arr ix = withForeignPtr arr $ \p -> peekByteOff p ix
writeWord8Buf :: RawBuffer Word8 -> Int -> Word8 -> IO ()
writeWord8Buf arr ix w = withForeignPtr arr $ \p -> pokeByteOff p ix w
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
type CharBufElem = Word16
#else
type CharBufElem = Char
@@ -124,7 +124,7 @@ writeCharBuf arr ix c = withForeignPtr arr $ \p -> writeCharBufPtr p ix c
{-# INLINE readCharBufPtr #-}
readCharBufPtr :: Ptr CharBufElem -> Int -> IO (Char, Int)
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
readCharBufPtr p ix = do
c1 <- peekElemOff p ix
if (c1 < 0xd800 || c1 > 0xdbff)
@@ -138,7 +138,7 @@ readCharBufPtr p ix = do c <- peekElemOff (castPtr p) ix; return (c, ix+1)
{-# INLINE writeCharBufPtr #-}
writeCharBufPtr :: Ptr CharBufElem -> Int -> Char -> IO Int
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
writeCharBufPtr p ix ch
| c < 0x10000 = do pokeElemOff p ix (fromIntegral c)
return (ix+1)
@@ -153,7 +153,7 @@ writeCharBufPtr p ix ch = do pokeElemOff (castPtr p) ix ch; return (ix+1)
#endif
charSize :: Int
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
charSize = 2
#else
charSize = 4
@@ -186,7 +186,7 @@ data Buffer e
bufR :: !Int -- offset of last item + 1
}
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
type CharBuffer = Buffer Word16
#else
type CharBuffer = Buffer Char
@@ -208,7 +208,7 @@ isFullBuffer Buffer{ bufR=w, bufSize=s } = s == w
-- if a Char buffer does not have room for a surrogate pair, it is "full"
isFullCharBuffer :: Buffer e -> Bool
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
isFullCharBuffer buf = bufferAvailable buf < 2
#else
isFullCharBuffer = isFullBuffer
diff --git a/libraries/base/GHC/IO/Encoding/CodePage.hs b/libraries/base/GHC/IO/Encoding/CodePage.hs
index aea4314742..42980b59bc 100644
--- a/libraries/base/GHC/IO/Encoding/CodePage.hs
+++ b/libraries/base/GHC/IO/Encoding/CodePage.hs
@@ -32,7 +32,7 @@ import GHC.IO.Encoding.UTF8 (mkUTF8)
import GHC.IO.Encoding.UTF16 (mkUTF16le, mkUTF16be)
import GHC.IO.Encoding.UTF32 (mkUTF32le, mkUTF32be)
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
# if defined(i386_HOST_ARCH)
# define WINDOWS_CCONV stdcall
# elif defined(x86_64_HOST_ARCH)
diff --git a/libraries/base/GHC/IO/Encoding/CodePage/API.hs b/libraries/base/GHC/IO/Encoding/CodePage/API.hs
index 8cf77b0a96..f1d9d93e8f 100644
--- a/libraries/base/GHC/IO/Encoding/CodePage/API.hs
+++ b/libraries/base/GHC/IO/Encoding/CodePage/API.hs
@@ -157,7 +157,7 @@ newCP rec fn cp = do
utf16_native_encode' :: EncodeBuffer
utf16_native_decode' :: DecodeBuffer
-#ifdef WORDS_BIGENDIAN
+#if defined(WORDS_BIGENDIAN)
utf16_native_encode' = utf16be_encode
utf16_native_decode' = utf16be_decode
#else
@@ -204,7 +204,7 @@ utf16_native_decode ibuf obuf = do
cpDecode :: Word32 -> Int -> DecodeBuffer
cpDecode cp max_char_size = \ibuf obuf -> do
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
let mbuf = obuf
#else
-- FIXME: share the buffer between runs, even if the buffer is not the perfect size
@@ -215,7 +215,7 @@ cpDecode cp max_char_size = \ibuf obuf -> do
debugIO $ "cpDecode " ++ summaryBuffer ibuf ++ " " ++ summaryBuffer mbuf
(why1, ibuf', mbuf') <- cpRecode try' is_valid_prefix max_char_size 1 0 1 ibuf mbuf
debugIO $ "cpRecode (cpDecode) = " ++ show why1 ++ " " ++ summaryBuffer ibuf' ++ " " ++ summaryBuffer mbuf'
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
return (why1, ibuf', mbuf')
#else
-- Convert as much UTF-16 as possible to UTF-32. Note that it's impossible for this to fail
@@ -265,7 +265,7 @@ cpDecode cp max_char_size = \ibuf obuf -> do
cpEncode :: Word32 -> Int -> EncodeBuffer
cpEncode cp _max_char_size = \ibuf obuf -> do
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
let mbuf' = ibuf
#else
-- FIXME: share the buffer between runs, even though that means we can't size the buffer as we want.
@@ -281,7 +281,7 @@ cpEncode cp _max_char_size = \ibuf obuf -> do
debugIO $ "\ncpEncode " ++ summaryBuffer mbuf' ++ " " ++ summaryBuffer obuf
(why2, target_utf16_count, mbuf', obuf) <- saner (cpRecode try' is_valid_prefix 2 1 1 0) (mbuf' { bufState = ReadBuffer }) obuf
debugIO $ "cpRecode (cpEncode) = " ++ show why2 ++ " " ++ summaryBuffer mbuf' ++ " " ++ summaryBuffer obuf
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
return (why2, mbuf', obuf)
#else
case why2 of
diff --git a/libraries/base/GHC/IO/Encoding/Iconv.hs b/libraries/base/GHC/IO/Encoding/Iconv.hs
index 061bd60c20..16354364b4 100644
--- a/libraries/base/GHC/IO/Encoding/Iconv.hs
+++ b/libraries/base/GHC/IO/Encoding/Iconv.hs
@@ -85,7 +85,7 @@ foreign import ccall unsafe "localeEncoding"
c_localeEncoding :: IO CString
haskellChar :: String
-#ifdef WORDS_BIGENDIAN
+#if defined(WORDS_BIGENDIAN)
haskellChar | charSize == 2 = "UTF-16BE"
| otherwise = "UTF-32BE"
#else
diff --git a/libraries/base/GHC/IO/FD.hs b/libraries/base/GHC/IO/FD.hs
index c4e4d46c53..8eafe08fdc 100644
--- a/libraries/base/GHC/IO/FD.hs
+++ b/libraries/base/GHC/IO/FD.hs
@@ -43,7 +43,7 @@ import qualified GHC.IO.Device
import GHC.IO.Device (SeekMode(..), IODeviceType(..))
import GHC.Conc.IO
import GHC.IO.Exception
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
import GHC.Windows
#endif
@@ -53,7 +53,7 @@ import qualified System.Posix.Internals
import System.Posix.Internals hiding (FD, setEcho, getEcho)
import System.Posix.Types
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
# if defined(i386_HOST_ARCH)
# define WINDOWS_CCONV stdcall
# elif defined(x86_64_HOST_ARCH)
@@ -71,7 +71,7 @@ c_DEBUG_DUMP = False
data FD = FD {
fdFD :: {-# UNPACK #-} !CInt,
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
-- On Windows, a socket file descriptor needs to be read and written
-- using different functions (send/recv).
fdIsSocket_ :: {-# UNPACK #-} !Int
@@ -83,7 +83,7 @@ data FD = FD {
#endif
}
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
fdIsSocket :: FD -> Bool
fdIsSocket fd = fdIsSocket_ fd /= 0
#endif
@@ -167,7 +167,7 @@ openFile filepath iomode non_blocking =
ReadWriteMode -> rw_flags
AppendMode -> append_flags
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
binary_flags = o_BINARY
#else
binary_flags = 0
@@ -259,12 +259,12 @@ mkFD fd iomode mb_stat is_socket is_nonblock = do
_other_type -> return ()
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
when (not is_socket) $ setmode fd True >> return ()
#endif
return (FD{ fdFD = fd,
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
fdIsNonBlocking = fromEnum is_nonblock
#else
fdIsSocket_ = fromEnum is_socket
@@ -273,7 +273,7 @@ mkFD fd iomode mb_stat is_socket is_nonblock = do
fd_type)
getUniqueFileInfo :: CInt -> CDev -> CIno -> IO (Word64, Word64)
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
getUniqueFileInfo _ dev ino = return (fromIntegral dev, fromIntegral ino)
#else
getUniqueFileInfo fd _ _ = do
@@ -283,7 +283,7 @@ getUniqueFileInfo fd _ _ = do
liftM2 (,) (peek devptr) (peek inoptr)
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import ccall unsafe "__hscore_setmode"
setmode :: CInt -> Bool -> IO CInt
#endif
@@ -293,7 +293,7 @@ foreign import ccall unsafe "__hscore_setmode"
stdFD :: CInt -> FD
stdFD fd = FD { fdFD = fd,
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
fdIsSocket_ = 0
#else
fdIsNonBlocking = 0
@@ -315,7 +315,7 @@ close :: FD -> IO ()
close fd =
do let closer realFd =
throwErrnoIfMinus1Retry_ "GHC.IO.FD.close" $
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
if fdIsSocket fd then
c_closesocket (fromIntegral realFd)
else
@@ -333,7 +333,7 @@ release :: FD -> IO ()
release fd = do _ <- unlockFile (fdFD fd)
return ()
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import WINDOWS_CCONV unsafe "HsBase.h closesocket"
c_closesocket :: CInt -> IO CInt
#endif
@@ -465,7 +465,7 @@ fdWriteNonBlocking fd ptr bytes = do
-- Low level routines for reading/writing to (raw)buffers:
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
{-
NOTE [nonblock]:
@@ -647,7 +647,7 @@ foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool
-- -----------------------------------------------------------------------------
-- utils
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
throwErrnoIfMinus1RetryOnBlock :: String -> IO CSsize -> IO CSsize -> IO CSsize
throwErrnoIfMinus1RetryOnBlock loc f on_block =
do
@@ -672,7 +672,7 @@ foreign import ccall unsafe "lockFile"
foreign import ccall unsafe "unlockFile"
unlockFile :: CInt -> IO CInt
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import ccall unsafe "get_unique_file_info"
c_getUniqueFileInfo :: CInt -> Ptr Word64 -> Ptr Word64 -> IO ()
#endif
diff --git a/libraries/base/GHC/IO/Handle.hs b/libraries/base/GHC/IO/Handle.hs
index 256f802c3d..648523a11f 100644
--- a/libraries/base/GHC/IO/Handle.hs
+++ b/libraries/base/GHC/IO/Handle.hs
@@ -232,7 +232,7 @@ hSetBuffering handle mode =
is_tty <- IODevice.isTerminal haDevice
when (is_tty && isReadableHandleType haType) $
case mode of
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
-- 'raw' mode under win32 is a bit too specialised (and troublesome
-- for most common uses), so simply disable its use here.
NoBuffering -> IODevice.setRaw haDevice True
diff --git a/libraries/base/GHC/IO/Handle/FD.hs b/libraries/base/GHC/IO/Handle/FD.hs
index e988b25c9f..786fccc4f1 100644
--- a/libraries/base/GHC/IO/Handle/FD.hs
+++ b/libraries/base/GHC/IO/Handle/FD.hs
@@ -91,14 +91,14 @@ stdHandleFinalizer fp m = do
-- We have to put the FDs into binary mode on Windows to avoid the newline
-- translation that the CRT IO library does.
setBinaryMode :: FD.FD -> IO ()
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
setBinaryMode fd = do _ <- setmode (FD.fdFD fd) True
return ()
#else
setBinaryMode _ = return ()
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import ccall unsafe "__hscore_setmode"
setmode :: CInt -> Bool -> IO CInt
#endif
@@ -202,7 +202,7 @@ mkHandleFromFD
mkHandleFromFD fd0 fd_type filepath iomode set_non_blocking mb_codec
= do
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
-- turn on non-blocking mode
fd <- if set_non_blocking
then FD.setNonBlockingMode fd0 True
diff --git a/libraries/base/GHC/IO/Handle/Text.hs b/libraries/base/GHC/IO/Handle/Text.hs
index 8d927384c8..57b9534976 100644
--- a/libraries/base/GHC/IO/Handle/Text.hs
+++ b/libraries/base/GHC/IO/Handle/Text.hs
@@ -271,7 +271,7 @@ unpack !buf !r !w acc0
-- Here, we are rather careful to only put an *evaluated* character
-- in the output string. Due to pointer tagging, this allows the consumer
-- to avoid ping-ponging between the actual consumer code and the thunk code
-#ifdef CHARBUF_UTF16
+#if defined(CHARBUF_UTF16)
-- reverse-order decoding of UTF-16
c2 <- peekElemOff pbuf i
if (c2 < 0xdc00 || c2 > 0xdffff)
diff --git a/libraries/base/GHC/IO/Handle/Types.hs b/libraries/base/GHC/IO/Handle/Types.hs
index 8f739810c4..c58a9fb1b0 100644
--- a/libraries/base/GHC/IO/Handle/Types.hs
+++ b/libraries/base/GHC/IO/Handle/Types.hs
@@ -46,7 +46,7 @@ import GHC.Read
import GHC.Word
import GHC.IO.Device
import Data.Typeable
-#ifdef DEBUG
+#if defined(DEBUG)
import Control.Monad
#endif
@@ -179,7 +179,7 @@ isReadWriteHandleType _ = False
-- * In a wriite Handle, the Char buffer is always empty (we encode when writing)
--
checkHandleInvariants :: Handle__ -> IO ()
-#ifdef DEBUG
+#if defined(DEBUG)
checkHandleInvariants h_ = do
bbuf <- readIORef (haByteBuffer h_)
checkBuffer bbuf
@@ -367,7 +367,7 @@ data NewlineMode
-- | The native newline representation for the current platform: 'LF'
-- on Unix systems, 'CRLF' on Windows.
nativeNewline :: Newline
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
nativeNewline = CRLF
#else
nativeNewline = LF
diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs
index 018c0a78d8..70bfbe4de0 100644
--- a/libraries/base/GHC/List.hs
+++ b/libraries/base/GHC/List.hs
@@ -79,7 +79,7 @@ tail [] = errorEmptyList "tail"
-- | Extract the last element of a list, which must be finite and non-empty.
last :: [a] -> a
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
last [x] = x
last (_:xs) = last xs
last [] = errorEmptyList "last"
@@ -98,7 +98,7 @@ lastError = errorEmptyList "last"
-- | Return all the elements of a list except the last one.
-- The list must be non-empty.
init :: [a] -> [a]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
init [x] = []
init (x:xs) = x : init xs
init [] = errorEmptyList "init"
@@ -550,7 +550,7 @@ dropWhile p xs@(x:xs')
-- It is an instance of the more general 'Data.List.genericTake',
-- in which @n@ may be of any integral type.
take :: Int -> [a] -> [a]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
take n _ | n <= 0 = []
take _ [] = []
take n (x:xs) = x : take (n-1) xs
@@ -617,7 +617,7 @@ takeFB c n x xs
-- It is an instance of the more general 'Data.List.genericDrop',
-- in which @n@ may be of any integral type.
drop :: Int -> [a] -> [a]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
drop n xs | n <= 0 = xs
drop _ [] = []
drop n (_:xs) = drop (n-1) xs
@@ -652,7 +652,7 @@ drop n ls
-- in which @n@ may be of any integral type.
splitAt :: Int -> [a] -> ([a],[a])
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
splitAt n xs = (take n xs, drop n xs)
#else
splitAt n ls
@@ -694,7 +694,7 @@ span p xs@(x:xs')
-- 'break' @p@ is equivalent to @'span' ('not' . p)@.
break :: (a -> Bool) -> [a] -> ([a],[a])
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
break p = span (not . p)
#else
-- HBC version (stolen)
@@ -707,7 +707,7 @@ break p xs@(x:xs')
-- | 'reverse' @xs@ returns the elements of @xs@ in reverse order.
-- @xs@ must be finite.
reverse :: [a] -> [a]
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
reverse = foldl (flip (:)) []
#else
reverse l = rev l []
@@ -720,7 +720,7 @@ reverse l = rev l []
-- 'True', the list must be finite; 'False', however, results from a 'False'
-- value at a finite index of a finite or infinite list.
and :: [Bool] -> Bool
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
and = foldr (&&) True
#else
and [] = True
@@ -737,7 +737,7 @@ and (x:xs) = x && and xs
-- 'False', the list must be finite; 'True', however, results from a 'True'
-- value at a finite index of a finite or infinite list.
or :: [Bool] -> Bool
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
or = foldr (||) False
#else
or [] = False
@@ -756,7 +756,7 @@ or (x:xs) = x || or xs
-- value for the predicate applied to an element at a finite index of a finite or infinite list.
any :: (a -> Bool) -> [a] -> Bool
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
any p = or . map p
#else
any _ [] = False
@@ -775,7 +775,7 @@ any p (x:xs) = p x || any p xs
-- 'True', the list must be finite; 'False', however, results from a 'False'
-- value for the predicate applied to an element at a finite index of a finite or infinite list.
all :: (a -> Bool) -> [a] -> Bool
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
all p = and . map p
#else
all _ [] = True
@@ -794,7 +794,7 @@ all p (x:xs) = p x && all p xs
-- 'False', the list must be finite; 'True', however, results from an element
-- equal to @x@ found at a finite index of a finite or infinite list.
elem :: (Eq a) => a -> [a] -> Bool
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
elem x = any (== x)
#else
elem _ [] = False
@@ -808,7 +808,7 @@ elem x (y:ys) = x==y || elem x ys
-- | 'notElem' is the negation of 'elem'.
notElem :: (Eq a) => a -> [a] -> Bool
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
notElem x = all (/= x)
#else
notElem _ [] = True
@@ -855,7 +855,7 @@ concat = foldr (++) []
-- It is an instance of the more general 'Data.List.genericIndex',
-- which takes an index of any integral type.
(!!) :: [a] -> Int -> a
-#ifdef USE_REPORT_PRELUDE
+#if defined(USE_REPORT_PRELUDE)
xs !! n | n < 0 = errorWithoutStackTrace "Prelude.!!: negative index"
[] !! _ = errorWithoutStackTrace "Prelude.!!: index too large"
(x:_) !! 0 = x
diff --git a/libraries/base/GHC/Real.hs b/libraries/base/GHC/Real.hs
index 17d56c6d8a..1154091dd5 100644
--- a/libraries/base/GHC/Real.hs
+++ b/libraries/base/GHC/Real.hs
@@ -27,7 +27,7 @@ import GHC.Enum
import GHC.Show
import {-# SOURCE #-} GHC.Exception( divZeroException, overflowException, ratioZeroDenomException )
-#ifdef OPTIMISE_INTEGER_GCD_LCM
+#if defined(OPTIMISE_INTEGER_GCD_LCM)
# if defined(MIN_VERSION_integer_gmp)
import GHC.Integer.GMP.Internals
# else
@@ -636,7 +636,7 @@ lcm _ 0 = 0
lcm 0 _ = 0
lcm x y = abs ((x `quot` (gcd x y)) * y)
-#ifdef OPTIMISE_INTEGER_GCD_LCM
+#if defined(OPTIMISE_INTEGER_GCD_LCM)
{-# RULES
"gcd/Int->Int->Int" gcd = gcdInt'
"gcd/Integer->Integer->Integer" gcd = gcdInteger
diff --git a/libraries/base/GHC/TopHandler.hs b/libraries/base/GHC/TopHandler.hs
index 58da871729..1b1e065831 100644
--- a/libraries/base/GHC/TopHandler.hs
+++ b/libraries/base/GHC/TopHandler.hs
@@ -94,7 +94,7 @@ runMainIO main =
topHandler
install_interrupt_handler :: IO () -> IO ()
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
install_interrupt_handler handler = do
_ <- GHC.ConsoleHandler.installHandler $
Catch $ \event ->
@@ -244,7 +244,7 @@ unreachable :: IO a
unreachable = fail "If you can read this, shutdownHaskellAndExit did not exit."
exitHelper :: CInt -> Int -> IO a
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
exitHelper exitKind r =
shutdownHaskellAndExit (fromIntegral r) exitKind >> unreachable
#else
@@ -266,7 +266,7 @@ foreign import ccall "shutdownHaskellAndSignal"
exitInterrupted :: IO a
exitInterrupted =
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
safeExit 252
#else
-- we must exit via the default action for SIGINT, so that the
diff --git a/libraries/base/System/Environment.hs b/libraries/base/System/Environment.hs
index 61b728cb9c..56e6961f8a 100644
--- a/libraries/base/System/Environment.hs
+++ b/libraries/base/System/Environment.hs
@@ -33,7 +33,7 @@ import Foreign
import Foreign.C
import System.IO.Error (mkIOError)
import Control.Exception.Base (bracket_, throwIO)
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
import Control.Exception.Base (bracket)
#endif
-- import GHC.IO
@@ -41,7 +41,7 @@ import GHC.IO.Exception
import GHC.IO.Encoding (getFileSystemEncoding)
import qualified GHC.Foreign as GHC
import Control.Monad
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
import GHC.Environment
import GHC.Windows
#else
@@ -50,7 +50,7 @@ import System.Posix.Internals (withFilePath)
import System.Environment.ExecutablePath
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
# if defined(i386_HOST_ARCH)
# define WINDOWS_CCONV stdcall
# elif defined(x86_64_HOST_ARCH)
@@ -65,7 +65,7 @@ import System.Environment.ExecutablePath
-- ---------------------------------------------------------------------------
-- getArgs, getProgName, getEnv
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
{-
Note [Ignore hs_init argv]
@@ -133,7 +133,7 @@ dropRTSArgs (arg:rest) = arg : dropRTSArgs rest
-- line arguments (not including the program name).
getArgs :: IO [String]
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
getArgs = fmap tail getWin32ProgArgv_certainly
#else
getArgs =
@@ -160,7 +160,7 @@ between platforms: on Windows, for example, a program invoked as foo
is probably really @FOO.EXE@, and that is what 'getProgName' will return.
-}
getProgName :: IO String
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
-- Ignore the arguments to hs_init on Windows for the sake of Unicode compat
getProgName = fmap (basename . head) getWin32ProgArgv_certainly
#else
@@ -188,7 +188,7 @@ basename f = go f f
isPathSeparator :: Char -> Bool
isPathSeparator '/' = True
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
isPathSeparator '\\' = True
#endif
isPathSeparator _ = False
@@ -206,7 +206,7 @@ basename f = go f f
getEnv :: String -> IO String
getEnv name = lookupEnv name >>= maybe handleError return
where
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
handleError = do
err <- c_GetLastError
if err == eRROR_ENVVAR_NOT_FOUND
@@ -230,7 +230,7 @@ foreign import WINDOWS_CCONV unsafe "windows.h GetLastError"
--
-- @since 4.6.0.0
lookupEnv :: String -> IO (Maybe String)
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
lookupEnv name = withCWString name $ \s -> try_size s 256
where
try_size s size = allocaArray (fromIntegral size) $ \p_value -> do
@@ -295,7 +295,7 @@ setEnv key_ value_
value = takeWhile (/= '\NUL') value_
setEnv_ :: String -> String -> IO ()
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
setEnv_ key value = withCWString key $ \k -> withCWString value $ \v -> do
success <- c_SetEnvironmentVariable k v
unless success (throwGetLastError "setEnv")
@@ -329,7 +329,7 @@ foreign import ccall unsafe "putenv" c_putenv :: CString -> IO CInt
--
-- @since 4.7.0.0
unsetEnv :: String -> IO ()
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
unsetEnv key = withCWString key $ \k -> do
success <- c_SetEnvironmentVariable k nullPtr
unless success $ do
@@ -340,7 +340,7 @@ unsetEnv key = withCWString key $ \k -> do
throwGetLastError "unsetEnv"
#else
-#ifdef HAVE_UNSETENV
+#if defined(HAVE_UNSETENV)
unsetEnv key = withFilePath key (throwErrnoIf_ (/= 0) "unsetEnv" . c_unsetenv)
foreign import ccall unsafe "__hsbase_unsetenv" c_unsetenv :: CString -> IO CInt
#else
@@ -372,7 +372,7 @@ withProgName nm act = do
withArgv :: [String] -> IO a -> IO a
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
-- We have to reflect the updated arguments in the RTS-side variables as
-- well, because the RTS still consults them for error messages and the like.
-- If we don't do this then ghc-e005 fails.
@@ -406,7 +406,7 @@ foreign import ccall unsafe "setProgArgv"
-- the @key@ is the whole entry and the @value@ is the empty string.
getEnvironment :: IO [(String, String)]
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
getEnvironment = bracket c_GetEnvironmentStrings c_FreeEnvironmentStrings $ \pBlock ->
if pBlock == nullPtr then return []
else go pBlock
diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs
index 1796200bc4..735d41ba45 100644
--- a/libraries/base/System/IO.hs
+++ b/libraries/base/System/IO.hs
@@ -224,7 +224,7 @@ import Control.Exception.Base
import Data.Bits
import Data.Maybe
import Foreign.C.Error
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
import Foreign.C.String
#endif
import Foreign.C.Types
@@ -546,7 +546,7 @@ openNewFile filepath binary mode = do
errno <- getErrno
case errno of
_ | errno == eEXIST -> return FileExists
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
-- If c_open throws EACCES on windows, it could mean that filepath is a
-- directory. In this case, we want to return FileExists so that the
-- enclosing openTempFile can try again instead of failing outright.
@@ -565,13 +565,13 @@ openNewFile filepath binary mode = do
_ -> return (OpenNewError errno)
else return (NewFileCreated fd)
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import ccall "file_exists" c_fileExists :: CString -> IO Bool
#endif
-- XXX Should use filepath library
pathSeparator :: Char
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
pathSeparator = '\\'
#else
pathSeparator = '/'
diff --git a/libraries/base/System/Posix/Internals.hs b/libraries/base/System/Posix/Internals.hs
index 7bb26fa395..93ad4e8137 100644
--- a/libraries/base/System/Posix/Internals.hs
+++ b/libraries/base/System/Posix/Internals.hs
@@ -43,7 +43,7 @@ import GHC.IO
import GHC.IO.IOMode
import GHC.IO.Exception
import GHC.IO.Device
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import {-# SOURCE #-} GHC.IO.Encoding (getFileSystemEncoding)
import qualified GHC.Foreign as GHC
#endif
@@ -157,7 +157,7 @@ fdGetMode fd = do
return mode
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
withFilePath :: FilePath -> (CWString -> IO a) -> IO a
withFilePath = withCWString
@@ -545,7 +545,7 @@ s_isfifo cm = c_s_isfifo cm /= 0
foreign import ccall unsafe "HsBase.h __hscore_sizeof_stat" sizeof_stat :: Int
foreign import ccall unsafe "HsBase.h __hscore_st_mtime" st_mtime :: Ptr CStat -> IO CTime
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import ccall unsafe "HsBase.h __hscore_st_size" st_size :: Ptr CStat -> IO Int64
#else
foreign import ccall unsafe "HsBase.h __hscore_st_size" st_size :: Ptr CStat -> IO COff
diff --git a/libraries/base/System/Timeout.hs b/libraries/base/System/Timeout.hs
index d4ef0932b5..d34082e64f 100644
--- a/libraries/base/System/Timeout.hs
+++ b/libraries/base/System/Timeout.hs
@@ -18,7 +18,7 @@
module System.Timeout ( timeout ) where
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import Control.Monad
import GHC.Event (getSystemTimerManager,
registerTimeout, unregisterTimeout)
@@ -80,7 +80,7 @@ timeout :: Int -> IO a -> IO (Maybe a)
timeout n f
| n < 0 = fmap Just f
| n == 0 = return Nothing
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
| rtsSupportsBoundThreads = do
-- In the threaded RTS, we use the Timer Manager to delay the
-- (fairly expensive) 'forkIO' call until the timeout has expired.
diff --git a/libraries/base/cbits/SetEnv.c b/libraries/base/cbits/SetEnv.c
index 38f0ed52b8..7b6d2b584e 100644
--- a/libraries/base/cbits/SetEnv.c
+++ b/libraries/base/cbits/SetEnv.c
@@ -1,7 +1,7 @@
#include "HsBase.h"
-#ifdef HAVE_UNSETENV
+#if defined(HAVE_UNSETENV)
int __hsbase_unsetenv(const char *name) {
-#ifdef UNSETENV_RETURNS_VOID
+#if defined(UNSETENV_RETURNS_VOID)
unsetenv(name);
return 0;
#else
diff --git a/libraries/base/cbits/iconv.c b/libraries/base/cbits/iconv.c
index 2246ca67db..e1123a43a1 100644
--- a/libraries/base/cbits/iconv.c
+++ b/libraries/base/cbits/iconv.c
@@ -1,4 +1,4 @@
-#ifndef _WIN32
+#if !defined(_WIN32)
#include <stdlib.h>
#include <iconv.h>
diff --git a/libraries/base/cbits/primFloat.c b/libraries/base/cbits/primFloat.c
index 4bee4d0ded..f0746775d3 100644
--- a/libraries/base/cbits/primFloat.c
+++ b/libraries/base/cbits/primFloat.c
@@ -109,7 +109,7 @@ union stg_ieee754_dbl
*/
/* In case you don't support IEEE, you'll just get dummy defs.. */
-#ifdef IEEE_FLOATING_POINT
+#if defined(IEEE_FLOATING_POINT)
HsInt
isDoubleFinite(HsDouble d)
diff --git a/libraries/base/include/HsBase.h b/libraries/base/include/HsBase.h
index 8ee207431c..0fe5805a64 100644
--- a/libraries/base/include/HsBase.h
+++ b/libraries/base/include/HsBase.h
@@ -99,8 +99,8 @@
#elif HAVE_STDINT_H
# include <stdint.h>
#endif
-#ifdef HAVE_CLOCK_GETTIME
-# ifdef _POSIX_MONOTONIC_CLOCK
+#if defined(HAVE_CLOCK_GETTIME)
+# if defined(_POSIX_MONOTONIC_CLOCK)
# define CLOCK_ID CLOCK_MONOTONIC
# else
# define CLOCK_ID CLOCK_REALTIME
@@ -162,7 +162,7 @@ extern int fdReady(int fd, int write, int msecs, int isSock);
when compiling to native code.
-------------------------------------------------------------------------- */
-#ifndef INLINE
+#if !defined(INLINE)
# if defined(_MSC_VER)
# define INLINE extern __inline
# else
@@ -192,7 +192,7 @@ __hscore_o_binary(void)
INLINE int
__hscore_o_rdonly(void)
{
-#ifdef O_RDONLY
+#if defined(O_RDONLY)
return O_RDONLY;
#else
return 0;
@@ -202,7 +202,7 @@ __hscore_o_rdonly(void)
INLINE int
__hscore_o_wronly( void )
{
-#ifdef O_WRONLY
+#if defined(O_WRONLY)
return O_WRONLY;
#else
return 0;
@@ -212,7 +212,7 @@ __hscore_o_wronly( void )
INLINE int
__hscore_o_rdwr( void )
{
-#ifdef O_RDWR
+#if defined(O_RDWR)
return O_RDWR;
#else
return 0;
@@ -222,7 +222,7 @@ __hscore_o_rdwr( void )
INLINE int
__hscore_o_append( void )
{
-#ifdef O_APPEND
+#if defined(O_APPEND)
return O_APPEND;
#else
return 0;
@@ -232,7 +232,7 @@ __hscore_o_append( void )
INLINE int
__hscore_o_creat( void )
{
-#ifdef O_CREAT
+#if defined(O_CREAT)
return O_CREAT;
#else
return 0;
@@ -242,7 +242,7 @@ __hscore_o_creat( void )
INLINE int
__hscore_o_excl( void )
{
-#ifdef O_EXCL
+#if defined(O_EXCL)
return O_EXCL;
#else
return 0;
@@ -252,7 +252,7 @@ __hscore_o_excl( void )
INLINE int
__hscore_o_trunc( void )
{
-#ifdef O_TRUNC
+#if defined(O_TRUNC)
return O_TRUNC;
#else
return 0;
@@ -262,7 +262,7 @@ __hscore_o_trunc( void )
INLINE int
__hscore_o_noctty( void )
{
-#ifdef O_NOCTTY
+#if defined(O_NOCTTY)
return O_NOCTTY;
#else
return 0;
@@ -272,7 +272,7 @@ __hscore_o_noctty( void )
INLINE int
__hscore_o_nonblock( void )
{
-#ifdef O_NONBLOCK
+#if defined(O_NONBLOCK)
return O_NONBLOCK;
#else
return 0;
@@ -374,7 +374,7 @@ __hscore_ptr_c_cc( struct termios* ts )
INLINE HsInt
__hscore_sizeof_termios( void )
{
-#ifndef _WIN32
+#if !defined(_WIN32)
return sizeof(struct termios);
#else
return 0;
@@ -393,7 +393,7 @@ __hscore_sizeof_sigset_t( void )
INLINE int
__hscore_echo( void )
{
-#ifdef ECHO
+#if defined(ECHO)
return ECHO;
#else
return 0;
@@ -404,7 +404,7 @@ __hscore_echo( void )
INLINE int
__hscore_tcsanow( void )
{
-#ifdef TCSANOW
+#if defined(TCSANOW)
return TCSANOW;
#else
return 0;
@@ -415,7 +415,7 @@ __hscore_tcsanow( void )
INLINE int
__hscore_icanon( void )
{
-#ifdef ICANON
+#if defined(ICANON)
return ICANON;
#else
return 0;
@@ -424,7 +424,7 @@ __hscore_icanon( void )
INLINE int __hscore_vmin( void )
{
-#ifdef VMIN
+#if defined(VMIN)
return VMIN;
#else
return 0;
@@ -433,7 +433,7 @@ INLINE int __hscore_vmin( void )
INLINE int __hscore_vtime( void )
{
-#ifdef VTIME
+#if defined(VTIME)
return VTIME;
#else
return 0;
@@ -442,7 +442,7 @@ INLINE int __hscore_vtime( void )
INLINE int __hscore_sigttou( void )
{
-#ifdef SIGTTOU
+#if defined(SIGTTOU)
return SIGTTOU;
#else
return 0;
@@ -451,7 +451,7 @@ INLINE int __hscore_sigttou( void )
INLINE int __hscore_sig_block( void )
{
-#ifdef SIG_BLOCK
+#if defined(SIG_BLOCK)
return SIG_BLOCK;
#else
return 0;
@@ -460,14 +460,14 @@ INLINE int __hscore_sig_block( void )
INLINE int __hscore_sig_setmask( void )
{
-#ifdef SIG_SETMASK
+#if defined(SIG_SETMASK)
return SIG_SETMASK;
#else
return 0;
#endif
}
-#ifndef _WIN32
+#if !defined(_WIN32)
INLINE size_t __hscore_sizeof_siginfo_t (void)
{
return sizeof(siginfo_t);
@@ -477,7 +477,7 @@ INLINE size_t __hscore_sizeof_siginfo_t (void)
INLINE int
__hscore_f_getfl( void )
{
-#ifdef F_GETFL
+#if defined(F_GETFL)
return F_GETFL;
#else
return 0;
@@ -487,7 +487,7 @@ __hscore_f_getfl( void )
INLINE int
__hscore_f_setfl( void )
{
-#ifdef F_SETFL
+#if defined(F_SETFL)
return F_SETFL;
#else
return 0;
@@ -497,7 +497,7 @@ __hscore_f_setfl( void )
INLINE int
__hscore_f_setfd( void )
{
-#ifdef F_SETFD
+#if defined(F_SETFD)
return F_SETFD;
#else
return 0;
@@ -507,7 +507,7 @@ __hscore_f_setfd( void )
INLINE long
__hscore_fd_cloexec( void )
{
-#ifdef FD_CLOEXEC
+#if defined(FD_CLOEXEC)
return FD_CLOEXEC;
#else
return 0;
@@ -518,7 +518,7 @@ __hscore_fd_cloexec( void )
extern void* __hscore_get_saved_termios(int fd);
extern void __hscore_set_saved_termios(int fd, void* ts);
-#ifdef _WIN32
+#if defined(_WIN32)
INLINE int __hscore_open(wchar_t *file, int how, mode_t mode) {
if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND))
return _wsopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode);
diff --git a/libraries/base/include/ieee-flpt.h b/libraries/base/include/ieee-flpt.h
index a1fce3a8da..7bcfa1980e 100644
--- a/libraries/base/include/ieee-flpt.h
+++ b/libraries/base/include/ieee-flpt.h
@@ -4,32 +4,32 @@
#define IEEE_FLOATING_POINT 1
/* Radix of exponent representation */
-#ifndef FLT_RADIX
+#if !defined(FLT_RADIX)
# define FLT_RADIX 2
#endif
/* Number of base-FLT_RADIX digits in the significand of a float */
-#ifndef FLT_MANT_DIG
+#if !defined(FLT_MANT_DIG)
# define FLT_MANT_DIG 24
#endif
/* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
-#ifndef FLT_MIN_EXP
+#if !defined(FLT_MIN_EXP)
# define FLT_MIN_EXP (-125)
#endif
/* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
-#ifndef FLT_MAX_EXP
+#if !defined(FLT_MAX_EXP)
# define FLT_MAX_EXP 128
#endif
/* Number of base-FLT_RADIX digits in the significand of a double */
-#ifndef DBL_MANT_DIG
+#if !defined(DBL_MANT_DIG)
# define DBL_MANT_DIG 53
#endif
/* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
-#ifndef DBL_MIN_EXP
+#if !defined(DBL_MIN_EXP)
# define DBL_MIN_EXP (-1021)
#endif
/* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
-#ifndef DBL_MAX_EXP
+#if !defined(DBL_MAX_EXP)
# define DBL_MAX_EXP 1024
#endif