From d7c6c4717cdf1b7bd8550e37da66c52275c802f0 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 10 Jul 2019 11:54:47 -0400 Subject: Expunge #ifdef and #ifndef from the codebase These are unexploded minds as far as the linter is concerned. I don't want to hit in my MRs by mistake! I did this with `sed`, and then rolled back some changes in the docs, config.guess, and the linter itself. --- libraries/base/System/Environment/Blank.hsc | 6 +++--- libraries/base/tests/IO/T12010/T12010.hsc | 6 +++--- libraries/libiserv/src/GHCi/Utils.hsc | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'libraries') diff --git a/libraries/base/System/Environment/Blank.hsc b/libraries/base/System/Environment/Blank.hsc index 637a039809..02d369b5d6 100644 --- a/libraries/base/System/Environment/Blank.hsc +++ b/libraries/base/System/Environment/Blank.hsc @@ -40,7 +40,7 @@ module System.Environment.Blank ) where import Foreign.C -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) import Foreign.Ptr import GHC.Windows import Control.Monad @@ -61,7 +61,7 @@ import System.Environment withProgName, getEnvironment ) -#ifndef mingw32_HOST_OS +#if !defined(mingw32_HOST_OS) import qualified System.Environment as Environment #endif @@ -85,7 +85,7 @@ throwInvalidArgument from = -- | Similar to 'System.Environment.lookupEnv'. getEnv :: String -> IO (Maybe String) -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) getEnv = (<$> getEnvironment) . lookup #else getEnv = Environment.lookupEnv diff --git a/libraries/base/tests/IO/T12010/T12010.hsc b/libraries/base/tests/IO/T12010/T12010.hsc index e13a5fe5c7..9bcb92ef83 100644 --- a/libraries/base/tests/IO/T12010/T12010.hsc +++ b/libraries/base/tests/IO/T12010/T12010.hsc @@ -7,7 +7,7 @@ import Foreign.Marshal.Alloc import GHC.IO.FD import System.Exit -#ifdef _WIN32 +#if defined(_WIN32) #include #else #include @@ -21,7 +21,7 @@ sOCK_STREAM = #const SOCK_STREAM main :: IO () main = do -#ifdef _WIN32 +#if defined(_WIN32) void $ initWinSock #endif sock <- c_socket aF_INET sOCK_STREAM 0 @@ -34,6 +34,6 @@ main = do foreign import stdcall unsafe "socket" c_socket :: CInt -> CInt -> CInt -> IO CInt -#ifdef _WIN32 +#if defined(_WIN32) foreign import ccall unsafe "initWinSock" initWinSock :: IO Int #endif diff --git a/libraries/libiserv/src/GHCi/Utils.hsc b/libraries/libiserv/src/GHCi/Utils.hsc index b90cfacb5f..f606eb9d94 100644 --- a/libraries/libiserv/src/GHCi/Utils.hsc +++ b/libraries/libiserv/src/GHCi/Utils.hsc @@ -5,7 +5,7 @@ module GHCi.Utils import Foreign.C import GHC.IO.Handle (Handle()) -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) import GHC.IO.Handle.FD (fdToHandle) #else import System.Posix @@ -15,7 +15,7 @@ import System.Posix -- | Gets a GHC Handle File description from the given OS Handle or POSIX fd. getGhcHandle :: CInt -> IO Handle -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) getGhcHandle handle = _open_osfhandle handle (#const _O_BINARY) >>= fdToHandle foreign import ccall "io.h _open_osfhandle" _open_osfhandle :: -- cgit v1.2.1