summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-04-21 09:16:48 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-28 22:35:04 -0400
commit945c45ad50ed31e3acb96fdaafb21640c4669f12 (patch)
treeae2e59ba8d3a49bbd3c3dcece39d53aef691ed44
parente5b3492f23c2296d0d8221e1787ee585331f726e (diff)
downloadhaskell-945c45ad50ed31e3acb96fdaafb21640c4669f12.tar.gz
Prefer #if defined to #ifdef
Our new CPP linter enforces this.
-rw-r--r--compiler/basicTypes/RdrName.hs2
-rw-r--r--compiler/cmm/MkGraph.hs2
-rw-r--r--compiler/coreSyn/CoreArity.hs2
-rw-r--r--compiler/deSugar/Desugar.hs2
-rw-r--r--compiler/ghci/GHCi.hsc14
-rw-r--r--compiler/iface/MkIface.hs2
-rw-r--r--compiler/llvmGen/Llvm/Types.hs2
-rw-r--r--compiler/llvmGen/LlvmCodeGen/CodeGen.hs2
-rw-r--r--compiler/main/DynFlags.hs6
-rw-r--r--compiler/main/DynamicLoading.hs6
-rw-r--r--compiler/main/SysTools.hs6
-rw-r--r--compiler/parser/cutils.c2
-rw-r--r--compiler/prelude/primops.txt.pp2
-rw-r--r--compiler/simplCore/SimplCore.hs6
-rw-r--r--compiler/specialise/Rules.hs2
-rw-r--r--compiler/typecheck/TcMType.hs2
-rw-r--r--compiler/typecheck/TcPluginM.hs4
-rw-r--r--compiler/typecheck/TcRnDriver.hs4
-rw-r--r--compiler/typecheck/TcSMonad.hs8
-rw-r--r--compiler/utils/Panic.hs2
-rw-r--r--compiler/utils/Util.hs20
-rw-r--r--driver/gcc/gcc.c2
-rw-r--r--ghc/GHCi/UI.hs8
-rw-r--r--ghc/Main.hs12
-rw-r--r--ghc/hschooks.c2
-rw-r--r--includes/Cmm.h18
-rw-r--r--includes/CodeGen.Platform.hs410
-rw-r--r--includes/HsFFI.h4
-rw-r--r--includes/MachDeps.h4
-rw-r--r--includes/Rts.h30
-rw-r--r--includes/RtsAPI.h6
-rw-r--r--includes/Stg.h6
-rw-r--r--includes/rts/EventLogFormat.h2
-rw-r--r--includes/rts/Flags.h2
-rw-r--r--includes/rts/OSThreads.h14
-rw-r--r--includes/rts/Threads.h2
-rw-r--r--includes/rts/prof/LDV.h4
-rw-r--r--includes/rts/storage/Block.h12
-rw-r--r--includes/rts/storage/ClosureMacros.h8
-rw-r--r--includes/rts/storage/Closures.h4
-rw-r--r--includes/rts/storage/InfoTables.h24
-rw-r--r--includes/rts/storage/MBlock.h2
-rw-r--r--includes/rts/storage/TSO.h6
-rw-r--r--includes/stg/DLL.h4
-rw-r--r--includes/stg/HaskellMachRegs.h14
-rw-r--r--includes/stg/MachRegs.h18
-rw-r--r--includes/stg/MiscClosures.h6
-rw-r--r--includes/stg/RtsMachRegs.h18
-rw-r--r--includes/stg/Ticky.h6
-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
-rw-r--r--libraries/ghci/GHCi/ObjLink.hs4
-rw-r--r--libraries/ghci/GHCi/Signals.hs2
-rw-r--r--rts/Adjustor.c6
-rw-r--r--rts/AdjustorAsm.S4
-rw-r--r--rts/Apply.cmm8
-rw-r--r--rts/Apply.h4
-rw-r--r--rts/AutoApply.h2
-rw-r--r--rts/Capability.c10
-rw-r--r--rts/Capability.h4
-rw-r--r--rts/CheckUnload.c4
-rw-r--r--rts/Compact.cmm4
-rw-r--r--rts/Disassembler.c2
-rw-r--r--rts/Disassembler.h2
-rw-r--r--rts/FileLock.c6
-rw-r--r--rts/Globals.c10
-rw-r--r--rts/HeapStackCheck.cmm10
-rw-r--r--rts/Hpc.c8
-rw-r--r--rts/Interpreter.c62
-rw-r--r--rts/LdvProfile.c2
-rw-r--r--rts/LdvProfile.h2
-rw-r--r--rts/Libdw.c2
-rw-r--r--rts/Linker.c20
-rw-r--r--rts/Messages.c10
-rw-r--r--rts/Messages.h2
-rw-r--r--rts/Pool.c12
-rw-r--r--rts/Prelude.h2
-rw-r--r--rts/PrimOps.cmm34
-rw-r--r--rts/Printer.c14
-rw-r--r--rts/Printer.h2
-rw-r--r--rts/ProfHeap.c64
-rw-r--r--rts/ProfHeap.h2
-rw-r--r--rts/ProfilerReport.c2
-rw-r--r--rts/ProfilerReport.h2
-rw-r--r--rts/ProfilerReportJson.c2
-rw-r--r--rts/ProfilerReportJson.h2
-rw-r--r--rts/Profiling.c16
-rw-r--r--rts/Profiling.h6
-rw-r--r--rts/Proftimer.c8
-rw-r--r--rts/RaiseAsync.c8
-rw-r--r--rts/RaiseAsync.h2
-rw-r--r--rts/RetainerProfile.c82
-rw-r--r--rts/RetainerProfile.h4
-rw-r--r--rts/RetainerSet.c14
-rw-r--r--rts/RetainerSet.h14
-rw-r--r--rts/RtsAPI.c2
-rw-r--r--rts/RtsDllMain.c2
-rw-r--r--rts/RtsDllMain.h2
-rw-r--r--rts/RtsFlags.c48
-rw-r--r--rts/RtsMain.c4
-rw-r--r--rts/RtsMessages.c4
-rw-r--r--rts/RtsProbes.d2
-rw-r--r--rts/RtsStartup.c18
-rw-r--r--rts/RtsSymbols.c4
-rw-r--r--rts/RtsSymbols.h2
-rw-r--r--rts/RtsUtils.c16
-rw-r--r--rts/RtsUtils.h2
-rw-r--r--rts/SMPClosureOps.h2
-rw-r--r--rts/STM.c2
-rw-r--r--rts/STM.h2
-rw-r--r--rts/Schedule.c62
-rw-r--r--rts/Stable.c6
-rw-r--r--rts/Stable.h2
-rw-r--r--rts/StaticPtrTable.c6
-rw-r--r--rts/Stats.c26
-rw-r--r--rts/Stats.h4
-rw-r--r--rts/StgCRun.c24
-rw-r--r--rts/StgStartup.cmm2
-rw-r--r--rts/StgStdThunks.cmm4
-rw-r--r--rts/Task.c8
-rw-r--r--rts/ThreadPaused.c4
-rw-r--r--rts/Threads.c6
-rw-r--r--rts/Threads.h4
-rw-r--r--rts/Timer.c4
-rw-r--r--rts/TopHandler.c6
-rw-r--r--rts/Trace.c66
-rw-r--r--rts/Trace.h12
-rw-r--r--rts/Updates.h6
-rw-r--r--rts/Weak.c2
-rw-r--r--rts/eventlog/EventLog.c14
-rw-r--r--rts/eventlog/EventLog.h4
-rw-r--r--rts/eventlog/EventLogWriter.c6
-rw-r--r--rts/linker/LoadArchive.c2
-rw-r--r--rts/linker/M32Alloc.h2
-rw-r--r--rts/linker/MachO.c22
-rw-r--r--rts/linker/MachO.h2
-rw-r--r--rts/linker/PEi386.c6
-rw-r--r--rts/linker/PEi386.h2
-rw-r--r--rts/linker/SymbolExtras.c8
-rw-r--r--rts/linker/SymbolExtras.h2
-rw-r--r--rts/package.conf.in20
-rw-r--r--rts/posix/Clock.h10
-rw-r--r--rts/posix/GetTime.c4
-rw-r--r--rts/posix/OSMem.c26
-rw-r--r--rts/posix/OSThreads.c8
-rw-r--r--rts/posix/Signals.c22
-rw-r--r--rts/posix/Signals.h2
-rw-r--r--rts/posix/TTY.c4
-rw-r--r--rts/posix/itimer/Pthread.c12
-rw-r--r--rts/posix/itimer/Setitimer.c6
-rw-r--r--rts/posix/itimer/TimerCreate.c2
-rw-r--r--rts/sm/BlockAlloc.c2
-rw-r--r--rts/sm/BlockAlloc.h2
-rw-r--r--rts/sm/CNF.c16
-rw-r--r--rts/sm/CNF.h2
-rw-r--r--rts/sm/Compact.c2
-rw-r--r--rts/sm/Evac.c16
-rw-r--r--rts/sm/Evac_thr.c2
-rw-r--r--rts/sm/GC.c28
-rw-r--r--rts/sm/GC.h2
-rw-r--r--rts/sm/GCThread.h2
-rw-r--r--rts/sm/GCUtils.c6
-rw-r--r--rts/sm/GCUtils.h2
-rw-r--r--rts/sm/HeapAlloc.h2
-rw-r--r--rts/sm/MBlock.c10
-rw-r--r--rts/sm/MarkWeak.c4
-rw-r--r--rts/sm/OSMem.h2
-rw-r--r--rts/sm/Sanity.c6
-rw-r--r--rts/sm/Sanity.h2
-rw-r--r--rts/sm/Scav.c6
-rw-r--r--rts/sm/Scav.h2
-rw-r--r--rts/sm/Scav_thr.c2
-rw-r--r--rts/sm/ShouldCompact.h2
-rw-r--r--rts/sm/Storage.c16
-rw-r--r--rts/win32/AsyncIO.c2
-rw-r--r--rts/win32/ConsoleHandler.c2
-rw-r--r--rts/win32/GetTime.c2
-rw-r--r--rts/win32/OSMem.c2
-rw-r--r--rts/win32/OSThreads.c6
-rw-r--r--rts/win32/ThrIOManager.c2
-rw-r--r--rts/win32/veh_excn.c2
-rw-r--r--utils/genapply/Main.hs4
-rw-r--r--utils/ghc-pkg/Main.hs10
-rw-r--r--utils/hp2ps/HpFile.c2
-rw-r--r--utils/hp2ps/Main.c2
-rw-r--r--utils/hp2ps/Main.h6
-rw-r--r--utils/lndir/lndir-Xos.h30
-rw-r--r--utils/lndir/lndir-Xosdefs.h32
-rw-r--r--utils/lndir/lndir.c40
-rw-r--r--utils/unlit/unlit.c6
220 files changed, 1185 insertions, 1185 deletions
diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs
index 3a4324b352..3693373792 100644
--- a/compiler/basicTypes/RdrName.hs
+++ b/compiler/basicTypes/RdrName.hs
@@ -483,7 +483,7 @@ plusParent p1 p2@(FldParent _ _) = hasParent p2 p1
plusParent _ _ = NoParent
hasParent :: Parent -> Parent -> Parent
-#ifdef DEBUG
+#if defined(DEBUG)
hasParent p NoParent = p
hasParent p p'
| p /= p' = pprPanic "hasParent" (ppr p <+> ppr p') -- Parents should agree
diff --git a/compiler/cmm/MkGraph.hs b/compiler/cmm/MkGraph.hs
index f77392fbc2..81d9c0f540 100644
--- a/compiler/cmm/MkGraph.hs
+++ b/compiler/cmm/MkGraph.hs
@@ -183,7 +183,7 @@ mkNop :: CmmAGraph
mkNop = nilOL
mkComment :: FastString -> CmmAGraph
-#ifdef DEBUG
+#if defined(DEBUG)
-- SDM: generating all those comments takes time, this saved about 4% for me
mkComment fs = mkMiddle $ CmmComment fs
#else
diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs
index 17abfbeae4..3ab71d2ae4 100644
--- a/compiler/coreSyn/CoreArity.hs
+++ b/compiler/coreSyn/CoreArity.hs
@@ -541,7 +541,7 @@ findRhsArity dflags bndr rhs old_arity
| cur_arity <= old_arity = cur_arity
| new_arity == cur_arity = cur_arity
| otherwise = ASSERT( new_arity < cur_arity )
-#ifdef DEBUG
+#if defined(DEBUG)
pprTrace "Exciting arity"
(vcat [ ppr bndr <+> ppr cur_arity <+> ppr new_arity
, ppr rhs])
diff --git a/compiler/deSugar/Desugar.hs b/compiler/deSugar/Desugar.hs
index 6ae7fb4df4..0d8965a118 100644
--- a/compiler/deSugar/Desugar.hs
+++ b/compiler/deSugar/Desugar.hs
@@ -156,7 +156,7 @@ deSugar hsc_env
-- You might think it doesn't matter, but the simplifier brings all top-level
-- things into the in-scope set before simplifying; so we get no unfolding for F#!
-#ifdef DEBUG
+#if defined(DEBUG)
-- Debug only as pre-simple-optimisation program may be really big
; endPassIO hsc_env print_unqual CoreDesugar final_pgm rules_for_imps
#endif
diff --git a/compiler/ghci/GHCi.hsc b/compiler/ghci/GHCi.hsc
index 849c8db7fa..d2f2f5a833 100644
--- a/compiler/ghci/GHCi.hsc
+++ b/compiler/ghci/GHCi.hsc
@@ -47,7 +47,7 @@ module GHCi
) where
import GHCi.Message
-#ifdef GHCI
+#if defined(GHCI)
import GHCi.Run
#endif
import GHCi.RemoteTypes
@@ -83,7 +83,7 @@ import GHC.Stack (CostCentre,CostCentreStack)
import System.Exit
import Data.Maybe
import GHC.IO.Handle.Types (Handle)
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
import Foreign.C
import GHC.IO.Handle.FD (fdToHandle)
#if !MIN_VERSION_process(1,4,2)
@@ -162,7 +162,7 @@ Other Notes on Remote GHCi
* Note [Remote Template Haskell] in libraries/ghci/GHCi/TH.hs
-}
-#ifndef GHCI
+#if !defined(GHCI)
needExtInt :: IO a
needExtInt = throwIO
(InstallationError "this operation requires -fexternal-interpreter")
@@ -180,7 +180,7 @@ iservCmd hsc_env@HscEnv{..} msg
uninterruptibleMask_ $ do -- Note [uninterruptibleMask_]
iservCall iserv msg
| otherwise = -- Just run it directly
-#ifdef GHCI
+#if defined(GHCI)
run msg
#else
needExtInt
@@ -385,7 +385,7 @@ lookupSymbol hsc_env@HscEnv{..} str
writeIORef iservLookupSymbolCache $! addToUFM cache str p
return (Just p)
| otherwise =
-#ifdef GHCI
+#if defined(GHCI)
fmap fromRemotePtr <$> run (LookupSymbol (unpackFS str))
#else
needExtInt
@@ -525,7 +525,7 @@ stopIServ HscEnv{..} =
runWithPipes :: (CreateProcess -> IO ProcessHandle)
-> FilePath -> [String] -> IO (ProcessHandle, Handle, Handle)
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import ccall "io.h _close"
c__close :: CInt -> IO CInt
@@ -652,7 +652,7 @@ wormholeRef dflags _r
| gopt Opt_ExternalInterpreter dflags
= throwIO (InstallationError
"this operation requires -fno-external-interpreter")
-#ifdef GHCI
+#if defined(GHCI)
| otherwise
= localRef _r
#else
diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs
index d157a5ac99..14749c7617 100644
--- a/compiler/iface/MkIface.hs
+++ b/compiler/iface/MkIface.hs
@@ -1400,7 +1400,7 @@ checkModUsage _this_pkg UsageFile{ usg_file_path = file,
where
recomp = RecompBecause (file ++ " changed")
handle =
-#ifdef DEBUG
+#if defined(DEBUG)
\e -> pprTrace "UsageFile" (text (show e)) $ return recomp
#else
\_ -> return recomp -- if we can't find the file, just recompile, don't fail
diff --git a/compiler/llvmGen/Llvm/Types.hs b/compiler/llvmGen/Llvm/Types.hs
index d2cab4430b..bf23cd89f7 100644
--- a/compiler/llvmGen/Llvm/Types.hs
+++ b/compiler/llvmGen/Llvm/Types.hs
@@ -868,7 +868,7 @@ ppFloat = ppDouble . widenFp
-- | Reverse or leave byte data alone to fix endianness on this target.
fixEndian :: [a] -> [a]
-#ifdef WORDS_BIGENDIAN
+#if defined(WORDS_BIGENDIAN)
fixEndian = id
#else
fixEndian = reverse
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index f1383c660e..03813248ae 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -986,7 +986,7 @@ which will eliminate the expression entirely.
However, it's certainly possible and reasonable for this to occur in
hand-written C-- code. Consider something like:
- #ifndef SOME_CONDITIONAL
+ #if !defined(SOME_CONDITIONAL)
#define CHECK_THING(x) 1
#else
#define CHECK_THING(x) some_operation((x))
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index b3600b8cfb..383a71a7e5 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2636,7 +2636,7 @@ dynamic_flags_deps = [
, make_ord_flag defGhcFlag "static" (NoArg removeWayDyn)
, make_ord_flag defGhcFlag "dynamic" (NoArg (addWay WayDyn))
, make_ord_flag defGhcFlag "rdynamic" $ noArg $
-#ifdef linux_HOST_OS
+#if defined(linux_HOST_OS)
addOptl "-rdynamic"
#elif defined (mingw32_HOST_OS)
addOptl "-Wl,--export-all-symbols"
@@ -4884,7 +4884,7 @@ addIncludePath p =
addFrameworkPath p =
upd (\s -> s{frameworkPaths = frameworkPaths s ++ splitPathList p})
-#ifndef mingw32_TARGET_OS
+#if !defined(mingw32_TARGET_OS)
split_marker :: Char
split_marker = ':' -- not configurable (ToDo)
#endif
@@ -4896,7 +4896,7 @@ splitPathList s = filter notNull (splitUp s)
-- cause confusion when they are translated into -I options
-- for passing to gcc.
where
-#ifndef mingw32_TARGET_OS
+#if !defined(mingw32_TARGET_OS)
splitUp xs = split split_marker xs
#else
-- Windows: 'hybrid' support for DOS-style paths in directory lists.
diff --git a/compiler/main/DynamicLoading.hs b/compiler/main/DynamicLoading.hs
index 5658f2feb2..ffdce28762 100644
--- a/compiler/main/DynamicLoading.hs
+++ b/compiler/main/DynamicLoading.hs
@@ -2,7 +2,7 @@
-- | Dynamically lookup up values from modules and loading them.
module DynamicLoading (
-#ifdef GHCI
+#if defined(GHCI)
-- * Loading plugins
loadPlugins,
loadFrontendPlugin,
@@ -24,7 +24,7 @@ module DynamicLoading (
#endif
) where
-#ifdef GHCI
+#if defined(GHCI)
import Linker ( linkModule, getHValue )
import GHCi ( wormhole )
import SrcLoc ( noSrcSpan )
@@ -66,7 +66,7 @@ import Data.List ( intercalate )
#endif
-#ifdef GHCI
+#if defined(GHCI)
loadPlugins :: HscEnv -> IO [(ModuleName, Plugin, [CommandLineOption])]
loadPlugins hsc_env
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index 16f8d1aa79..ad2e33c85c 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -81,7 +81,7 @@ import Data.List
import qualified Data.Map as Map
import qualified Data.Set as Set
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import qualified System.Posix.Internals
#else /* Must be Win32 */
import Foreign
@@ -102,7 +102,7 @@ import Control.Concurrent
import FastString
import SrcLoc ( SrcLoc, mkSrcLoc, noSrcSpan, mkSrcSpan )
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
# if defined(i386_HOST_ARCH)
# define WINDOWS_CCONV stdcall
# elif defined(x86_64_HOST_ARCH)
@@ -1539,7 +1539,7 @@ foreign import WINDOWS_CCONV unsafe "dynamic"
getBaseDir = return Nothing
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
foreign import ccall unsafe "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Windows
#else
getProcessID :: IO Int
diff --git a/compiler/parser/cutils.c b/compiler/parser/cutils.c
index e458c080a1..fdaea44cc7 100644
--- a/compiler/parser/cutils.c
+++ b/compiler/parser/cutils.c
@@ -9,7 +9,7 @@ places in the GHC library.
#include <string.h>
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 255235aef3..bff45401a7 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -2272,7 +2272,7 @@ primop WaitWriteOp "waitWrite#" GenPrimOp
has_side_effects = True
out_of_line = True
-#ifdef mingw32_TARGET_OS
+#if defined(mingw32_TARGET_OS)
primop AsyncReadOp "asyncRead#" GenPrimOp
Int# -> Int# -> Int# -> Addr# -> State# RealWorld-> (# State# RealWorld, Int#, Int# #)
{Asynchronously read bytes from specified file descriptor.}
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index bca9a33a26..93d829283e 100644
--- a/compiler/simplCore/SimplCore.hs
+++ b/compiler/simplCore/SimplCore.hs
@@ -56,7 +56,7 @@ import Outputable
import Control.Monad
import qualified GHC.LanguageExtensions as LangExt
-#ifdef GHCI
+#if defined(GHCI)
import DynamicLoading ( loadPlugins )
import Plugins ( installCoreToDos )
#else
@@ -368,7 +368,7 @@ getCoreToDo dflags
-- Loading plugins
addPluginPasses :: [CoreToDo] -> CoreM [CoreToDo]
-#ifndef GHCI
+#if !defined(GHCI)
addPluginPasses builtin_passes
= do { dflags <- getDynFlags
; let pluginMods = pluginModNames dflags
@@ -493,7 +493,7 @@ doCorePass (CoreDoRuleCheck phase pat) = ruleCheckPass phase pat
doCorePass CoreDoNothing = return
doCorePass (CoreDoPasses passes) = runCorePasses passes
-#ifdef GHCI
+#if defined(GHCI)
doCorePass (CoreDoPluginPass _ pass) = {-# SCC "Plugin" #-} pass
#endif
diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs
index 83b4e8dd9c..aed86c5b42 100644
--- a/compiler/specialise/Rules.hs
+++ b/compiler/specialise/Rules.hs
@@ -843,7 +843,7 @@ match_co renv subst co1 co2
_ -> Nothing
match_co _ _ _co1 _co2
-- Currently just deals with CoVarCo, TyConAppCo and Refl
-#ifdef DEBUG
+#if defined(DEBUG)
= pprTrace "match_co: needs more cases" (ppr _co1 $$ ppr _co2) Nothing
#else
= Nothing
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index 6b517eb8d6..1ae90661a8 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -263,7 +263,7 @@ newCoercionHole
fillCoercionHole :: CoercionHole -> Coercion -> TcM ()
fillCoercionHole (CoercionHole u ref) co
= do {
-#ifdef DEBUG
+#if defined(DEBUG)
; cts <- readTcRef ref
; whenIsJust cts $ \old_co ->
pprPanic "Filling a filled coercion hole" (ppr u $$ ppr co $$ ppr old_co)
diff --git a/compiler/typecheck/TcPluginM.hs b/compiler/typecheck/TcPluginM.hs
index 0363aa114a..b195a555f9 100644
--- a/compiler/typecheck/TcPluginM.hs
+++ b/compiler/typecheck/TcPluginM.hs
@@ -3,7 +3,7 @@
-- access select functions of the 'TcM', principally those to do with
-- reading parts of the state.
module TcPluginM (
-#ifdef GHCI
+#if defined(GHCI)
-- * Basic TcPluginM functionality
TcPluginM,
tcPluginIO,
@@ -52,7 +52,7 @@ module TcPluginM (
#endif
) where
-#ifdef GHCI
+#if defined(GHCI)
import qualified TcRnMonad as TcM
import qualified TcSMonad as TcS
import qualified TcEnv as TcM
diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs
index b9ffd6a835..76377b4448 100644
--- a/compiler/typecheck/TcRnDriver.hs
+++ b/compiler/typecheck/TcRnDriver.hs
@@ -54,7 +54,7 @@ import RnFixity ( lookupFixityRn )
import MkId
import TidyPgm ( globaliseAndTidyId )
import TysWiredIn ( unitTy, mkListTy )
-#ifdef GHCI
+#if defined(GHCI)
import DynamicLoading ( loadPlugins )
import Plugins ( tcPlugin )
#endif
@@ -2622,7 +2622,7 @@ withTcPlugins hsc_env m =
return (solve s, stop s)
loadTcPlugins :: HscEnv -> IO [TcPlugin]
-#ifndef GHCI
+#if !defined(GHCI)
loadTcPlugins _ = return []
#else
loadTcPlugins hsc_env =
diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs
index adb8666f98..05a18705d3 100644
--- a/compiler/typecheck/TcSMonad.hs
+++ b/compiler/typecheck/TcSMonad.hs
@@ -167,7 +167,7 @@ import MonadUtils
import Data.IORef
import Data.List ( foldl', partition )
-#ifdef DEBUG
+#if defined(DEBUG)
import Digraph
import UniqSet
#endif
@@ -2397,14 +2397,14 @@ runTcSWithEvBinds ev_binds_var tcs
; when (count > 0) $
csTraceTcM $ return (text "Constraint solver steps =" <+> int count)
-#ifdef DEBUG
+#if defined(DEBUG)
; ev_binds <- TcM.getTcEvBindsMap ev_binds_var
; checkForCyclicBinds ev_binds
#endif
; return res }
-#ifdef DEBUG
+#if defined(DEBUG)
checkForCyclicBinds :: EvBindMap -> TcM ()
checkForCyclicBinds ev_binds_map
| null cycles
@@ -2456,7 +2456,7 @@ nestImplicTcS ref inner_tclvl (TcS thing_inside)
; res <- TcM.setTcLevel inner_tclvl $
thing_inside nest_env
-#ifdef DEBUG
+#if defined(DEBUG)
-- Perform a check that the thing_inside did not cause cycles
; ev_binds <- TcM.getTcEvBindsMap ref
; checkForCyclicBinds ev_binds
diff --git a/compiler/utils/Panic.hs b/compiler/utils/Panic.hs
index b12d677a1e..0a21f251fb 100644
--- a/compiler/utils/Panic.hs
+++ b/compiler/utils/Panic.hs
@@ -38,7 +38,7 @@ import Debug.Trace ( trace )
import System.IO.Unsafe
import System.Environment
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import System.Posix.Signals as S
#endif
diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs
index 1c519ebeef..a4bc8d4653 100644
--- a/compiler/utils/Util.hs
+++ b/compiler/utils/Util.hs
@@ -168,7 +168,7 @@ import qualified Data.Set as Set
import Data.Time
-#ifdef DEBUG
+#if defined(DEBUG)
import {-# SOURCE #-} Outputable ( warnPprTrace, text )
#endif
@@ -192,42 +192,42 @@ the flags are off.
-}
ghciSupported :: Bool
-#ifdef GHCI
+#if defined(GHCI)
ghciSupported = True
#else
ghciSupported = False
#endif
debugIsOn :: Bool
-#ifdef DEBUG
+#if defined(DEBUG)
debugIsOn = True
#else
debugIsOn = False
#endif
ncgDebugIsOn :: Bool
-#ifdef NCG_DEBUG
+#if defined(NCG_DEBUG)
ncgDebugIsOn = True
#else
ncgDebugIsOn = False
#endif
ghciTablesNextToCode :: Bool
-#ifdef GHCI_TABLES_NEXT_TO_CODE
+#if defined(GHCI_TABLES_NEXT_TO_CODE)
ghciTablesNextToCode = True
#else
ghciTablesNextToCode = False
#endif
isWindowsHost :: Bool
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
isWindowsHost = True
#else
isWindowsHost = False
#endif
isDarwinHost :: Bool
-#ifdef darwin_HOST_OS
+#if defined(darwin_HOST_OS)
isDarwinHost = True
#else
isDarwinHost = False
@@ -326,7 +326,7 @@ zipWithEqual :: String -> (a->b->c) -> [a]->[b]->[c]
zipWith3Equal :: String -> (a->b->c->d) -> [a]->[b]->[c]->[d]
zipWith4Equal :: String -> (a->b->c->d->e) -> [a]->[b]->[c]->[d]->[e]
-#ifndef DEBUG
+#if !defined(DEBUG)
zipEqual _ = zip
zipWithEqual _ = zipWith
zipWith3Equal _ = zipWith3
@@ -544,7 +544,7 @@ notNull [] = False
notNull _ = True
only :: [a] -> a
-#ifdef DEBUG
+#if defined(DEBUG)
only [a] = a
#else
only (a:_) = a
@@ -1345,7 +1345,7 @@ type HasCallStack = (() :: Constraint)
#endif
-- | A call stack constraint, but only when 'isDebugOn'.
-#ifdef DEBUG
+#if defined(DEBUG)
type HasDebugCallStack = HasCallStack
#else
type HasDebugCallStack = (() :: Constraint)
diff --git a/driver/gcc/gcc.c b/driver/gcc/gcc.c
index 5c7cb15ae5..b398c5ea46 100644
--- a/driver/gcc/gcc.c
+++ b/driver/gcc/gcc.c
@@ -52,7 +52,7 @@ int main(int argc, char** argv) {
from that in preference to the in-tree files. */
preArgv[0] = mkString("-B%s", binDir);
preArgv[1] = mkString("-B%s/../lib", binDir);
-#ifdef __MINGW64__
+#if defined(__MINGW64__)
base = mkString("x86_64-w64-mingw32");
#else
base = mkString("i686-w64-mingw32");
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index ab6c2dc199..52a809ea3d 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -122,7 +122,7 @@ import Text.Read.Lex (isSymbolChar)
import Unsafe.Coerce
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import System.Posix hiding ( getEnv )
#else
import qualified System.Win32
@@ -379,7 +379,7 @@ findEditor :: IO String
findEditor = do
getEnv "EDITOR"
`catchIO` \_ -> do
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
win <- System.Win32.getWindowsDirectory
return (win </> "notepad.exe")
#else
@@ -669,7 +669,7 @@ checkFileAndDirPerms file = do
d -> d
checkPerms :: FilePath -> IO Bool
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
checkPerms _ = return True
#else
checkPerms file =
@@ -720,7 +720,7 @@ formatCurrentTime format =
getUserName :: IO String
getUserName = do
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
getEnv "USERNAME"
`catchIO` \e -> do
putStrLn $ show e
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 29012f6f60..6ece4302db 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -25,12 +25,12 @@ import HscMain ( newHscEnv )
import DriverPipeline ( oneShot, compileFile )
import DriverMkDepend ( doMkDependHS )
import DriverBkp ( doBackpack )
-#ifdef GHCI
+#if defined(GHCI)
import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings )
#endif
-- Frontend plugins
-#ifdef GHCI
+#if defined(GHCI)
import DynamicLoading ( loadFrontendPlugin )
import Plugins
#else
@@ -258,7 +258,7 @@ main' postLoadMode dflags0 args flagWarnings = do
liftIO $ dumpFinalStats dflags6
ghciUI :: [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc ()
-#ifndef GHCI
+#if !defined(GHCI)
ghciUI _ _ = throwGhcException (CmdLineError "not built for interactive use")
#else
ghciUI = interactiveUI defaultGhciSettings
@@ -504,7 +504,7 @@ isDoEvalMode :: Mode -> Bool
isDoEvalMode (Right (Right (DoEval _))) = True
isDoEvalMode _ = False
-#ifdef GHCI
+#if defined(GHCI)
isInteractiveMode :: PostLoadMode -> Bool
isInteractiveMode DoInteractive = True
isInteractiveMode _ = False
@@ -735,7 +735,7 @@ showBanner :: PostLoadMode -> DynFlags -> IO ()
showBanner _postLoadMode dflags = do
let verb = verbosity dflags
-#ifdef GHCI
+#if defined(GHCI)
-- Show the GHCi banner
when (isInteractiveMode _postLoadMode && verb >= 1) $ putStrLn ghciWelcomeMsg
#endif
@@ -831,7 +831,7 @@ dumpPackagesSimple dflags = putMsg dflags (pprPackagesSimple dflags)
-- Frontend plugin support
doFrontend :: ModuleName -> [(String, Maybe Phase)] -> Ghc ()
-#ifndef GHCI
+#if !defined(GHCI)
doFrontend modname _ = pluginError [modname]
#else
doFrontend modname srcs = do
diff --git a/ghc/hschooks.c b/ghc/hschooks.c
index ace28be64c..031cb02d1a 100644
--- a/ghc/hschooks.c
+++ b/ghc/hschooks.c
@@ -18,7 +18,7 @@ in instead of the defaults.
#include <string.h>
#include <stdbool.h>
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 3c90307a77..57d78ccaa5 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -120,13 +120,13 @@
name : bits8[] str; \
} \
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define RET_LBL(f) f##_info
#else
#define RET_LBL(f) f##_ret
#endif
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define ENTRY_LBL(f) f##_info
#else
#define ENTRY_LBL(f) f##_entry
@@ -204,7 +204,7 @@
Assertions and Debuggery
-------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
#define ASSERT(predicate) \
if (predicate) { \
/*null*/; \
@@ -215,7 +215,7 @@
#define ASSERT(p) /* nothing */
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
#define DEBUG_ONLY(s) s
#else
#define DEBUG_ONLY(s) /* nothing */
@@ -230,7 +230,7 @@
*
* Note the syntax is slightly different to the C version of this macro.
*/
-#ifdef DEBUG
+#if defined(DEBUG)
#define IF_DEBUG(c,s) if (RtsFlags_DebugFlags_##c(RtsFlags) != 0::CBool) { s; }
#else
#define IF_DEBUG(c,s) /* nothing */
@@ -256,7 +256,7 @@
Indirections can contain tagged pointers, so their tag is checked.
-------------------------------------------------------------------------- */
-#ifdef PROFILING
+#if defined(PROFILING)
// When profiling, we cannot shortcut ENTER() by checking the tag,
// because LDV profiling relies on entering closures to mark them as
@@ -589,7 +589,7 @@
* depending on TABLES_NEXT_TO_CODE. So we define field access
* macros which use the appropriate version here:
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
/*
* when TABLES_NEXT_TO_CODE, slow_apply is stored as an offset
* instead of the normal pointer.
@@ -623,7 +623,7 @@
#define OVERWRITING_CLOSURE_OFS(c,n) /* nothing */
#endif
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
#define prim_write_barrier prim %write_barrier()
#else
#define prim_write_barrier /* nothing */
@@ -633,7 +633,7 @@
Ticky macros
-------------------------------------------------------------------------- */
-#ifdef TICKY_TICKY
+#if defined(TICKY_TICKY)
#define TICK_BUMP_BY(ctr,n) CLong[ctr] = CLong[ctr] + n
#else
#define TICK_BUMP_BY(ctr,n) /* nothing */
diff --git a/includes/CodeGen.Platform.hs b/includes/CodeGen.Platform.hs
index 97628aecdc..868608a1ed 100644
--- a/includes/CodeGen.Platform.hs
+++ b/includes/CodeGen.Platform.hs
@@ -352,278 +352,278 @@ import Reg
#endif
callerSaves :: GlobalReg -> Bool
-#ifdef CALLER_SAVES_Base
+#if defined(CALLER_SAVES_Base)
callerSaves BaseReg = True
#endif
-#ifdef CALLER_SAVES_R1
+#if defined(CALLER_SAVES_R1)
callerSaves (VanillaReg 1 _) = True
#endif
-#ifdef CALLER_SAVES_R2
+#if defined(CALLER_SAVES_R2)
callerSaves (VanillaReg 2 _) = True
#endif
-#ifdef CALLER_SAVES_R3
+#if defined(CALLER_SAVES_R3)
callerSaves (VanillaReg 3 _) = True
#endif
-#ifdef CALLER_SAVES_R4
+#if defined(CALLER_SAVES_R4)
callerSaves (VanillaReg 4 _) = True
#endif
-#ifdef CALLER_SAVES_R5
+#if defined(CALLER_SAVES_R5)
callerSaves (VanillaReg 5 _) = True
#endif
-#ifdef CALLER_SAVES_R6
+#if defined(CALLER_SAVES_R6)
callerSaves (VanillaReg 6 _) = True
#endif
-#ifdef CALLER_SAVES_R7
+#if defined(CALLER_SAVES_R7)
callerSaves (VanillaReg 7 _) = True
#endif
-#ifdef CALLER_SAVES_R8
+#if defined(CALLER_SAVES_R8)
callerSaves (VanillaReg 8 _) = True
#endif
-#ifdef CALLER_SAVES_R9
+#if defined(CALLER_SAVES_R9)
callerSaves (VanillaReg 9 _) = True
#endif
-#ifdef CALLER_SAVES_R10
+#if defined(CALLER_SAVES_R10)
callerSaves (VanillaReg 10 _) = True
#endif
-#ifdef CALLER_SAVES_F1
+#if defined(CALLER_SAVES_F1)
callerSaves (FloatReg 1) = True
#endif
-#ifdef CALLER_SAVES_F2
+#if defined(CALLER_SAVES_F2)
callerSaves (FloatReg 2) = True
#endif
-#ifdef CALLER_SAVES_F3
+#if defined(CALLER_SAVES_F3)
callerSaves (FloatReg 3) = True
#endif
-#ifdef CALLER_SAVES_F4
+#if defined(CALLER_SAVES_F4)
callerSaves (FloatReg 4) = True
#endif
-#ifdef CALLER_SAVES_F5
+#if defined(CALLER_SAVES_F5)
callerSaves (FloatReg 5) = True
#endif
-#ifdef CALLER_SAVES_F6
+#if defined(CALLER_SAVES_F6)
callerSaves (FloatReg 6) = True
#endif
-#ifdef CALLER_SAVES_D1
+#if defined(CALLER_SAVES_D1)
callerSaves (DoubleReg 1) = True
#endif
-#ifdef CALLER_SAVES_D2
+#if defined(CALLER_SAVES_D2)
callerSaves (DoubleReg 2) = True
#endif
-#ifdef CALLER_SAVES_D3
+#if defined(CALLER_SAVES_D3)
callerSaves (DoubleReg 3) = True
#endif
-#ifdef CALLER_SAVES_D4
+#if defined(CALLER_SAVES_D4)
callerSaves (DoubleReg 4) = True
#endif
-#ifdef CALLER_SAVES_D5
+#if defined(CALLER_SAVES_D5)
callerSaves (DoubleReg 5) = True
#endif
-#ifdef CALLER_SAVES_D6
+#if defined(CALLER_SAVES_D6)
callerSaves (DoubleReg 6) = True
#endif
-#ifdef CALLER_SAVES_L1
+#if defined(CALLER_SAVES_L1)
callerSaves (LongReg 1) = True
#endif
-#ifdef CALLER_SAVES_Sp
+#if defined(CALLER_SAVES_Sp)
callerSaves Sp = True
#endif
-#ifdef CALLER_SAVES_SpLim
+#if defined(CALLER_SAVES_SpLim)
callerSaves SpLim = True
#endif
-#ifdef CALLER_SAVES_Hp
+#if defined(CALLER_SAVES_Hp)
callerSaves Hp = True
#endif
-#ifdef CALLER_SAVES_HpLim
+#if defined(CALLER_SAVES_HpLim)
callerSaves HpLim = True
#endif
-#ifdef CALLER_SAVES_CCCS
+#if defined(CALLER_SAVES_CCCS)
callerSaves CCCS = True
#endif
-#ifdef CALLER_SAVES_CurrentTSO
+#if defined(CALLER_SAVES_CurrentTSO)
callerSaves CurrentTSO = True
#endif
-#ifdef CALLER_SAVES_CurrentNursery
+#if defined(CALLER_SAVES_CurrentNursery)
callerSaves CurrentNursery = True
#endif
callerSaves _ = False
activeStgRegs :: [GlobalReg]
activeStgRegs = [
-#ifdef REG_Base
+#if defined(REG_Base)
BaseReg
#endif
-#ifdef REG_Sp
+#if defined(REG_Sp)
,Sp
#endif
-#ifdef REG_Hp
+#if defined(REG_Hp)
,Hp
#endif
-#ifdef REG_R1
+#if defined(REG_R1)
,VanillaReg 1 VGcPtr
#endif
-#ifdef REG_R2
+#if defined(REG_R2)
,VanillaReg 2 VGcPtr
#endif
-#ifdef REG_R3
+#if defined(REG_R3)
,VanillaReg 3 VGcPtr
#endif
-#ifdef REG_R4
+#if defined(REG_R4)
,VanillaReg 4 VGcPtr
#endif
-#ifdef REG_R5
+#if defined(REG_R5)
,VanillaReg 5 VGcPtr
#endif
-#ifdef REG_R6
+#if defined(REG_R6)
,VanillaReg 6 VGcPtr
#endif
-#ifdef REG_R7
+#if defined(REG_R7)
,VanillaReg 7 VGcPtr
#endif
-#ifdef REG_R8
+#if defined(REG_R8)
,VanillaReg 8 VGcPtr
#endif
-#ifdef REG_R9
+#if defined(REG_R9)
,VanillaReg 9 VGcPtr
#endif
-#ifdef REG_R10
+#if defined(REG_R10)
,VanillaReg 10 VGcPtr
#endif
-#ifdef REG_SpLim
+#if defined(REG_SpLim)
,SpLim
#endif
#if MAX_REAL_XMM_REG != 0
-#ifdef REG_F1
+#if defined(REG_F1)
,FloatReg 1
#endif
-#ifdef REG_D1
+#if defined(REG_D1)
,DoubleReg 1
#endif
-#ifdef REG_XMM1
+#if defined(REG_XMM1)
,XmmReg 1
#endif
-#ifdef REG_YMM1
+#if defined(REG_YMM1)
,YmmReg 1
#endif
-#ifdef REG_ZMM1
+#if defined(REG_ZMM1)
,ZmmReg 1
#endif
-#ifdef REG_F2
+#if defined(REG_F2)
,FloatReg 2
#endif
-#ifdef REG_D2
+#if defined(REG_D2)
,DoubleReg 2
#endif
-#ifdef REG_XMM2
+#if defined(REG_XMM2)
,XmmReg 2
#endif
-#ifdef REG_YMM2
+#if defined(REG_YMM2)
,YmmReg 2
#endif
-#ifdef REG_ZMM2
+#if defined(REG_ZMM2)
,ZmmReg 2
#endif
-#ifdef REG_F3
+#if defined(REG_F3)
,FloatReg 3
#endif
-#ifdef REG_D3
+#if defined(REG_D3)
,DoubleReg 3
#endif
-#ifdef REG_XMM3
+#if defined(REG_XMM3)
,XmmReg 3
#endif
-#ifdef REG_YMM3
+#if defined(REG_YMM3)
,YmmReg 3
#endif
-#ifdef REG_ZMM3
+#if defined(REG_ZMM3)
,ZmmReg 3
#endif
-#ifdef REG_F4
+#if defined(REG_F4)
,FloatReg 4
#endif
-#ifdef REG_D4
+#if defined(REG_D4)
,DoubleReg 4
#endif
-#ifdef REG_XMM4
+#if defined(REG_XMM4)
,XmmReg 4
#endif
-#ifdef REG_YMM4
+#if defined(REG_YMM4)
,YmmReg 4
#endif
-#ifdef REG_ZMM4
+#if defined(REG_ZMM4)
,ZmmReg 4
#endif
-#ifdef REG_F5
+#if defined(REG_F5)
,FloatReg 5
#endif
-#ifdef REG_D5
+#if defined(REG_D5)
,DoubleReg 5
#endif
-#ifdef REG_XMM5
+#if defined(REG_XMM5)
,XmmReg 5
#endif
-#ifdef REG_YMM5
+#if defined(REG_YMM5)
,YmmReg 5
#endif
-#ifdef REG_ZMM5
+#if defined(REG_ZMM5)
,ZmmReg 5
#endif
-#ifdef REG_F6
+#if defined(REG_F6)
,FloatReg 6
#endif
-#ifdef REG_D6
+#if defined(REG_D6)
,DoubleReg 6
#endif
-#ifdef REG_XMM6
+#if defined(REG_XMM6)
,XmmReg 6
#endif
-#ifdef REG_YMM6
+#if defined(REG_YMM6)
,YmmReg 6
#endif
-#ifdef REG_ZMM6
+#if defined(REG_ZMM6)
,ZmmReg 6
#endif
#else /* MAX_REAL_XMM_REG == 0 */
-#ifdef REG_F1
+#if defined(REG_F1)
,FloatReg 1
#endif
-#ifdef REG_F2
+#if defined(REG_F2)
,FloatReg 2
#endif
-#ifdef REG_F3
+#if defined(REG_F3)
,FloatReg 3
#endif
-#ifdef REG_F4
+#if defined(REG_F4)
,FloatReg 4
#endif
-#ifdef REG_F5
+#if defined(REG_F5)
,FloatReg 5
#endif
-#ifdef REG_F6
+#if defined(REG_F6)
,FloatReg 6
#endif
-#ifdef REG_D1
+#if defined(REG_D1)
,DoubleReg 1
#endif
-#ifdef REG_D2
+#if defined(REG_D2)
,DoubleReg 2
#endif
-#ifdef REG_D3
+#if defined(REG_D3)
,DoubleReg 3
#endif
-#ifdef REG_D4
+#if defined(REG_D4)
,DoubleReg 4
#endif
-#ifdef REG_D5
+#if defined(REG_D5)
,DoubleReg 5
#endif
-#ifdef REG_D6
+#if defined(REG_D6)
,DoubleReg 6
#endif
#endif /* MAX_REAL_XMM_REG == 0 */
]
haveRegBase :: Bool
-#ifdef REG_Base
+#if defined(REG_Base)
haveRegBase = True
#else
haveRegBase = False
@@ -636,58 +636,58 @@ globalRegMaybe :: GlobalReg -> Maybe RealReg
#if defined(MACHREGS_i386) || defined(MACHREGS_x86_64) \
|| defined(MACHREGS_sparc) || defined(MACHREGS_powerpc) \
|| defined(MACHREGS_arm) || defined(MACHREGS_aarch64)
-# ifdef REG_Base
+# if defined(REG_Base)
globalRegMaybe BaseReg = Just (RealRegSingle REG_Base)
# endif
-# ifdef REG_R1
+# if defined(REG_R1)
globalRegMaybe (VanillaReg 1 _) = Just (RealRegSingle REG_R1)
# endif
-# ifdef REG_R2
+# if defined(REG_R2)
globalRegMaybe (VanillaReg 2 _) = Just (RealRegSingle REG_R2)
# endif
-# ifdef REG_R3
+# if defined(REG_R3)
globalRegMaybe (VanillaReg 3 _) = Just (RealRegSingle REG_R3)
# endif
-# ifdef REG_R4
+# if defined(REG_R4)
globalRegMaybe (VanillaReg 4 _) = Just (RealRegSingle REG_R4)
# endif
-# ifdef REG_R5
+# if defined(REG_R5)
globalRegMaybe (VanillaReg 5 _) = Just (RealRegSingle REG_R5)
# endif
-# ifdef REG_R6
+# if defined(REG_R6)
globalRegMaybe (VanillaReg 6 _) = Just (RealRegSingle REG_R6)
# endif
-# ifdef REG_R7
+# if defined(REG_R7)
globalRegMaybe (VanillaReg 7 _) = Just (RealRegSingle REG_R7)
# endif
-# ifdef REG_R8
+# if defined(REG_R8)
globalRegMaybe (VanillaReg 8 _) = Just (RealRegSingle REG_R8)
# endif
-# ifdef REG_R9
+# if defined(REG_R9)
globalRegMaybe (VanillaReg 9 _) = Just (RealRegSingle REG_R9)
# endif
-# ifdef REG_R10
+# if defined(REG_R10)
globalRegMaybe (VanillaReg 10 _) = Just (RealRegSingle REG_R10)
# endif
-# ifdef REG_F1
+# if defined(REG_F1)
globalRegMaybe (FloatReg 1) = Just (RealRegSingle REG_F1)
# endif
-# ifdef REG_F2
+# if defined(REG_F2)
globalRegMaybe (FloatReg 2) = Just (RealRegSingle REG_F2)
# endif
-# ifdef REG_F3
+# if defined(REG_F3)
globalRegMaybe (FloatReg 3) = Just (RealRegSingle REG_F3)
# endif
-# ifdef REG_F4
+# if defined(REG_F4)
globalRegMaybe (FloatReg 4) = Just (RealRegSingle REG_F4)
# endif
-# ifdef REG_F5
+# if defined(REG_F5)
globalRegMaybe (FloatReg 5) = Just (RealRegSingle REG_F5)
# endif
-# ifdef REG_F6
+# if defined(REG_F6)
globalRegMaybe (FloatReg 6) = Just (RealRegSingle REG_F6)
# endif
-# ifdef REG_D1
+# if defined(REG_D1)
globalRegMaybe (DoubleReg 1) =
# if defined(MACHREGS_sparc)
Just (RealRegPair REG_D1 (REG_D1 + 1))
@@ -695,7 +695,7 @@ globalRegMaybe (DoubleReg 1) =
Just (RealRegSingle REG_D1)
# endif
# endif
-# ifdef REG_D2
+# if defined(REG_D2)
globalRegMaybe (DoubleReg 2) =
# if defined(MACHREGS_sparc)
Just (RealRegPair REG_D2 (REG_D2 + 1))
@@ -703,7 +703,7 @@ globalRegMaybe (DoubleReg 2) =
Just (RealRegSingle REG_D2)
# endif
# endif
-# ifdef REG_D3
+# if defined(REG_D3)
globalRegMaybe (DoubleReg 3) =
# if defined(MACHREGS_sparc)
Just (RealRegPair REG_D3 (REG_D3 + 1))
@@ -711,7 +711,7 @@ globalRegMaybe (DoubleReg 3) =
Just (RealRegSingle REG_D3)
# endif
# endif
-# ifdef REG_D4
+# if defined(REG_D4)
globalRegMaybe (DoubleReg 4) =
# if defined(MACHREGS_sparc)
Just (RealRegPair REG_D4 (REG_D4 + 1))
@@ -719,7 +719,7 @@ globalRegMaybe (DoubleReg 4) =
Just (RealRegSingle REG_D4)
# endif
# endif
-# ifdef REG_D5
+# if defined(REG_D5)
globalRegMaybe (DoubleReg 5) =
# if defined(MACHREGS_sparc)
Just (RealRegPair REG_D5 (REG_D5 + 1))
@@ -727,7 +727,7 @@ globalRegMaybe (DoubleReg 5) =
Just (RealRegSingle REG_D5)
# endif
# endif
-# ifdef REG_D6
+# if defined(REG_D6)
globalRegMaybe (DoubleReg 6) =
# if defined(MACHREGS_sparc)
Just (RealRegPair REG_D6 (REG_D6 + 1))
@@ -736,90 +736,90 @@ globalRegMaybe (DoubleReg 6) =
# endif
# endif
# if MAX_REAL_XMM_REG != 0
-# ifdef REG_XMM1
+# if defined(REG_XMM1)
globalRegMaybe (XmmReg 1) = Just (RealRegSingle REG_XMM1)
# endif
-# ifdef REG_XMM2
+# if defined(REG_XMM2)
globalRegMaybe (XmmReg 2) = Just (RealRegSingle REG_XMM2)
# endif
-# ifdef REG_XMM3
+# if defined(REG_XMM3)
globalRegMaybe (XmmReg 3) = Just (RealRegSingle REG_XMM3)
# endif
-# ifdef REG_XMM4
+# if defined(REG_XMM4)
globalRegMaybe (XmmReg 4) = Just (RealRegSingle REG_XMM4)
# endif
-# ifdef REG_XMM5
+# if defined(REG_XMM5)
globalRegMaybe (XmmReg 5) = Just (RealRegSingle REG_XMM5)
# endif
-# ifdef REG_XMM6
+# if defined(REG_XMM6)
globalRegMaybe (XmmReg 6) = Just (RealRegSingle REG_XMM6)
# endif
# endif
# if defined(MAX_REAL_YMM_REG) && MAX_REAL_YMM_REG != 0
-# ifdef REG_YMM1
+# if defined(REG_YMM1)
globalRegMaybe (YmmReg 1) = Just (RealRegSingle REG_YMM1)
# endif
-# ifdef REG_YMM2
+# if defined(REG_YMM2)
globalRegMaybe (YmmReg 2) = Just (RealRegSingle REG_YMM2)
# endif
-# ifdef REG_YMM3
+# if defined(REG_YMM3)
globalRegMaybe (YmmReg 3) = Just (RealRegSingle REG_YMM3)
# endif
-# ifdef REG_YMM4
+# if defined(REG_YMM4)
globalRegMaybe (YmmReg 4) = Just (RealRegSingle REG_YMM4)
# endif
-# ifdef REG_YMM5
+# if defined(REG_YMM5)
globalRegMaybe (YmmReg 5) = Just (RealRegSingle REG_YMM5)
# endif
-# ifdef REG_YMM6
+# if defined(REG_YMM6)
globalRegMaybe (YmmReg 6) = Just (RealRegSingle REG_YMM6)
# endif
# endif
# if defined(MAX_REAL_ZMM_REG) && MAX_REAL_ZMM_REG != 0
-# ifdef REG_ZMM1
+# if defined(REG_ZMM1)
globalRegMaybe (ZmmReg 1) = Just (RealRegSingle REG_ZMM1)
# endif
-# ifdef REG_ZMM2
+# if defined(REG_ZMM2)
globalRegMaybe (ZmmReg 2) = Just (RealRegSingle REG_ZMM2)
# endif
-# ifdef REG_ZMM3
+# if defined(REG_ZMM3)
globalRegMaybe (ZmmReg 3) = Just (RealRegSingle REG_ZMM3)
# endif
-# ifdef REG_ZMM4
+# if defined(REG_ZMM4)
globalRegMaybe (ZmmReg 4) = Just (RealRegSingle REG_ZMM4)
# endif
-# ifdef REG_ZMM5
+# if defined(REG_ZMM5)
globalRegMaybe (ZmmReg 5) = Just (RealRegSingle REG_ZMM5)
# endif
-# ifdef REG_ZMM6
+# if defined(REG_ZMM6)
globalRegMaybe (ZmmReg 6) = Just (RealRegSingle REG_ZMM6)
# endif
# endif
-# ifdef REG_Sp
+# if defined(REG_Sp)
globalRegMaybe Sp = Just (RealRegSingle REG_Sp)
# endif
-# ifdef REG_Lng1
+# if defined(REG_Lng1)
globalRegMaybe (LongReg 1) = Just (RealRegSingle REG_Lng1)
# endif
-# ifdef REG_Lng2
+# if defined(REG_Lng2)
globalRegMaybe (LongReg 2) = Just (RealRegSingle REG_Lng2)
# endif
-# ifdef REG_SpLim
+# if defined(REG_SpLim)
globalRegMaybe SpLim = Just (RealRegSingle REG_SpLim)
# endif
-# ifdef REG_Hp
+# if defined(REG_Hp)
globalRegMaybe Hp = Just (RealRegSingle REG_Hp)
# endif
-# ifdef REG_HpLim
+# if defined(REG_HpLim)
globalRegMaybe HpLim = Just (RealRegSingle REG_HpLim)
# endif
-# ifdef REG_CurrentTSO
+# if defined(REG_CurrentTSO)
globalRegMaybe CurrentTSO = Just (RealRegSingle REG_CurrentTSO)
# endif
-# ifdef REG_CurrentNursery
+# if defined(REG_CurrentNursery)
globalRegMaybe CurrentNursery = Just (RealRegSingle REG_CurrentNursery)
# endif
-# ifdef REG_MachSp
+# if defined(REG_MachSp)
globalRegMaybe MachSp = Just (RealRegSingle REG_MachSp)
# endif
globalRegMaybe _ = Nothing
@@ -860,19 +860,19 @@ Hence, on x86 esi and edi are treated as not allocatable.
freeReg r = freeRegBase r
freeRegBase :: RegNo -> Bool
-# ifdef REG_Base
+# if defined(REG_Base)
freeRegBase REG_Base = False
# endif
-# ifdef REG_Sp
+# if defined(REG_Sp)
freeRegBase REG_Sp = False
# endif
-# ifdef REG_SpLim
+# if defined(REG_SpLim)
freeRegBase REG_SpLim = False
# endif
-# ifdef REG_Hp
+# if defined(REG_Hp)
freeRegBase REG_Hp = False
# endif
-# ifdef REG_HpLim
+# if defined(REG_HpLim)
freeRegBase REG_HpLim = False
# endif
-- All other regs are considered to be "free", because we can track
@@ -901,88 +901,88 @@ freeReg 30 = False
-}
# endif
-# ifdef REG_Base
+# if defined(REG_Base)
freeReg REG_Base = False
# endif
-# ifdef REG_R1
+# if defined(REG_R1)
freeReg REG_R1 = False
# endif
-# ifdef REG_R2
+# if defined(REG_R2)
freeReg REG_R2 = False
# endif
-# ifdef REG_R3
+# if defined(REG_R3)
freeReg REG_R3 = False
# endif
-# ifdef REG_R4
+# if defined(REG_R4)
freeReg REG_R4 = False
# endif
-# ifdef REG_R5
+# if defined(REG_R5)
freeReg REG_R5 = False
# endif
-# ifdef REG_R6
+# if defined(REG_R6)
freeReg REG_R6 = False
# endif
-# ifdef REG_R7
+# if defined(REG_R7)
freeReg REG_R7 = False
# endif
-# ifdef REG_R8
+# if defined(REG_R8)
freeReg REG_R8 = False
# endif
-# ifdef REG_R9
+# if defined(REG_R9)
freeReg REG_R9 = False
# endif
-# ifdef REG_R10
+# if defined(REG_R10)
freeReg REG_R10 = False
# endif
-# ifdef REG_F1
+# if defined(REG_F1)
freeReg REG_F1 = False
# endif
-# ifdef REG_F2
+# if defined(REG_F2)
freeReg REG_F2 = False
# endif
-# ifdef REG_F3
+# if defined(REG_F3)
freeReg REG_F3 = False
# endif
-# ifdef REG_F4
+# if defined(REG_F4)
freeReg REG_F4 = False
# endif
-# ifdef REG_F5
+# if defined(REG_F5)
freeReg REG_F5 = False
# endif
-# ifdef REG_F6
+# if defined(REG_F6)
freeReg REG_F6 = False
# endif
-# ifdef REG_D1
+# if defined(REG_D1)
freeReg REG_D1 = False
# endif
-# ifdef REG_D2
+# if defined(REG_D2)
freeReg REG_D2 = False
# endif
-# ifdef REG_D3
+# if defined(REG_D3)
freeReg REG_D3 = False
# endif
-# ifdef REG_D4
+# if defined(REG_D4)
freeReg REG_D4 = False
# endif
-# ifdef REG_D5
+# if defined(REG_D5)
freeReg REG_D5 = False
# endif
-# ifdef REG_D6
+# if defined(REG_D6)
freeReg REG_D6 = False
# endif
-# ifdef REG_Sp
+# if defined(REG_Sp)
freeReg REG_Sp = False
# endif
-# ifdef REG_Su
+# if defined(REG_Su)
freeReg REG_Su = False
# endif
-# ifdef REG_SpLim
+# if defined(REG_SpLim)
freeReg REG_SpLim = False
# endif
-# ifdef REG_Hp
+# if defined(REG_Hp)
freeReg REG_Hp = False
# endif
-# ifdef REG_HpLim
+# if defined(REG_HpLim)
freeReg REG_HpLim = False
# endif
freeReg _ = True
@@ -1029,106 +1029,106 @@ freeReg regNo
= False
-}
-# ifdef REG_Base
+# if defined(REG_Base)
freeReg REG_Base = False
# endif
-# ifdef REG_R1
+# if defined(REG_R1)
freeReg REG_R1 = False
# endif
-# ifdef REG_R2
+# if defined(REG_R2)
freeReg REG_R2 = False
# endif
-# ifdef REG_R3
+# if defined(REG_R3)
freeReg REG_R3 = False
# endif
-# ifdef REG_R4
+# if defined(REG_R4)
freeReg REG_R4 = False
# endif
-# ifdef REG_R5
+# if defined(REG_R5)
freeReg REG_R5 = False
# endif
-# ifdef REG_R6
+# if defined(REG_R6)
freeReg REG_R6 = False
# endif
-# ifdef REG_R7
+# if defined(REG_R7)
freeReg REG_R7 = False
# endif
-# ifdef REG_R8
+# if defined(REG_R8)
freeReg REG_R8 = False
# endif
-# ifdef REG_R9
+# if defined(REG_R9)
freeReg REG_R9 = False
# endif
-# ifdef REG_R10
+# if defined(REG_R10)
freeReg REG_R10 = False
# endif
-# ifdef REG_F1
+# if defined(REG_F1)
freeReg REG_F1 = False
# endif
-# ifdef REG_F2
+# if defined(REG_F2)
freeReg REG_F2 = False
# endif
-# ifdef REG_F3
+# if defined(REG_F3)
freeReg REG_F3 = False
# endif
-# ifdef REG_F4
+# if defined(REG_F4)
freeReg REG_F4 = False
# endif
-# ifdef REG_F5
+# if defined(REG_F5)
freeReg REG_F5 = False
# endif
-# ifdef REG_F6
+# if defined(REG_F6)
freeReg REG_F6 = False
# endif
-# ifdef REG_D1
+# if defined(REG_D1)
freeReg REG_D1 = False
# endif
-# ifdef REG_D1_2
+# if defined(REG_D1_2)
freeReg REG_D1_2 = False
# endif
-# ifdef REG_D2
+# if defined(REG_D2)
freeReg REG_D2 = False
# endif
-# ifdef REG_D2_2
+# if defined(REG_D2_2)
freeReg REG_D2_2 = False
# endif
-# ifdef REG_D3
+# if defined(REG_D3)
freeReg REG_D3 = False
# endif
-# ifdef REG_D3_2
+# if defined(REG_D3_2)
freeReg REG_D3_2 = False
# endif
-# ifdef REG_D4
+# if defined(REG_D4)
freeReg REG_D4 = False
# endif
-# ifdef REG_D4_2
+# if defined(REG_D4_2)
freeReg REG_D4_2 = False
# endif
-# ifdef REG_D5
+# if defined(REG_D5)
freeReg REG_D5 = False
# endif
-# ifdef REG_D5_2
+# if defined(REG_D5_2)
freeReg REG_D5_2 = False
# endif
-# ifdef REG_D6
+# if defined(REG_D6)
freeReg REG_D6 = False
# endif
-# ifdef REG_D6_2
+# if defined(REG_D6_2)
freeReg REG_D6_2 = False
# endif
-# ifdef REG_Sp
+# if defined(REG_Sp)
freeReg REG_Sp = False
# endif
-# ifdef REG_Su
+# if defined(REG_Su)
freeReg REG_Su = False
# endif
-# ifdef REG_SpLim
+# if defined(REG_SpLim)
freeReg REG_SpLim = False
# endif
-# ifdef REG_Hp
+# if defined(REG_Hp)
freeReg REG_Hp = False
# endif
-# ifdef REG_HpLim
+# if defined(REG_HpLim)
freeReg REG_HpLim = False
# endif
freeReg _ = True
diff --git a/includes/HsFFI.h b/includes/HsFFI.h
index bee942c44c..dea365cb65 100644
--- a/includes/HsFFI.h
+++ b/includes/HsFFI.h
@@ -11,7 +11,7 @@
#pragma once
-#ifdef __cplusplus
+#if defined(__cplusplus)
extern "C" {
#endif
@@ -118,6 +118,6 @@ extern void hs_try_putmvar (int capability, HsStablePtr sp);
-#ifdef __cplusplus
+#if defined(__cplusplus)
}
#endif
diff --git a/includes/MachDeps.h b/includes/MachDeps.h
index 778975ea3c..2be4ee0b4f 100644
--- a/includes/MachDeps.h
+++ b/includes/MachDeps.h
@@ -100,7 +100,7 @@
#define SIZEOF_WORD64 SIZEOF_UINT64_T
#define ALIGNMENT_WORD64 ALIGNMENT_UINT64_T
-#ifndef WORD_SIZE_IN_BITS
+#if !defined(WORD_SIZE_IN_BITS)
#if SIZEOF_HSWORD == 4
#define WORD_SIZE_IN_BITS 32
#define WORD_SIZE_IN_BITS_FLOAT 32.0
@@ -110,7 +110,7 @@
#endif
#endif
-#ifndef TAG_BITS
+#if !defined(TAG_BITS)
#if SIZEOF_HSWORD == 4
#define TAG_BITS 2
#else
diff --git a/includes/Rts.h b/includes/Rts.h
index b36fc94a5e..aca24e4f28 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -12,7 +12,7 @@
#pragma once
-#ifdef __cplusplus
+#if defined(__cplusplus)
extern "C" {
#endif
@@ -23,7 +23,7 @@ extern "C" {
#include <windows.h>
#endif
-#ifndef IN_STG_CODE
+#if !defined(IN_STG_CODE)
#define IN_STG_CODE 0
#endif
#include "Stg.h"
@@ -32,7 +32,7 @@ extern "C" {
#include "RtsAPI.h"
// Turn off inlining when debugging - it obfuscates things
-#ifdef DEBUG
+#if defined(DEBUG)
# undef STATIC_INLINE
# define STATIC_INLINE static
#endif
@@ -69,13 +69,13 @@ extern "C" {
#endif
/* Fix for mingw stat problem (done here so it's early enough) */
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
#define __MSVCRT__ 1
#endif
/* Needed to get the macro version of errno on some OSs, and also to
get prototypes for the _r versions of C library functions. */
-#ifndef _REENTRANT
+#if !defined(_REENTRANT)
#define _REENTRANT 1
#endif
@@ -109,7 +109,7 @@ void _assertFail(const char *filename, unsigned int linenum)
else \
barf(msg, ##__VA_ARGS__)
-#ifndef DEBUG
+#if !defined(DEBUG)
#define ASSERT(predicate) /* nothing */
#define ASSERTM(predicate,msg,...) /* nothing */
#else
@@ -125,7 +125,7 @@ void _assertFail(const char *filename, unsigned int linenum)
#define doNothing() do { } while (0)
-#ifdef DEBUG
+#if defined(DEBUG)
#define USED_IF_DEBUG
#define USED_IF_NOT_DEBUG STG_UNUSED
#else
@@ -133,7 +133,7 @@ void _assertFail(const char *filename, unsigned int linenum)
#define USED_IF_NOT_DEBUG
#endif
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
#define USED_IF_THREADS
#define USED_IF_NOT_THREADS STG_UNUSED
#else
@@ -211,7 +211,7 @@ DLL_IMPORT_RTS extern char **prog_argv; /* so we can get at these from Haskell *
DLL_IMPORT_RTS extern int prog_argc;
DLL_IMPORT_RTS extern char *prog_name;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
// We need these two from Haskell too
void getWin32ProgArgv(int *argc, wchar_t **argv[]);
void setWin32ProgArgv(int argc, wchar_t *argv[]);
@@ -222,7 +222,7 @@ void reportHeapOverflow(void);
void stg_exit(int n) GNU_ATTRIBUTE(__noreturn__);
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
int stg_sig_install (int, int, void *);
#endif
@@ -251,7 +251,7 @@ int rts_isDynamic(void);
Miscellaneous garbage
-------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
#define TICK_VAR(arity) \
extern StgInt SLOW_CALLS_##arity; \
extern StgInt RIGHT_ARITY_##arity; \
@@ -269,7 +269,7 @@ TICK_VAR(2)
#define IF_RTSFLAGS(c,s) if (RtsFlags.c) { s; } doNothing()
-#ifdef DEBUG
+#if defined(DEBUG)
#if IN_STG_CODE
#define IF_DEBUG(c,s) if (RtsFlags[0].DebugFlags.c) { s; } doNothing()
#else
@@ -279,13 +279,13 @@ TICK_VAR(2)
#define IF_DEBUG(c,s) doNothing()
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
#define DEBUG_ONLY(s) s
#else
#define DEBUG_ONLY(s) doNothing()
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
#define DEBUG_IS_ON 1
#else
#define DEBUG_IS_ON 0
@@ -309,6 +309,6 @@ TICK_VAR(2)
/* -------------------------------------------------------------------------- */
-#ifdef __cplusplus
+#if defined(__cplusplus)
}
#endif
diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h
index f9b561800d..f1c04fa360 100644
--- a/includes/RtsAPI.h
+++ b/includes/RtsAPI.h
@@ -11,7 +11,7 @@
#pragma once
-#ifdef __cplusplus
+#if defined(__cplusplus)
extern "C" {
#endif
@@ -236,7 +236,7 @@ extern void hs_init_ghc (int *argc, char **argv[], // program arguments
extern void shutdownHaskellAndExit (int exitCode, int fastExit)
GNUC3_ATTRIBUTE(__noreturn__);
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
extern void shutdownHaskellAndSignal (int sig, int fastExit)
GNUC3_ATTRIBUTE(__noreturn__);
#endif
@@ -441,6 +441,6 @@ extern StgWord base_GHCziTopHandler_runNonIO_closure[];
/* ------------------------------------------------------------------------ */
-#ifdef __cplusplus
+#if defined(__cplusplus)
}
#endif
diff --git a/includes/Stg.h b/includes/Stg.h
index a0886ef727..df71e4e7df 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -40,7 +40,7 @@
* IN_STG_CODE is not defined, and the register variables will not be
* active.
*/
-#ifndef IN_STG_CODE
+#if !defined(IN_STG_CODE)
# define IN_STG_CODE 1
// Turn on C99 for .hc code. This gives us the INFINITY and NAN
@@ -154,7 +154,7 @@
# define FORCE_GNU_INLINE 1
#endif
-#ifdef FORCE_GNU_INLINE
+#if defined(FORCE_GNU_INLINE)
// Force compiler into gnu90 semantics
# if defined(KEEP_INLINES)
# define EXTERN_INLINE inline __attribute__((gnu_inline))
@@ -524,7 +524,7 @@ INLINE_HEADER StgInt64 PK_Int64(W_ p_src[])
#if SIZEOF_VOID_P == 4
-#ifdef WORDS_BIGENDIAN
+#if defined(WORDS_BIGENDIAN)
#define RTS_CARRY_IDX__ 0
#define RTS_REM_IDX__ 1
#else
diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h
index 160aa19303..b63f842008 100644
--- a/includes/rts/EventLogFormat.h
+++ b/includes/rts/EventLogFormat.h
@@ -230,7 +230,7 @@
#define CAPSET_TYPE_OSPROCESS 2 /* caps belong to the same OS process */
#define CAPSET_TYPE_CLOCKDOMAIN 3 /* caps share a local clock/time */
-#ifndef EVENTLOG_CONSTANTS_ONLY
+#if !defined(EVENTLOG_CONSTANTS_ONLY)
typedef StgWord16 EventTypeNum;
typedef StgWord64 EventTimestamp; /* in nanoseconds */
diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h
index 405fce166d..6700f9d95f 100644
--- a/includes/rts/Flags.h
+++ b/includes/rts/Flags.h
@@ -245,7 +245,7 @@ typedef struct _RTS_FLAGS {
PAR_FLAGS ParFlags;
} RTS_FLAGS;
-#ifdef COMPILING_RTS_MAIN
+#if defined(COMPILING_RTS_MAIN)
extern DLLIMPORT RTS_FLAGS RtsFlags;
#elif IN_STG_CODE
/* Hack because the C code generator can't generate '&label'. */
diff --git a/includes/rts/OSThreads.h b/includes/rts/OSThreads.h
index 520d592ec6..abb3120088 100644
--- a/includes/rts/OSThreads.h
+++ b/includes/rts/OSThreads.h
@@ -16,7 +16,7 @@
#if defined(HAVE_PTHREAD_H) && !defined(mingw32_HOST_OS)
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define OS_ACQUIRE_LOCK(mutex) foreign "C" pthread_mutex_lock(mutex)
#define OS_RELEASE_LOCK(mutex) foreign "C" pthread_mutex_unlock(mutex)
@@ -36,7 +36,7 @@ typedef pthread_key_t ThreadLocalKey;
#define INIT_COND_VAR PTHREAD_COND_INITIALIZER
-#ifdef LOCK_DEBUG
+#if defined(LOCK_DEBUG)
#define LOCK_DEBUG_BELCH(what, mutex) \
debugBelch("%s(0x%p) %s %d\n", what, mutex, __FILE__, __LINE__)
#else
@@ -75,7 +75,7 @@ EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex)
# elif defined(HAVE_WINDOWS_H)
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
/* We jump through a hoop here to get a CCall EnterCriticalSection
and LeaveCriticalSection, as that's what C-- wants. */
@@ -110,7 +110,7 @@ typedef DWORD ThreadLocalKey;
typedef CRITICAL_SECTION Mutex;
-#ifdef LOCK_DEBUG
+#if defined(LOCK_DEBUG)
#define OS_ACQUIRE_LOCK(mutex) \
debugBelch("ACQUIRE_LOCK(0x%p) %s %d\n", mutex,__FILE__,__LINE__); \
@@ -158,7 +158,7 @@ typedef HANDLE Mutex;
# endif
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
//
// General thread operations
//
@@ -202,7 +202,7 @@ void setThreadNode (uint32_t node);
void releaseThreadNode (void);
#endif // !CMINUSMINUS
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
#define ACQUIRE_LOCK(l) OS_ACQUIRE_LOCK(l)
#define RELEASE_LOCK(l) OS_RELEASE_LOCK(l)
@@ -216,7 +216,7 @@ void releaseThreadNode (void);
#endif /* defined(THREADED_RTS) */
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
//
// Support for forkOS (defined regardless of THREADED_RTS, but does
// nothing when !THREADED_RTS).
diff --git a/includes/rts/Threads.h b/includes/rts/Threads.h
index 17a64c1ba0..fceacdc75d 100644
--- a/includes/rts/Threads.h
+++ b/includes/rts/Threads.h
@@ -14,7 +14,7 @@
#pragma once
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
diff --git a/includes/rts/prof/LDV.h b/includes/rts/prof/LDV.h
index fdbab4d901..dc7a0cabdf 100644
--- a/includes/rts/prof/LDV.h
+++ b/includes/rts/prof/LDV.h
@@ -13,7 +13,7 @@
#pragma once
-#ifdef PROFILING
+#if defined(PROFILING)
/* retrieves the LDV word from closure c */
#define LDVW(c) (((StgClosure *)(c))->header.prof.hp.ldvw)
@@ -28,7 +28,7 @@
* to zero.
*/
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#else
diff --git a/includes/rts/storage/Block.h b/includes/rts/storage/Block.h
index 3c6f2b1fba..c1d251856a 100644
--- a/includes/rts/storage/Block.h
+++ b/includes/rts/storage/Block.h
@@ -24,7 +24,7 @@
#error "Size of pointer is suspicious."
#endif
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define BLOCK_SIZE (1<<BLOCK_SHIFT)
#else
#define BLOCK_SIZE (UNIT<<BLOCK_SHIFT)
@@ -39,7 +39,7 @@
/* Megablock related constants (MBLOCK_SHIFT is defined in Constants.h) */
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define MBLOCK_SIZE (1<<MBLOCK_SHIFT)
#else
#define MBLOCK_SIZE (UNIT<<MBLOCK_SHIFT)
@@ -83,7 +83,7 @@
// client of the block allocator API. All other fields can be
// freely modified.
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
typedef struct bdescr_ {
StgPtr start; // [READ ONLY] start addr of memory
@@ -160,7 +160,7 @@ typedef struct bdescr_ {
/* Finding the block descriptor for a given block -------------------------- */
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define Bdescr(p) \
((((p) & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT)) \
@@ -206,7 +206,7 @@ EXTERN_INLINE bdescr *Bdescr(StgPtr p)
/* Number of usable blocks in a megablock */
-#ifndef CMINUSMINUS // already defined in DerivedConstants.h
+#if !defined(CMINUSMINUS) // already defined in DerivedConstants.h
#define BLOCKS_PER_MBLOCK ((MBLOCK_SIZE - FIRST_BLOCK_OFF) / BLOCK_SIZE)
#endif
@@ -221,7 +221,7 @@ EXTERN_INLINE bdescr *Bdescr(StgPtr p)
(1 + (W_)MBLOCK_ROUND_UP((n-BLOCKS_PER_MBLOCK) * BLOCK_SIZE) / MBLOCK_SIZE)
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
/* to the end... */
/* Double-linked block lists: --------------------------------------------- */
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h
index af77df37b5..be1569ba8e 100644
--- a/includes/rts/storage/ClosureMacros.h
+++ b/includes/rts/storage/ClosureMacros.h
@@ -54,7 +54,7 @@ INLINE_HEADER const StgInfoTable *GET_INFO(StgClosure *c) {
#define GET_ENTRY(c) (ENTRY_CODE(GET_INFO(c)))
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info);
EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgInfoTable *)info - 1;}
EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info);
@@ -116,8 +116,8 @@ INLINE_HEADER StgHalfWord GET_TAG(const StgClosure *con)
Macros for building closures
-------------------------------------------------------------------------- */
-#ifdef PROFILING
-#ifdef DEBUG_RETAINER
+#if defined(PROFILING)
+#if defined(DEBUG_RETAINER)
/*
For the sake of debugging, we take the safest way for the moment. Actually, this
is useful to check the sanity of heap before beginning retainer profiling.
@@ -540,7 +540,7 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n)
#define OVERWRITING_CLOSURE_OFS(c,n) /* nothing */
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
void LDV_recordDead (const StgClosure *c, uint32_t size);
#endif
diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h
index f5baead002..af89507f97 100644
--- a/includes/rts/storage/Closures.h
+++ b/includes/rts/storage/Closures.h
@@ -51,14 +51,14 @@ typedef struct {
typedef struct {
const StgInfoTable* info;
-#ifdef PROFILING
+#if defined(PROFILING)
StgProfHeader prof;
#endif
} StgHeader;
typedef struct {
const StgInfoTable* info;
-#ifdef PROFILING
+#if defined(PROFILING)
StgProfHeader prof;
#endif
StgSMPThunkHeader smp;
diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h
index 3201c105e1..c621e5e749 100644
--- a/includes/rts/storage/InfoTables.h
+++ b/includes/rts/storage/InfoTables.h
@@ -27,7 +27,7 @@
hackery can go away sometime.
------------------------------------------------------------------------- */
-#ifdef x86_64_TARGET_ARCH
+#if defined(x86_64_TARGET_ARCH)
#define OFFSET_FIELD(n) StgHalfInt n; StgHalfWord __pad_##n
#else
#define OFFSET_FIELD(n) StgInt n
@@ -38,7 +38,7 @@
-------------------------------------------------------------------------- */
typedef struct {
-#ifndef TABLES_NEXT_TO_CODE
+#if !defined(TABLES_NEXT_TO_CODE)
char *closure_type;
char *closure_desc;
#else
@@ -167,7 +167,7 @@ typedef union {
StgWord bitmap; /* word-sized bit pattern describing */
/* a stack frame: see below */
-#ifndef TABLES_NEXT_TO_CODE
+#if !defined(TABLES_NEXT_TO_CODE)
StgLargeBitmap* large_bitmap; /* pointer to large bitmap structure */
#else
OFFSET_FIELD(large_bitmap_offset); /* offset from info table to large bitmap structure */
@@ -187,7 +187,7 @@ typedef struct StgInfoTable_ {
StgFunPtr entry; /* pointer to the entry code */
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
StgProfInfo prof;
#endif
@@ -201,7 +201,7 @@ typedef struct StgInfoTable_ {
- a bitmap of SRT entries
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
StgCode code[];
#endif
} *StgInfoTablePtr; // StgInfoTable defined in rts/Types.h
@@ -339,7 +339,7 @@ typedef struct StgConInfoTable_ {
* GET_SRT(info)
* info must be a Stg[Ret|Thunk]InfoTable* (an info table that has a SRT)
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_SRT(info) ((StgSRT*) (((StgWord) ((info)+1)) + (info)->srt_offset))
#else
#define GET_SRT(info) ((info)->srt)
@@ -349,7 +349,7 @@ typedef struct StgConInfoTable_ {
* GET_CON_DESC(info)
* info must be a StgConInfoTable*.
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_CON_DESC(info) \
((const char *)((StgWord)((info)+1) + (info->con_desc)))
#else
@@ -360,20 +360,20 @@ typedef struct StgConInfoTable_ {
* GET_FUN_SRT(info)
* info must be a StgFunInfoTable*
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_FUN_SRT(info) ((StgSRT*) (((StgWord) ((info)+1)) + (info)->f.srt_offset))
#else
#define GET_FUN_SRT(info) ((info)->f.srt)
#endif
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_LARGE_BITMAP(info) ((StgLargeBitmap*) (((StgWord) ((info)+1)) \
+ (info)->layout.large_bitmap_offset))
#else
#define GET_LARGE_BITMAP(info) ((info)->layout.large_bitmap)
#endif
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_FUN_LARGE_BITMAP(info) ((StgLargeBitmap*) (((StgWord) ((info)+1)) \
+ (info)->f.b.bitmap_offset))
#else
@@ -383,12 +383,12 @@ typedef struct StgConInfoTable_ {
/*
* GET_PROF_TYPE, GET_PROF_DESC
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_PROF_TYPE(info) ((char *)((StgWord)((info)+1) + (info->prof.closure_type_off)))
#else
#define GET_PROF_TYPE(info) ((info)->prof.closure_type)
#endif
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_PROF_DESC(info) ((char *)((StgWord)((info)+1) + (info->prof.closure_desc_off)))
#else
#define GET_PROF_DESC(info) ((info)->prof.closure_desc)
diff --git a/includes/rts/storage/MBlock.h b/includes/rts/storage/MBlock.h
index 9fbe92ec7d..20aed08e82 100644
--- a/includes/rts/storage/MBlock.h
+++ b/includes/rts/storage/MBlock.h
@@ -26,7 +26,7 @@ extern void freeAllMBlocks(void);
extern void *getFirstMBlock(void **state);
extern void *getNextMBlock(void **state, void *mblock);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// needed for HEAP_ALLOCED below
extern SpinLock gc_alloc_block_sync;
#endif
diff --git a/includes/rts/storage/TSO.h b/includes/rts/storage/TSO.h
index e50e336a32..93018581fd 100644
--- a/includes/rts/storage/TSO.h
+++ b/includes/rts/storage/TSO.h
@@ -173,13 +173,13 @@ typedef struct StgTSO_ {
*/
StgWord32 tot_stack_size;
-#ifdef TICKY_TICKY
+#if defined(TICKY_TICKY)
/* TICKY-specific stuff would go here. */
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
StgTSOProfInfo prof;
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
StgWord32 saved_winerror;
#endif
diff --git a/includes/stg/DLL.h b/includes/stg/DLL.h
index cf857a8682..7ab3594ce1 100644
--- a/includes/stg/DLL.h
+++ b/includes/stg/DLL.h
@@ -46,7 +46,7 @@
sources are being processed. This is only the case when
using Win32 DLLs. ]
*/
-#ifdef COMPILING_RTS
+#if defined(COMPILING_RTS)
#define DLL_IMPORT DLLIMPORT
#define DLL_IMPORT_RTS
#define DLL_IMPORT_DATA_VAR(x) x
@@ -65,7 +65,7 @@
#endif
-#ifdef COMPILING_STDLIB
+#if defined(COMPILING_STDLIB)
#define DLL_IMPORT_STDLIB
#else
#define DLL_IMPORT_STDLIB DLLIMPORT
diff --git a/includes/stg/HaskellMachRegs.h b/includes/stg/HaskellMachRegs.h
index 89a2b95399..c92f6867c1 100644
--- a/includes/stg/HaskellMachRegs.h
+++ b/includes/stg/HaskellMachRegs.h
@@ -24,7 +24,7 @@
* the stack, and components of an unboxed tuple will be returned on
* the stack rather than in registers.
*/
-#ifdef NO_REGS
+#if defined(NO_REGS)
#define MACHREGS_NO_REGS 1
@@ -32,11 +32,11 @@
#define MACHREGS_NO_REGS 0
-#ifdef i386_TARGET_ARCH
+#if defined(i386_TARGET_ARCH)
#define MACHREGS_i386 1
#endif
-#ifdef x86_64_TARGET_ARCH
+#if defined(x86_64_TARGET_ARCH)
#define MACHREGS_x86_64 1
#endif
@@ -45,19 +45,19 @@
#define MACHREGS_powerpc 1
#endif
-#ifdef sparc_TARGET_ARCH
+#if defined(sparc_TARGET_ARCH)
#define MACHREGS_sparc 1
#endif
-#ifdef arm_TARGET_ARCH
+#if defined(arm_TARGET_ARCH)
#define MACHREGS_arm 1
#endif
-#ifdef aarch64_TARGET_ARCH
+#if defined(aarch64_TARGET_ARCH)
#define MACHREGS_aarch64 1
#endif
-#ifdef darwin_TARGET_OS
+#if defined(darwin_TARGET_OS)
#define MACHREGS_darwin 1
#endif
diff --git a/includes/stg/MachRegs.h b/includes/stg/MachRegs.h
index f58e49e626..eab4a306ed 100644
--- a/includes/stg/MachRegs.h
+++ b/includes/stg/MachRegs.h
@@ -81,16 +81,16 @@
Leaving SpLim out of the picture.
-------------------------------------------------------------------------- */
-#ifdef MACHREGS_i386
+#if defined(MACHREGS_i386)
#define REG(x) __asm__("%" #x)
-#ifndef not_doing_dynamic_linking
+#if !defined(not_doing_dynamic_linking)
#define REG_Base ebx
#endif
#define REG_Sp ebp
-#ifndef STOLEN_X86_REGS
+#if !defined(STOLEN_X86_REGS)
#define STOLEN_X86_REGS 4
#endif
@@ -315,7 +315,7 @@ the stack. See Note [Overlapping global registers] for implications.
#define REG_R7 r20
#define REG_R8 r21
-#ifdef MACHREGS_darwin
+#if defined(MACHREGS_darwin)
#define REG_F1 f14
#define REG_F2 f15
@@ -629,7 +629,7 @@ the stack. See Note [Overlapping global registers] for implications.
* communicate with PrimOps and RTS functions.
*/
-#ifndef MAX_REAL_VANILLA_REG
+#if !defined(MAX_REAL_VANILLA_REG)
# if defined(REG_R10)
# define MAX_REAL_VANILLA_REG 10
# elif defined(REG_R9)
@@ -655,7 +655,7 @@ the stack. See Note [Overlapping global registers] for implications.
# endif
#endif
-#ifndef MAX_REAL_FLOAT_REG
+#if !defined(MAX_REAL_FLOAT_REG)
# if defined(REG_F4)
# define MAX_REAL_FLOAT_REG 4
# elif defined(REG_F3)
@@ -669,7 +669,7 @@ the stack. See Note [Overlapping global registers] for implications.
# endif
#endif
-#ifndef MAX_REAL_DOUBLE_REG
+#if !defined(MAX_REAL_DOUBLE_REG)
# if defined(REG_D2)
# define MAX_REAL_DOUBLE_REG 2
# elif defined(REG_D1)
@@ -679,7 +679,7 @@ the stack. See Note [Overlapping global registers] for implications.
# endif
#endif
-#ifndef MAX_REAL_LONG_REG
+#if !defined(MAX_REAL_LONG_REG)
# if defined(REG_L1)
# define MAX_REAL_LONG_REG 1
# else
@@ -687,7 +687,7 @@ the stack. See Note [Overlapping global registers] for implications.
# endif
#endif
-#ifndef MAX_REAL_XMM_REG
+#if !defined(MAX_REAL_XMM_REG)
# if defined(REG_XMM6)
# define MAX_REAL_XMM_REG 6
# elif defined(REG_XMM5)
diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h
index 725323b395..4e8fe68bd6 100644
--- a/includes/stg/MiscClosures.h
+++ b/includes/stg/MiscClosures.h
@@ -35,7 +35,7 @@
# define RTS_FUN_DECL(f) extern DLL_IMPORT_RTS StgFunPtr f(void)
#endif
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
# define RTS_RET(f) RTS_INFO(f##_info)
# define RTS_ENTRY(f) RTS_INFO(f##_info)
# define RTS_FUN(f) RTS_FUN_INFO(f##_info)
@@ -318,7 +318,7 @@ RTS_RET(stg_block_takemvar);
RTS_RET(stg_block_readmvar);
RTS_FUN_DECL(stg_block_putmvar);
RTS_RET(stg_block_putmvar);
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
RTS_FUN_DECL(stg_block_async);
RTS_RET(stg_block_async);
RTS_FUN_DECL(stg_block_async_void);
@@ -395,7 +395,7 @@ RTS_FUN_DECL(stg_tryReadMVarzh);
RTS_FUN_DECL(stg_waitReadzh);
RTS_FUN_DECL(stg_waitWritezh);
RTS_FUN_DECL(stg_delayzh);
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
RTS_FUN_DECL(stg_asyncReadzh);
RTS_FUN_DECL(stg_asyncWritezh);
RTS_FUN_DECL(stg_asyncDoProczh);
diff --git a/includes/stg/RtsMachRegs.h b/includes/stg/RtsMachRegs.h
index 627bdfeebb..e1233a1a55 100644
--- a/includes/stg/RtsMachRegs.h
+++ b/includes/stg/RtsMachRegs.h
@@ -14,8 +14,8 @@
#pragma once
-#ifdef UnregisterisedCompiler
-#ifndef NO_REGS
+#if defined(UnregisterisedCompiler)
+#if !defined(NO_REGS)
#define NO_REGS
#endif
#endif
@@ -30,7 +30,7 @@
* the stack, and components of an unboxed tuple will be returned on
* the stack rather than in registers.
*/
-#ifdef NO_REGS
+#if defined(NO_REGS)
#define MACHREGS_NO_REGS 1
@@ -38,11 +38,11 @@
#define MACHREGS_NO_REGS 0
-#ifdef i386_HOST_ARCH
+#if defined(i386_HOST_ARCH)
#define MACHREGS_i386 1
#endif
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
#define MACHREGS_x86_64 1
#endif
@@ -51,19 +51,19 @@
#define MACHREGS_powerpc 1
#endif
-#ifdef sparc_HOST_ARCH
+#if defined(sparc_HOST_ARCH)
#define MACHREGS_sparc 1
#endif
-#ifdef arm_HOST_ARCH
+#if defined(arm_HOST_ARCH)
#define MACHREGS_arm 1
#endif
-#ifdef aarch64_HOST_ARCH
+#if defined(aarch64_HOST_ARCH)
#define MACHREGS_aarch64 1
#endif
-#ifdef darwin_HOST_OS
+#if defined(darwin_HOST_OS)
#define MACHREGS_darwin 1
#endif
diff --git a/includes/stg/Ticky.h b/includes/stg/Ticky.h
index 1e16a1ae08..5e2c372610 100644
--- a/includes/stg/Ticky.h
+++ b/includes/stg/Ticky.h
@@ -35,7 +35,7 @@ extern W_ top_ct[];
same declarations for both extern decls (which are included everywhere)
and initializations (which only happen once)
TICKY_C is defined only in rts/Ticky.c */
-#ifdef TICKY_C
+#if defined(TICKY_C)
#define INIT(ializer) = ializer
#define EXTERN
#else
@@ -197,8 +197,8 @@ EXTERN StgInt RET_UNBOXED_TUP_hst[TICKY_BIN_COUNT] INIT({0});
Note that these macros must be defined whether
TICKY_TICKY is defined or not. */
-
-#ifndef CMINUSMINUS
+
+#if !defined(CMINUSMINUS)
#define TICK_BUMP_BY(ctr,n) ctr = (StgInt) ctr + n
#define TICK_BUMP(ctr) TICK_BUMP_BY(ctr,1)
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
diff --git a/libraries/ghci/GHCi/ObjLink.hs b/libraries/ghci/GHCi/ObjLink.hs
index 3adb7ebaf9..0d7b2aeff8 100644
--- a/libraries/ghci/GHCi/ObjLink.hs
+++ b/libraries/ghci/GHCi/ObjLink.hs
@@ -180,14 +180,14 @@ foreign import ccall unsafe "removeLibrarySearchPath" c_removeLibrarySearchPath
#include "ghcautoconf.h"
cLeadingUnderscore :: Bool
-#ifdef LEADING_UNDERSCORE
+#if defined(LEADING_UNDERSCORE)
cLeadingUnderscore = True
#else
cLeadingUnderscore = False
#endif
isWindowsHost :: Bool
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
isWindowsHost = True
#else
isWindowsHost = False
diff --git a/libraries/ghci/GHCi/Signals.hs b/libraries/ghci/GHCi/Signals.hs
index 9341b6ccab..629f116a0e 100644
--- a/libraries/ghci/GHCi/Signals.hs
+++ b/libraries/ghci/GHCi/Signals.hs
@@ -5,7 +5,7 @@ import Control.Concurrent
import Control.Exception
import System.Mem.Weak ( deRefWeak )
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
import System.Posix.Signals
#endif
diff --git a/rts/Adjustor.c b/rts/Adjustor.c
index c7dcc8cfd6..f2b4355831 100644
--- a/rts/Adjustor.c
+++ b/rts/Adjustor.c
@@ -188,7 +188,7 @@ createAdjustor (int cconv,
#include <string.h>
#endif
-#ifdef LEADING_UNDERSCORE
+#if defined(LEADING_UNDERSCORE)
#define UNDERSCORE "_"
#else
#define UNDERSCORE ""
@@ -1057,7 +1057,7 @@ TODO: Depending on how much allocation overhead stgMallocBytes uses for
AdjustorStub *adjustorStub;
int sz = 0, extra_sz, total_sz;
-#ifdef FUNDESCS
+#if defined(FUNDESCS)
adjustorStub = stgMallocBytes(sizeof(AdjustorStub), "createAdjustor");
#else
adjustorStub = allocateExec(sizeof(AdjustorStub),&code);
@@ -1066,7 +1066,7 @@ TODO: Depending on how much allocation overhead stgMallocBytes uses for
adjustorStub->code = (void*) &adjustorCode;
-#ifdef FUNDESCS
+#if defined(FUNDESCS)
// function descriptors are a cool idea.
// We don't need to generate any code at runtime.
adjustorStub->toc = adjustorStub;
diff --git a/rts/AdjustorAsm.S b/rts/AdjustorAsm.S
index 1713acb315..ba08548f84 100644
--- a/rts/AdjustorAsm.S
+++ b/rts/AdjustorAsm.S
@@ -88,7 +88,7 @@ adjustorCode:
/* set up stack frame */
LOAD r12, FRAMESIZE_OFF(r2)
-#ifdef powerpc64_HOST_ARCH
+#if defined(powerpc64_HOST_ARCH)
stdux r1, r1, r12
#else
stwux r1, r1, r12
@@ -162,7 +162,7 @@ L2:
#define FRAMESIZE_OFF (HEADER_BYTES + 2*WS)
#define ARGWORDS_OFF (HEADER_BYTES + 3*WS)
-#ifdef LEADING_UNDERSCORE
+#if defined(LEADING_UNDERSCORE)
.globl _adjustorCode
_adjustorCode:
#else
diff --git a/rts/Apply.cmm b/rts/Apply.cmm
index 4c34f0f3d8..f14bb8f331 100644
--- a/rts/Apply.cmm
+++ b/rts/Apply.cmm
@@ -235,7 +235,7 @@ stg_PAP_apply /* no args => explicit stack */
// profiling
TICK_ENT_PAP();
LDV_ENTER(pap);
-#ifdef PROFILING
+#if defined(PROFILING)
ccall enterFunCCS(BaseReg "ptr", StgHeader_ccs(pap) "ptr");
#endif
@@ -271,7 +271,7 @@ for:
// Off we go!
TICK_ENT_VIA_NODE();
-#ifdef NO_ARG_REGS
+#if defined(NO_ARG_REGS)
jump %GET_ENTRY(UNTAG(R1)) [R1];
#else
W_ info;
@@ -349,7 +349,7 @@ for:
// Off we go!
TICK_ENT_VIA_NODE();
-#ifdef NO_ARG_REGS
+#if defined(NO_ARG_REGS)
jump %GET_ENTRY(UNTAG(R1)) [R1];
#else
W_ info;
@@ -419,7 +419,7 @@ for:
// Off we go!
TICK_ENT_VIA_NODE();
-#ifdef NO_ARG_REGS
+#if defined(NO_ARG_REGS)
jump %GET_ENTRY(UNTAG(R1)) [R1];
#else
W_ info;
diff --git a/rts/Apply.h b/rts/Apply.h
index f225c4ea81..d2a9306fc4 100644
--- a/rts/Apply.h
+++ b/rts/Apply.h
@@ -9,14 +9,14 @@
#pragma once
// canned slow entry points, indexed by arg type (ARG_P, ARG_PP, etc.)
-#ifdef IN_STG_CODE
+#if defined(IN_STG_CODE)
extern RTS_PRIVATE StgWord stg_ap_stack_entries[];
#else
extern RTS_PRIVATE StgFun *stg_ap_stack_entries[];
#endif
// canned register save code for heap check failure in a function
-#ifdef IN_STG_CODE
+#if defined(IN_STG_CODE)
extern RTS_PRIVATE StgWord stg_stack_save_entries[];
#else
extern RTS_PRIVATE StgFun *stg_stack_save_entries[];
diff --git a/rts/AutoApply.h b/rts/AutoApply.h
index b1d26368c4..a41405122e 100644
--- a/rts/AutoApply.h
+++ b/rts/AutoApply.h
@@ -40,7 +40,7 @@
// arguments to an existing PAP, we must construct the CCS for the new PAP as if
// we had entered the existing PAP from the current CCS. Otherwise, we lose any
// stack information in the existing PAP. See #5654, and the test T5654b-O0.
-#ifdef PROFILING
+#if defined(PROFILING)
#define ENTER_FUN_CCS_NEW_PAP(pap) \
ccall enterFunCCS(BaseReg "ptr", StgHeader_ccs(pap) "ptr");
#else
diff --git a/rts/Capability.c b/rts/Capability.c
index e7907ef203..1023be87ec 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -306,7 +306,7 @@ initCapability (Capability *cap, uint32_t i)
cap->pinned_object_block = NULL;
cap->pinned_object_blocks = NULL;
-#ifdef PROFILING
+#if defined(PROFILING)
cap->r.rCCCS = CCS_SYSTEM;
#else
cap->r.rCCCS = NULL;
@@ -368,7 +368,7 @@ void initCapabilities (void)
#if defined(THREADED_RTS)
-#ifndef REG_Base
+#if !defined(REG_Base)
// We can't support multiple CPUs if BaseReg is not a register
if (RtsFlags.ParFlags.nCapabilities > 1) {
errorBelch("warning: multiple CPUs not supported in this build, reverting to 1");
@@ -575,7 +575,7 @@ releaseCapability_ (Capability* cap,
}
}
-#ifdef PROFILING
+#if defined(PROFILING)
cap->r.rCCCS = CCS_IDLE;
#endif
last_free_capability[cap->node] = cap;
@@ -806,7 +806,7 @@ void waitForCapability (Capability **pCap, Task *task)
cap = waitForReturnCapability(task);
}
-#ifdef PROFILING
+#if defined(PROFILING)
cap->r.rCCCS = CCS_SYSTEM;
#endif
@@ -898,7 +898,7 @@ yieldCapability (Capability** pCap, Task *task, bool gcAllowed)
debugTrace(DEBUG_sched, "resuming capability %d", cap->no);
ASSERT(cap->running_task == task);
-#ifdef PROFILING
+#if defined(PROFILING)
cap->r.rCCCS = CCS_SYSTEM;
#endif
diff --git a/rts/Capability.h b/rts/Capability.h
index 515c2da30c..5ab693e516 100644
--- a/rts/Capability.h
+++ b/rts/Capability.h
@@ -387,7 +387,7 @@ typedef struct PutMVar_ {
struct PutMVar_ *link;
} PutMVar;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
INLINE_HEADER bool emptyInbox(Capability *cap);
@@ -464,7 +464,7 @@ contextSwitchCapability (Capability *cap)
cap->context_switch = 1;
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
INLINE_HEADER bool emptyInbox(Capability *cap)
{
diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c
index ac7f78b7f4..c3958e938e 100644
--- a/rts/CheckUnload.c
+++ b/rts/CheckUnload.c
@@ -246,7 +246,7 @@ static void searchHeapBlocks (HashTable *addrs, bdescr *bd)
}
}
-#ifdef PROFILING
+#if defined(PROFILING)
//
// Do not unload the object if the CCS tree refers to a CCS or CC which
// originates in the object.
@@ -324,7 +324,7 @@ void checkUnload (StgClosure *static_objects)
}
}
-#ifdef PROFILING
+#if defined(PROFILING)
/* Traverse the cost centre tree, calling checkAddress on each CCS/CC */
searchCostCentres(addrs, CCS_MAIN);
diff --git a/rts/Compact.cmm b/rts/Compact.cmm
index 5290d95a60..f20fdbf8bf 100644
--- a/rts/Compact.cmm
+++ b/rts/Compact.cmm
@@ -285,7 +285,7 @@ stg_compactAddWithSharingzh (P_ compact, P_ p)
call stg_compactAddWorkerzh(compact, p, pp);
ccall freeHashTable(StgCompactNFData_hash(compact), NULL);
StgCompactNFData_hash(compact) = NULL;
-#ifdef DEBUG
+#if defined(DEBUG)
ccall verifyCompact(compact);
#endif
return (P_[pp]);
@@ -305,7 +305,7 @@ stg_compactAddzh (P_ compact, P_ p)
W_ pp; // See Note [compactAddWorker result]
pp = compact + SIZEOF_StgHeader + OFFSET_StgCompactNFData_result;
call stg_compactAddWorkerzh(compact, p, pp);
-#ifdef DEBUG
+#if defined(DEBUG)
ccall verifyCompact(compact);
#endif
return (P_[pp]);
diff --git a/rts/Disassembler.c b/rts/Disassembler.c
index f9e42b7767..e133e3a6ff 100644
--- a/rts/Disassembler.c
+++ b/rts/Disassembler.c
@@ -8,7 +8,7 @@
* $Date: 2004/09/03 15:28:19 $
* ---------------------------------------------------------------------------*/
-#ifdef DEBUG
+#if defined(DEBUG)
#include "PosixSource.h"
#include "Rts.h"
diff --git a/rts/Disassembler.h b/rts/Disassembler.h
index 5adff2eb5f..80527f71ec 100644
--- a/rts/Disassembler.h
+++ b/rts/Disassembler.h
@@ -8,7 +8,7 @@
#pragma once
-#ifdef DEBUG
+#if defined(DEBUG)
RTS_PRIVATE int disInstr ( StgBCO *bco, int pc );
RTS_PRIVATE void disassemble( StgBCO *bco );
diff --git a/rts/FileLock.c b/rts/FileLock.c
index f8e11ee1bf..ac21bea206 100644
--- a/rts/FileLock.c
+++ b/rts/FileLock.c
@@ -30,7 +30,7 @@ typedef struct {
static HashTable *obj_hash;
static HashTable *fd_hash;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static Mutex file_lock_mutex;
#endif
@@ -54,7 +54,7 @@ initFileLocking(void)
{
obj_hash = allocHashTable_(hashLock, cmpLocks);
fd_hash = allocHashTable(); /* ordinary word-based table */
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&file_lock_mutex);
#endif
}
@@ -70,7 +70,7 @@ freeFileLocking(void)
{
freeHashTable(obj_hash, freeLock);
freeHashTable(fd_hash, NULL);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeMutex(&file_lock_mutex);
#endif
}
diff --git a/rts/Globals.c b/rts/Globals.c
index b5da6d9295..66c17d0f96 100644
--- a/rts/Globals.c
+++ b/rts/Globals.c
@@ -41,7 +41,7 @@ typedef enum {
MaxStoreKey
} StoreKey;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
Mutex globalStoreLock;
#endif
@@ -54,7 +54,7 @@ initGlobalStore(void)
for (i=0; i < MaxStoreKey; i++) {
store[i] = 0;
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&globalStoreLock);
#endif
}
@@ -63,7 +63,7 @@ void
exitGlobalStore(void)
{
uint32_t i;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeMutex(&globalStoreLock);
#endif
for (i=0; i < MaxStoreKey; i++) {
@@ -78,13 +78,13 @@ static StgStablePtr getOrSetKey(StoreKey key, StgStablePtr ptr)
{
StgStablePtr ret = store[key];
if(ret==0) {
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
ACQUIRE_LOCK(&globalStoreLock);
ret = store[key];
if(ret==0) {
#endif
store[key] = ret = ptr;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
}
RELEASE_LOCK(&globalStoreLock);
#endif
diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm
index 9bfe37ebd4..001e5f6299 100644
--- a/rts/HeapStackCheck.cmm
+++ b/rts/HeapStackCheck.cmm
@@ -14,7 +14,7 @@
#include "Updates.h"
#include "SMPClosureOps.h"
-#ifdef __PIC__
+#if defined(__PIC__)
import pthread_mutex_unlock;
#endif
import EnterCriticalSection;
@@ -404,7 +404,7 @@ __stg_gc_fun /* explicit stack */
size = BITMAP_SIZE(StgFunInfoExtra_bitmap(info));
} else {
if (type == ARG_GEN_BIG) {
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
// bitmap field holds an offset
size = StgLargeBitmap_size(
TO_W_(StgFunInfoExtraRev_bitmap_offset(info))
@@ -417,7 +417,7 @@ __stg_gc_fun /* explicit stack */
}
}
-#ifdef NO_ARG_REGS
+#if defined(NO_ARG_REGS)
// we don't have to save any registers away
Sp_adj(-3);
Sp(2) = R1;
@@ -457,7 +457,7 @@ INFO_TABLE_RET ( stg_gc_fun, RET_FUN )
{
R1 = Sp(2);
Sp_adj(3);
-#ifdef NO_ARG_REGS
+#if defined(NO_ARG_REGS)
// Minor optimisation: there are no argument registers to load up,
// so we can just jump straight to the function's entry point.
jump %GET_ENTRY(UNTAG(R1)) [R1];
@@ -647,7 +647,7 @@ stg_block_throwto (P_ tso, P_ exception)
}
}
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
INFO_TABLE_RET ( stg_block_async, RET_SMALL, W_ info_ptr, W_ ares )
return ()
{
diff --git a/rts/Hpc.c b/rts/Hpc.c
index f2cd2007dc..7575e34ce0 100644
--- a/rts/Hpc.c
+++ b/rts/Hpc.c
@@ -14,15 +14,15 @@
#include <string.h>
#include <assert.h>
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
-#ifdef HAVE_SYS_STAT_H
+#if defined(HAVE_SYS_STAT_H)
#include <sys/stat.h>
#endif
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
@@ -216,7 +216,7 @@ startupHpc(void)
/* Make sure the directory is present;
* conditional code for mkdir lifted from lndir.c
*/
-#ifdef WIN32
+#if defined(WIN32)
mkdir(hpc_tixdir);
#else
mkdir(hpc_tixdir,0777);
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index 5a395670b7..4926d1dab5 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -25,7 +25,7 @@
#include "Threads.h"
#include <string.h> /* for memcpy */
-#ifdef HAVE_ERRNO_H
+#if defined(HAVE_ERRNO_H)
#include <errno.h>
#endif
@@ -83,7 +83,7 @@
#define SAVE_STACK_POINTERS \
cap->r.rCurrentTSO->stackobj->sp = Sp;
-#ifdef PROFILING
+#if defined(PROFILING)
#define LOAD_THREAD_STATE() \
LOAD_STACK_POINTERS \
cap->r.rCCCS = cap->r.rCurrentTSO->prof.cccs;
@@ -92,7 +92,7 @@
LOAD_STACK_POINTERS
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
#define SAVE_THREAD_STATE() \
SAVE_STACK_POINTERS \
cap->r.rCurrentTSO->prof.cccs = cap->r.rCCCS;
@@ -131,7 +131,7 @@ allocate_NONUPD (Capability *cap, int n_words)
int rts_stop_next_breakpoint = 0;
int rts_stop_on_exception = 0;
-#ifdef INTERP_STATS
+#if defined(INTERP_STATS)
/* Hacky stats, for tuning the interpreter ... */
int it_unknown_entries[N_CLOSURE_TYPES];
@@ -214,7 +214,7 @@ void interp_shutdown ( void )
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
//
// Build a zero-argument PAP with the current CCS
@@ -287,7 +287,7 @@ interpretBCO (Capability* cap)
debugBelch(
"\n---------------------------------------------------------------\n");
debugBelch("Entering the interpreter, Sp = %p\n", Sp);
-#ifdef PROFILING
+#if defined(PROFILING)
fprintCCS(stderr, cap->r.rCCCS);
debugBelch("\n");
#endif
@@ -356,7 +356,7 @@ eval_obj:
"\n---------------------------------------------------------------\n");
debugBelch("Evaluating: "); printObj(obj);
debugBelch("Sp = %p\n", Sp);
-#ifdef PROFILING
+#if defined(PROFILING)
fprintCCS(stderr, cap->r.rCCCS);
debugBelch("\n");
#endif
@@ -394,7 +394,7 @@ eval_obj:
case FUN_1_1:
case FUN_0_2:
case FUN_STATIC:
-#ifdef PROFILING
+#if defined(PROFILING)
if (cap->r.rCCCS != obj->header.prof.ccs) {
tagged_obj =
newEmptyPAP(cap, tagged_obj, get_fun_itbl(obj)->f.arity);
@@ -403,7 +403,7 @@ eval_obj:
break;
case PAP:
-#ifdef PROFILING
+#if defined(PROFILING)
if (cap->r.rCCCS != obj->header.prof.ccs) {
tagged_obj = copyPAP(cap, (StgPAP *)obj);
}
@@ -412,7 +412,7 @@ eval_obj:
case BCO:
ASSERT(((StgBCO *)obj)->arity > 0);
-#ifdef PROFILING
+#if defined(PROFILING)
if (cap->r.rCCCS != obj->header.prof.ccs) {
tagged_obj = newEmptyPAP(cap, tagged_obj, ((StgBCO *)obj)->arity);
}
@@ -435,7 +435,7 @@ eval_obj:
RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
}
-#ifdef PROFILING
+#if defined(PROFILING)
// restore the CCCS after evaluating the AP
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
@@ -464,7 +464,7 @@ eval_obj:
}
default:
-#ifdef INTERP_STATS
+#if defined(INTERP_STATS)
{
int j;
@@ -480,7 +480,7 @@ eval_obj:
debugBelch("evaluating unknown closure -- yielding to sched\n");
printObj(obj);
);
-#ifdef PROFILING
+#if defined(PROFILING)
// restore the CCCS after evaluating the closure
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
@@ -505,7 +505,7 @@ do_return:
"\n---------------------------------------------------------------\n");
debugBelch("Returning: "); printObj(obj);
debugBelch("Sp = %p\n", Sp);
-#ifdef PROFILING
+#if defined(PROFILING)
fprintCCS(stderr, cap->r.rCCCS);
debugBelch("\n");
#endif
@@ -652,7 +652,7 @@ do_return_unboxed:
"\n---------------------------------------------------------------\n");
debugBelch("Returning: "); printObj(obj);
debugBelch("Sp = %p\n", Sp);
-#ifdef PROFILING
+#if defined(PROFILING)
fprintCCS(stderr, cap->r.rCCCS);
debugBelch("\n");
#endif
@@ -744,7 +744,7 @@ do_apply:
}
obj = UNTAG_CLOSURE(pap->fun);
-#ifdef PROFILING
+#if defined(PROFILING)
enterFunCCS(&cap->r, pap->header.prof.ccs);
#endif
goto run_BCO_fun;
@@ -755,7 +755,7 @@ do_apply:
Sp[i] = (W_)pap->payload[i];
}
obj = UNTAG_CLOSURE(pap->fun);
-#ifdef PROFILING
+#if defined(PROFILING)
enterFunCCS(&cap->r, pap->header.prof.ccs);
#endif
goto run_BCO_fun;
@@ -936,13 +936,13 @@ run_BCO:
register StgWord16* instrs = (StgWord16*)(bco->instrs->payload);
register StgWord* literals = (StgWord*)(&bco->literals->payload[0]);
register StgPtr* ptrs = (StgPtr*)(&bco->ptrs->payload[0]);
-#ifdef DEBUG
+#if defined(DEBUG)
int bcoSize;
bcoSize = bco->instrs->bytes / sizeof(StgWord16);
#endif
IF_DEBUG(interpreter,debugBelch("bcoSize = %d\n", bcoSize));
-#ifdef INTERP_STATS
+#if defined(INTERP_STATS)
it_lastopc = 0; /* no opcode */
#endif
@@ -969,7 +969,7 @@ run_BCO:
INTERP_TICK(it_insns);
-#ifdef INTERP_STATS
+#if defined(INTERP_STATS)
ASSERT( (int)instrs[bciPtr] >= 0 && (int)instrs[bciPtr] < 27 );
it_ofreq[ (int)instrs[bciPtr] ] ++;
it_oofreq[ it_lastopc ][ (int)instrs[bciPtr] ] ++;
@@ -987,7 +987,7 @@ run_BCO:
case bci_BRK_FUN:
{
int arg1_brk_array, arg2_array_index, arg3_module_uniq;
-#ifdef PROFILING
+#if defined(PROFILING)
int arg4_cc;
#endif
StgArrBytes *breakPoints;
@@ -1005,7 +1005,7 @@ run_BCO:
arg1_brk_array = BCO_GET_LARGE_ARG;
arg2_array_index = BCO_NEXT;
arg3_module_uniq = BCO_GET_LARGE_ARG;
-#ifdef PROFILING
+#if defined(PROFILING)
arg4_cc = BCO_GET_LARGE_ARG;
#else
BCO_GET_LARGE_ARG;
@@ -1017,7 +1017,7 @@ run_BCO:
returning_from_break =
cap->r.rCurrentTSO->flags & TSO_STOPPED_ON_BREAKPOINT;
-#ifdef PROFILING
+#if defined(PROFILING)
cap->r.rCCCS = pushCostCentre(cap->r.rCCCS,
(CostCentre*)BCO_LIT(arg4_cc));
#endif
@@ -1158,7 +1158,7 @@ run_BCO:
Sp -= 2;
Sp[1] = BCO_PTR(o_bco);
Sp[0] = (W_)&stg_ctoi_R1p_info;
-#ifdef PROFILING
+#if defined(PROFILING)
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
Sp[0] = (W_)&stg_restore_cccs_info;
@@ -1171,7 +1171,7 @@ run_BCO:
Sp[-2] = (W_)&stg_ctoi_R1unpt_info;
Sp[-1] = BCO_PTR(o_bco);
Sp -= 2;
-#ifdef PROFILING
+#if defined(PROFILING)
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
Sp[0] = (W_)&stg_restore_cccs_info;
@@ -1184,7 +1184,7 @@ run_BCO:
Sp[-2] = (W_)&stg_ctoi_R1n_info;
Sp[-1] = BCO_PTR(o_bco);
Sp -= 2;
-#ifdef PROFILING
+#if defined(PROFILING)
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
Sp[0] = (W_)&stg_restore_cccs_info;
@@ -1197,7 +1197,7 @@ run_BCO:
Sp[-2] = (W_)&stg_ctoi_F1_info;
Sp[-1] = BCO_PTR(o_bco);
Sp -= 2;
-#ifdef PROFILING
+#if defined(PROFILING)
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
Sp[0] = (W_)&stg_restore_cccs_info;
@@ -1210,7 +1210,7 @@ run_BCO:
Sp[-2] = (W_)&stg_ctoi_D1_info;
Sp[-1] = BCO_PTR(o_bco);
Sp -= 2;
-#ifdef PROFILING
+#if defined(PROFILING)
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
Sp[0] = (W_)&stg_restore_cccs_info;
@@ -1223,7 +1223,7 @@ run_BCO:
Sp[-2] = (W_)&stg_ctoi_L1_info;
Sp[-1] = BCO_PTR(o_bco);
Sp -= 2;
-#ifdef PROFILING
+#if defined(PROFILING)
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
Sp[0] = (W_)&stg_restore_cccs_info;
@@ -1236,7 +1236,7 @@ run_BCO:
Sp[-2] = (W_)&stg_ctoi_V_info;
Sp[-1] = BCO_PTR(o_bco);
Sp -= 2;
-#ifdef PROFILING
+#if defined(PROFILING)
Sp -= 2;
Sp[1] = (W_)cap->r.rCCCS;
Sp[0] = (W_)&stg_restore_cccs_info;
@@ -1369,7 +1369,7 @@ run_BCO:
// The function should be a BCO
if (get_itbl(pap->fun)->type != BCO) {
-#ifdef DEBUG
+#if defined(DEBUG)
printClosure(pap->fun);
#endif
barf("bci_MKPAP");
diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c
index 38a3563880..789941603a 100644
--- a/rts/LdvProfile.c
+++ b/rts/LdvProfile.c
@@ -7,7 +7,7 @@
*
* ---------------------------------------------------------------------------*/
-#ifdef PROFILING
+#if defined(PROFILING)
#include "PosixSource.h"
#include "Rts.h"
diff --git a/rts/LdvProfile.h b/rts/LdvProfile.h
index 5c0a5a4dbb..e746d6cfaa 100644
--- a/rts/LdvProfile.h
+++ b/rts/LdvProfile.h
@@ -9,7 +9,7 @@
#pragma once
-#ifdef PROFILING
+#if defined(PROFILING)
#include "ProfHeap.h"
diff --git a/rts/Libdw.c b/rts/Libdw.c
index a16ea59fb5..33a40a1f37 100644
--- a/rts/Libdw.c
+++ b/rts/Libdw.c
@@ -281,7 +281,7 @@ static bool memory_read(Dwfl *dwfl STG_UNUSED, Dwarf_Addr addr,
static bool set_initial_registers(Dwfl_Thread *thread, void *arg);
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
static bool set_initial_registers(Dwfl_Thread *thread,
void *arg STG_UNUSED) {
Dwarf_Word regs[17];
diff --git a/rts/Linker.c b/rts/Linker.c
index b214e9c01f..11e69b1d1f 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -39,7 +39,7 @@
// get protos for is*()
#include <ctype.h>
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
@@ -49,7 +49,7 @@
#include <stdio.h>
#include <assert.h>
-#ifdef HAVE_SYS_STAT_H
+#if defined(HAVE_SYS_STAT_H)
#include <sys/stat.h>
#endif
@@ -170,7 +170,7 @@ ObjectCode *objects = NULL; /* initially empty */
to be actually freed via checkUnload() */
ObjectCode *unloaded_objects = NULL; /* initially empty */
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
/* This protects all the Linker's global state except unloaded_objects */
Mutex linker_mutex;
/*
@@ -395,7 +395,7 @@ static int linker_init_done = 0 ;
static void *dl_prog_handle;
static regex_t re_invalid;
static regex_t re_realso;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static Mutex dl_mutex; // mutex to protect dlopen/dlerror critical section
#endif
#endif
@@ -516,7 +516,7 @@ exitLinker( void ) {
if (linker_init_done == 1) {
regfree(&re_invalid);
regfree(&re_realso);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeMutex(&dl_mutex);
#endif
}
@@ -524,7 +524,7 @@ exitLinker( void ) {
if (linker_init_done == 1) {
freeHashTable(symhash, free);
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeMutex(&linker_mutex);
#endif
}
@@ -879,7 +879,7 @@ SymbolAddr* loadSymbol(SymbolName *lbl, RtsSymbolInfo *pinfo) {
return NULL;
}
-#ifdef PROFILING
+#if defined(PROFILING)
// collect any new cost centres & CCSs
// that were defined during runInit
initProfiling2();
@@ -936,7 +936,7 @@ StgStablePtr foreignExportStablePtr (StgPtr p)
* Debugging aid: look in GHCi's object symbol tables for symbols
* within DELTA bytes of the specified address, and show their names.
*/
-#ifdef DEBUG
+#if defined(DEBUG)
void ghci_enquire ( SymbolAddr* addr );
void ghci_enquire(SymbolAddr* addr)
@@ -1395,7 +1395,7 @@ preloadObjectFile (pathchar *path)
oc = mkOc(path, image, fileSize, true, NULL, misalignment);
-#ifdef OBJFORMAT_MACHO
+#if defined(OBJFORMAT_MACHO)
if (ocVerifyImage_MachO( oc ))
ocInit_MachO( oc );
#endif
@@ -1594,7 +1594,7 @@ static HsInt resolveObjs_ (void)
}
}
-#ifdef PROFILING
+#if defined(PROFILING)
// collect any new cost centres & CCSs that were defined during runInit
initProfiling2();
#endif
diff --git a/rts/Messages.c b/rts/Messages.c
index 0bea626173..0508a20d20 100644
--- a/rts/Messages.c
+++ b/rts/Messages.c
@@ -19,13 +19,13 @@
Send a message to another Capability
------------------------------------------------------------------------- */
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
void sendMessage(Capability *from_cap, Capability *to_cap, Message *msg)
{
ACQUIRE_LOCK(&to_cap->lock);
-#ifdef DEBUG
+#if defined(DEBUG)
{
const StgInfoTable *i = msg->header.info;
if (i != &stg_MSG_THROWTO_info &&
@@ -60,7 +60,7 @@ void sendMessage(Capability *from_cap, Capability *to_cap, Message *msg)
Handle a message
------------------------------------------------------------------------- */
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
void
executeMessage (Capability *cap, Message *m)
@@ -207,7 +207,7 @@ loop:
{
owner = (StgTSO*)p;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (owner->cap != cap) {
sendMessage(cap, owner->cap, (Message*)msg);
debugTraceCap(DEBUG_sched, cap, "forwarding message to cap %d",
@@ -271,7 +271,7 @@ loop:
ASSERT(owner != END_TSO_QUEUE);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (owner->cap != cap) {
sendMessage(cap, owner->cap, (Message*)msg);
debugTraceCap(DEBUG_sched, cap, "forwarding message to cap %d",
diff --git a/rts/Messages.h b/rts/Messages.h
index a6637ea75b..e60f19dc1d 100644
--- a/rts/Messages.h
+++ b/rts/Messages.h
@@ -13,7 +13,7 @@
uint32_t messageBlackHole(Capability *cap, MessageBlackHole *msg);
StgTSO * blackHoleOwner (StgClosure *bh);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
void executeMessage (Capability *cap, Message *m);
void sendMessage (Capability *from_cap, Capability *to_cap, Message *msg);
#endif
diff --git a/rts/Pool.c b/rts/Pool.c
index 158391111b..d6ea0d492f 100644
--- a/rts/Pool.c
+++ b/rts/Pool.c
@@ -28,7 +28,7 @@ struct Pool_ {
/* how many things are currently allocated? (sum of lengths of available and
* taken lists) */
uint32_t current_size;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
/* signaled when a thing is released */
Condition cond;
#endif
@@ -37,7 +37,7 @@ struct Pool_ {
PoolEntry *available;
PoolEntry *taken;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
/* protects entire data structure */
Mutex mutex;
#endif
@@ -53,7 +53,7 @@ Pool *poolInit(uint32_t max_size, uint32_t desired_size,
pool->free_fn = free_fn;
pool->available = NULL;
pool->taken = NULL;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&pool->mutex);
initCondition(&pool->cond);
#endif
@@ -65,7 +65,7 @@ int poolFree(Pool *pool) {
return 1;
poolSetMaxSize(pool, 0);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeCondition(&pool->cond);
closeMutex(&pool->mutex);
#endif
@@ -145,7 +145,7 @@ void *poolTake(Pool *pool) {
while (ent == NULL) {
ent = poolTryTake_(pool);
if (!ent) {
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
waitCondition(&pool->cond, &pool->mutex);
#else
barf("Tried to take from an empty pool");
@@ -171,7 +171,7 @@ void poolRelease(Pool *pool, void *thing) {
} else {
ent->next = pool->available;
pool->available = ent;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
signalCondition(&pool->cond);
#endif
}
diff --git a/rts/Prelude.h b/rts/Prelude.h
index ba36c1035c..74b6b08227 100644
--- a/rts/Prelude.h
+++ b/rts/Prelude.h
@@ -29,7 +29,7 @@ PRELUDE_CLOSURE(ghczmprim_GHCziTypes_False_closure);
PRELUDE_CLOSURE(base_GHCziPack_unpackCString_closure);
PRELUDE_CLOSURE(base_GHCziWeak_runFinalizzerBatch_closure);
-#ifdef IN_STG_CODE
+#if defined(IN_STG_CODE)
extern W_ ZCMain_main_closure[];
#else
extern StgClosure ZCMain_main_closure;
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 37eee439ac..7dd88b82d2 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -25,7 +25,7 @@
#include "MachDeps.h"
#include "SMPClosureOps.h"
-#ifdef __PIC__
+#if defined(__PIC__)
import pthread_mutex_lock;
import pthread_mutex_unlock;
#endif
@@ -36,7 +36,7 @@ import CLOSURE ghczmprim_GHCziTypes_False_closure;
#if defined(USE_MINIINTERPRETER) || !defined(mingw32_HOST_OS)
import CLOSURE sm_mutex;
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
import CLOSURE CCS_MAIN;
#endif
@@ -605,7 +605,7 @@ stg_atomicModifyMutVarzh ( gcptr mv, gcptr f )
retry:
x = StgMutVar_var(mv);
StgThunk_payload(z,1) = x;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
(h) = prim %cmpxchgW(mv + SIZEOF_StgHeader + OFFSET_StgMutVar_var, x, y);
if (h != x) { goto retry; }
#else
@@ -714,7 +714,7 @@ stg_finalizzeWeakzh ( gcptr w )
list = StgWeak_cfinalizers(w);
// kill it
-#ifdef PROFILING
+#if defined(PROFILING)
// @LDV profiling
// A weak pointer is inherently used, so we do not need to call
// LDV_recordDead_FILL_SLOP_DYNAMIC():
@@ -2072,7 +2072,7 @@ write_nptrs:
stg_waitReadzh ( W_ fd )
{
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
ccall barf("waitRead# on threaded RTS") never returns;
#else
@@ -2088,7 +2088,7 @@ stg_waitReadzh ( W_ fd )
stg_waitWritezh ( W_ fd )
{
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
ccall barf("waitWrite# on threaded RTS") never returns;
#else
@@ -2106,21 +2106,21 @@ stg_waitWritezh ( W_ fd )
STRING(stg_delayzh_malloc_str, "stg_delayzh")
stg_delayzh ( W_ us_delay )
{
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
W_ ares;
CInt reqID;
#else
W_ t, prev, target;
#endif
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
ccall barf("delay# on threaded RTS") never returns;
#else
ASSERT(StgTSO_why_blocked(CurrentTSO) == NotBlocked::I16);
StgTSO_why_blocked(CurrentTSO) = BlockedOnDelay::I16;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
/* could probably allocate this on the heap instead */
("ptr" ares) = ccall stgMallocBytes(SIZEOF_StgAsyncIOResult,
@@ -2168,14 +2168,14 @@ while:
}
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
STRING(stg_asyncReadzh_malloc_str, "stg_asyncReadzh")
stg_asyncReadzh ( W_ fd, W_ is_sock, W_ len, W_ buf )
{
W_ ares;
CInt reqID;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
ccall barf("asyncRead# on threaded RTS") never returns;
#else
@@ -2201,7 +2201,7 @@ stg_asyncWritezh ( W_ fd, W_ is_sock, W_ len, W_ buf )
W_ ares;
CInt reqID;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
ccall barf("asyncWrite# on threaded RTS") never returns;
#else
@@ -2227,7 +2227,7 @@ stg_asyncDoProczh ( W_ proc, W_ param )
W_ ares;
CInt reqID;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
ccall barf("asyncDoProc# on threaded RTS") never returns;
#else
@@ -2356,7 +2356,7 @@ stg_traceCcszh ( P_ obj, P_ ret )
{
W_ ccs;
-#ifdef PROFILING
+#if defined(PROFILING)
ccs = StgHeader_ccs(UNTAG(obj));
ccall fprintCCS_stderr(ccs "ptr");
#endif
@@ -2368,7 +2368,7 @@ stg_getSparkzh ()
{
W_ spark;
-#ifndef THREADED_RTS
+#if !defined(THREADED_RTS)
return (0,ghczmprim_GHCziTypes_False_closure);
#else
("ptr" spark) = ccall findSpark(MyCapability() "ptr");
@@ -2382,7 +2382,7 @@ stg_getSparkzh ()
stg_clearCCSzh (P_ arg)
{
-#ifdef PROFILING
+#if defined(PROFILING)
CCCS = CCS_MAIN;
#endif
jump stg_ap_v_fast(arg);
@@ -2391,7 +2391,7 @@ stg_clearCCSzh (P_ arg)
stg_numSparkszh ()
{
W_ n;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
(n) = ccall dequeElements(Capability_sparks(MyCapability()));
#else
n = 0;
diff --git a/rts/Printer.c b/rts/Printer.c
index 87b11e80d8..f077814ba9 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -17,13 +17,13 @@
#include "Printer.h"
#include "RtsUtils.h"
-#ifdef PROFILING
+#if defined(PROFILING)
#include "Profiling.h"
#endif
#include <string.h>
-#ifdef DEBUG
+#if defined(DEBUG)
#include "Disassembler.h"
#include "Apply.h"
@@ -61,7 +61,7 @@ printStdObjHdr( const StgClosure *obj, char* tag )
{
debugBelch("%s(",tag);
printPtr((StgPtr)obj->header.info);
-#ifdef PROFILING
+#if defined(PROFILING)
debugBelch(", %s", obj->header.prof.ccs->cc->label);
#endif
}
@@ -146,7 +146,7 @@ printClosure( const StgClosure *obj )
case FUN_STATIC:
debugBelch("FUN/%d(",(int)itbl_to_fun_itbl(info)->f.arity);
printPtr((StgPtr)obj->header.info);
-#ifdef PROFILING
+#if defined(PROFILING)
debugBelch(", %s", obj->header.prof.ccs->cc->label);
#endif
printStdObjPayload(obj);
@@ -169,7 +169,7 @@ printClosure( const StgClosure *obj )
case THUNK_1_1: case THUNK_0_2: case THUNK_2_0:
case THUNK_STATIC:
/* ToDo: will this work for THUNK_STATIC too? */
-#ifdef PROFILING
+#if defined(PROFILING)
printThunkObject((StgThunk *)obj,GET_PROF_DESC(info));
#else
printThunkObject((StgThunk *)obj,"THUNK");
@@ -520,7 +520,7 @@ printStackChunk( StgPtr sp, StgPtr spBottom )
debugBelch("stg_ap_ppppp_info\n" );
} else if (c == (StgWord)&stg_ap_pppppp_info) {
debugBelch("stg_ap_pppppp_info\n" );
-#ifdef PROFILING
+#if defined(PROFILING)
} else if (c == (StgWord)&stg_restore_cccs_info) {
debugBelch("stg_restore_cccs_info\n" );
fprintCCS(stderr, (CostCentreStack*)sp[1]);
@@ -624,7 +624,7 @@ const char *lookupGHCName( void *addr )
/* Causing linking trouble on Win32 plats, so I'm
disabling this for now.
*/
-#ifdef USING_LIBBFD
+#if defined(USING_LIBBFD)
# define PACKAGE 1
# define PACKAGE_VERSION 1
/* Those PACKAGE_* defines are workarounds for bfd:
diff --git a/rts/Printer.h b/rts/Printer.h
index 7d1bb81234..dd268bef42 100644
--- a/rts/Printer.h
+++ b/rts/Printer.h
@@ -20,7 +20,7 @@ const char * info_type ( const StgClosure *closure );
const char * info_type_by_ip ( const StgInfoTable *ip );
const char * info_update_frame ( const StgClosure *closure );
-#ifdef DEBUG
+#if defined(DEBUG)
extern void printClosure ( const StgClosure *obj );
extern void printStackChunk ( StgPtr sp, StgPtr spLim );
extern void printTSO ( StgTSO *tso );
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index 608b976605..43801b8944 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -92,7 +92,7 @@ typedef struct {
static Census *censuses = NULL;
static uint32_t n_censuses = 0;
-#ifdef PROFILING
+#if defined(PROFILING)
static void aggregateCensusInfo( void );
#endif
@@ -110,7 +110,7 @@ closureIdentity( const StgClosure *p )
{
switch (RtsFlags.ProfFlags.doHeapProfile) {
-#ifdef PROFILING
+#if defined(PROFILING)
case HEAP_BY_CCS:
return p->header.prof.ccs;
case HEAP_BY_MOD:
@@ -155,7 +155,7 @@ closureIdentity( const StgClosure *p )
/* --------------------------------------------------------------------------
* Profiling type predicates
* ----------------------------------------------------------------------- */
-#ifdef PROFILING
+#if defined(PROFILING)
STATIC_INLINE bool
doingLDVProfiling( void )
{
@@ -180,7 +180,7 @@ doingRetainerProfiling( void )
// LDV_recordDead() may be called from elsewhere in the runtime system. E.g.,
// when a thunk is replaced by an indirection object.
-#ifdef PROFILING
+#if defined(PROFILING)
void
LDV_recordDead( const StgClosure *c, uint32_t size )
{
@@ -277,7 +277,7 @@ freeEra(Census *census)
static void
nextEra( void )
{
-#ifdef PROFILING
+#if defined(PROFILING)
if (doingLDVProfiling()) {
era++;
@@ -323,7 +323,7 @@ void initProfiling (void)
prog = stgMallocBytes(strlen(prog_name) + 1, "initProfiling2");
strcpy(prog, prog_name);
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
// on Windows, drop the .exe suffix if there is one
{
char *suff;
@@ -374,7 +374,7 @@ printSample(bool beginSample, StgDouble sampleValue)
static void
dumpCostCentresToEventLog(void)
{
-#ifdef PROFILING
+#if defined(PROFILING)
CostCentre *cc, *next;
for (cc = CC_LIST; cc != NULL; cc = next) {
next = cc->link;
@@ -394,12 +394,12 @@ initHeapProfiling(void)
return 0;
}
-#ifdef PROFILING
+#if defined(PROFILING)
if (doingLDVProfiling() && doingRetainerProfiling()) {
errorBelch("cannot mix -hb and -hr");
stg_exit(EXIT_FAILURE);
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// See Trac #12019.
if (doingLDVProfiling() && RtsFlags.ParFlags.nCapabilities > 1) {
errorBelch("-hb cannot be used with multiple capabilities");
@@ -410,7 +410,7 @@ initHeapProfiling(void)
// we only count eras if we're doing LDV profiling. Otherwise era
// is fixed at zero.
-#ifdef PROFILING
+#if defined(PROFILING)
if (doingLDVProfiling()) {
era = 1;
} else
@@ -430,7 +430,7 @@ initHeapProfiling(void)
/* initProfilingLogFile(); */
fprintf(hp_file, "JOB \"%s", prog_name);
-#ifdef PROFILING
+#if defined(PROFILING)
{
int count;
for(count = 1; count < prog_argc; count++)
@@ -451,7 +451,7 @@ initHeapProfiling(void)
printSample(true, 0);
printSample(false, 0);
-#ifdef PROFILING
+#if defined(PROFILING)
if (doingRetainerProfiling()) {
initRetainerProfiling();
}
@@ -472,13 +472,13 @@ endHeapProfiling(void)
return;
}
-#ifdef PROFILING
+#if defined(PROFILING)
if (doingRetainerProfiling()) {
endRetainerProfiling();
}
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
if (doingLDVProfiling()) {
uint32_t t;
LdvCensusKillAll();
@@ -489,7 +489,7 @@ endHeapProfiling(void)
}
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
if (doingLDVProfiling()) {
uint32_t t;
if (RtsFlags.ProfFlags.bioSelector != NULL) {
@@ -516,7 +516,7 @@ endHeapProfiling(void)
-#ifdef PROFILING
+#if defined(PROFILING)
static size_t
buf_append(char *p, const char *q, char *end)
{
@@ -651,7 +651,7 @@ closureSatisfiesConstraints( const StgClosure* p )
/* -----------------------------------------------------------------------------
* Aggregate the heap census info for biographical profiling
* -------------------------------------------------------------------------- */
-#ifdef PROFILING
+#if defined(PROFILING)
static void
aggregateCensusInfo( void )
{
@@ -769,7 +769,7 @@ dumpCensus( Census *census )
printSample(true, census->time);
traceHeapProfSampleBegin(era);
-#ifdef PROFILING
+#if defined(PROFILING)
/* change typecast to uint64_t to remove
* print formatting warning. See #12636 */
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
@@ -793,7 +793,7 @@ dumpCensus( Census *census )
for (ctr = census->ctrs; ctr != NULL; ctr = ctr->next) {
-#ifdef PROFILING
+#if defined(PROFILING)
if (RtsFlags.ProfFlags.bioSelector != NULL) {
count = 0;
if (strMatchesSelector("lag", RtsFlags.ProfFlags.bioSelector))
@@ -824,7 +824,7 @@ dumpCensus( Census *census )
}
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
switch (RtsFlags.ProfFlags.doHeapProfile) {
case HEAP_BY_CCS:
fprint_ccs(hp_file, (CostCentreStack *)ctr->identity,
@@ -876,7 +876,7 @@ dumpCensus( Census *census )
static void heapProfObject(Census *census, StgClosure *p, size_t size,
bool prim
-#ifndef PROFILING
+#if !defined(PROFILING)
STG_UNUSED
#endif
)
@@ -887,7 +887,7 @@ static void heapProfObject(Census *census, StgClosure *p, size_t size,
identity = NULL;
-#ifdef PROFILING
+#if defined(PROFILING)
// subtract the profiling overhead
real_size = size - sizeofW(StgProfHeader);
#else
@@ -895,7 +895,7 @@ static void heapProfObject(Census *census, StgClosure *p, size_t size,
#endif
if (closureSatisfiesConstraints((StgClosure*)p)) {
-#ifdef PROFILING
+#if defined(PROFILING)
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
if (prim)
census->prim += real_size;
@@ -911,7 +911,7 @@ static void heapProfObject(Census *census, StgClosure *p, size_t size,
if (identity != NULL) {
ctr = lookupHashTable(census->hash, (StgWord)identity);
if (ctr != NULL) {
-#ifdef PROFILING
+#if defined(PROFILING)
if (RtsFlags.ProfFlags.bioSelector != NULL) {
if (prim)
ctr->c.ldv.prim += real_size;
@@ -932,7 +932,7 @@ static void heapProfObject(Census *census, StgClosure *p, size_t size,
ctr->next = census->ctrs;
census->ctrs = ctr;
-#ifdef PROFILING
+#if defined(PROFILING)
if (RtsFlags.ProfFlags.bioSelector != NULL) {
if (prim)
ctr->c.ldv.prim = real_size;
@@ -1111,7 +1111,7 @@ heapCensusChain( Census *census, bdescr *bd )
case TSO:
prim = true;
-#ifdef PROFILING
+#if defined(PROFILING)
if (RtsFlags.ProfFlags.includeTSOs) {
size = sizeofW(StgTSO);
break;
@@ -1127,7 +1127,7 @@ heapCensusChain( Census *census, bdescr *bd )
case STACK:
prim = true;
-#ifdef PROFILING
+#if defined(PROFILING)
if (RtsFlags.ProfFlags.includeTSOs) {
size = stack_sizeW((StgStack*)p);
break;
@@ -1171,13 +1171,13 @@ void heapCensus (Time t)
census->time = mut_user_time_until(t);
// calculate retainer sets if necessary
-#ifdef PROFILING
+#if defined(PROFILING)
if (doingRetainerProfiling()) {
retainerProfile();
}
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
stat_startHeapCensus();
#endif
@@ -1198,7 +1198,7 @@ void heapCensus (Time t)
}
// dump out the census info
-#ifdef PROFILING
+#if defined(PROFILING)
// We can't generate any info for LDV profiling until
// the end of the run...
if (!doingLDVProfiling())
@@ -1210,7 +1210,7 @@ void heapCensus (Time t)
// free our storage, unless we're keeping all the census info for
// future restriction by biography.
-#ifdef PROFILING
+#if defined(PROFILING)
if (RtsFlags.ProfFlags.bioSelector == NULL)
{
freeEra(census);
@@ -1222,7 +1222,7 @@ void heapCensus (Time t)
// we're into the next time period now
nextEra();
-#ifdef PROFILING
+#if defined(PROFILING)
stat_endHeapCensus();
#endif
}
diff --git a/rts/ProfHeap.h b/rts/ProfHeap.h
index 85f81f3b9e..aa4056b111 100644
--- a/rts/ProfHeap.h
+++ b/rts/ProfHeap.h
@@ -15,7 +15,7 @@ uint32_t initHeapProfiling (void);
void endHeapProfiling (void);
bool strMatchesSelector (const char* str, const char* sel);
-#ifdef PROFILING
+#if defined(PROFILING)
// doingRetainerProfiling: `-hr` or `-hr<cc> -h<x>`
bool doingRetainerProfiling(void);
#endif
diff --git a/rts/ProfilerReport.c b/rts/ProfilerReport.c
index 81f7fa046a..4142c00032 100644
--- a/rts/ProfilerReport.c
+++ b/rts/ProfilerReport.c
@@ -6,7 +6,7 @@
*
* ---------------------------------------------------------------------------*/
-#ifdef PROFILING
+#if defined(PROFILING)
#include "PosixSource.h"
#include "Rts.h"
diff --git a/rts/ProfilerReport.h b/rts/ProfilerReport.h
index 516244eee3..66b602adc0 100644
--- a/rts/ProfilerReport.h
+++ b/rts/ProfilerReport.h
@@ -15,7 +15,7 @@
#include "BeginPrivate.h"
-#ifdef PROFILING
+#if defined(PROFILING)
void writeCCSReport( FILE *prof_file, CostCentreStack const *ccs,
ProfilerTotals totals );
diff --git a/rts/ProfilerReportJson.c b/rts/ProfilerReportJson.c
index b4c77042d7..3cf875e15b 100644
--- a/rts/ProfilerReportJson.c
+++ b/rts/ProfilerReportJson.c
@@ -6,7 +6,7 @@
*
* ---------------------------------------------------------------------------*/
-#ifdef PROFILING
+#if defined(PROFILING)
#include "PosixSource.h"
#include "Rts.h"
diff --git a/rts/ProfilerReportJson.h b/rts/ProfilerReportJson.h
index ace2e581e8..5e7271f70e 100644
--- a/rts/ProfilerReportJson.h
+++ b/rts/ProfilerReportJson.h
@@ -15,7 +15,7 @@
#include "BeginPrivate.h"
-#ifdef PROFILING
+#if defined(PROFILING)
void writeCCSReportJson(FILE *prof_file,
CostCentreStack const *ccs,
diff --git a/rts/Profiling.c b/rts/Profiling.c
index 65a9f7dfa5..9523572887 100644
--- a/rts/Profiling.c
+++ b/rts/Profiling.c
@@ -6,7 +6,7 @@
*
* ---------------------------------------------------------------------------*/
-#ifdef PROFILING
+#if defined(PROFILING)
#include "PosixSource.h"
#include "Rts.h"
@@ -24,7 +24,7 @@
#include <string.h>
-#ifdef DEBUG
+#if defined(DEBUG)
#include "Trace.h"
#endif
@@ -55,7 +55,7 @@ FILE *hp_file;
CostCentre *CC_LIST = NULL;
CostCentreStack *CCS_LIST = NULL;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static Mutex ccs_mutex;
#endif
@@ -141,7 +141,7 @@ void initProfiling (void)
}
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&ccs_mutex);
#endif
@@ -238,7 +238,7 @@ initProfilingLogFile(void)
prog = arenaAlloc(prof_arena, strlen(prog_name) + 1);
strcpy(prog, prog_name);
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
// on Windows, drop the .exe suffix if there is one
{
char *suff;
@@ -456,7 +456,7 @@ ccsSetSelected (CostCentreStack *ccs)
Cost-centre stack manipulation
-------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
CostCentreStack * _pushCostCentre ( CostCentreStack *ccs, CostCentre *cc );
CostCentreStack *
pushCostCentre ( CostCentreStack *ccs, CostCentre *cc )
@@ -473,7 +473,7 @@ pushCostCentre ( CostCentreStack *ccs, CostCentre *cc )
/* Append ccs1 to ccs2 (ignoring any CAF cost centre at the root of ccs1 */
-#ifdef DEBUG
+#if defined(DEBUG)
CostCentreStack *_appendCCS ( CostCentreStack *ccs1, CostCentreStack *ccs2 );
CostCentreStack *
appendCCS ( CostCentreStack *ccs1, CostCentreStack *ccs2 )
@@ -981,7 +981,7 @@ done:
return;
}
-#ifdef DEBUG
+#if defined(DEBUG)
void
debugCCS( CostCentreStack *ccs )
{
diff --git a/rts/Profiling.h b/rts/Profiling.h
index 2160052fc7..45725e5631 100644
--- a/rts/Profiling.h
+++ b/rts/Profiling.h
@@ -13,7 +13,7 @@
#include "BeginPrivate.h"
#include "Rts.h"
-#ifdef PROFILING
+#if defined(PROFILING)
#define PROFILING_ONLY(s) s
#else
#define PROFILING_ONLY(s) doNothing()
@@ -35,7 +35,7 @@ typedef struct {
unsigned int total_prof_ticks;
} ProfilerTotals;
-#ifdef PROFILING
+#if defined(PROFILING)
void reportCCSProfiling ( void );
@@ -45,7 +45,7 @@ void fprintCCS_stderr (CostCentreStack *ccs, StgClosure *exception, StgTSO *tso)
bool ignoreCCS (CostCentreStack const *ccs);
bool ignoreCC (CostCentre const *cc);
-#ifdef DEBUG
+#if defined(DEBUG)
void debugCCS( CostCentreStack *ccs );
#endif
diff --git a/rts/Proftimer.c b/rts/Proftimer.c
index 0c07194ed5..eb4a932cdb 100644
--- a/rts/Proftimer.c
+++ b/rts/Proftimer.c
@@ -13,7 +13,7 @@
#include "Proftimer.h"
#include "Capability.h"
-#ifdef PROFILING
+#if defined(PROFILING)
static bool do_prof_ticks = false; // enable profiling ticks
#endif
@@ -28,7 +28,7 @@ bool performHeapProfile;
void
stopProfTimer( void )
{
-#ifdef PROFILING
+#if defined(PROFILING)
do_prof_ticks = false;
#endif
}
@@ -36,7 +36,7 @@ stopProfTimer( void )
void
startProfTimer( void )
{
-#ifdef PROFILING
+#if defined(PROFILING)
do_prof_ticks = true;
#endif
}
@@ -71,7 +71,7 @@ uint32_t total_ticks = 0;
void
handleProfTick(void)
{
-#ifdef PROFILING
+#if defined(PROFILING)
total_ticks++;
if (do_prof_ticks) {
uint32_t n;
diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c
index b399d41675..31cc91587d 100644
--- a/rts/RaiseAsync.c
+++ b/rts/RaiseAsync.c
@@ -255,7 +255,7 @@ check_target:
(unsigned long)msg->source->id,
(unsigned long)msg->target->id);
-#ifdef DEBUG
+#if defined(DEBUG)
traceThreadStatus(DEBUG_sched, target);
#endif
@@ -435,7 +435,7 @@ check_target:
}
case BlockedOnCCall_Interruptible:
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
{
Task *task = NULL;
// walk suspended_ccalls to find the correct worker thread
@@ -463,7 +463,7 @@ check_target:
blockedThrowTo(cap,target,msg);
return THROWTO_BLOCKED;
-#ifndef THREADEDED_RTS
+#if !defined(THREADEDED_RTS)
case BlockedOnRead:
case BlockedOnWrite:
case BlockedOnDelay:
@@ -505,7 +505,7 @@ throwToSendMsg (Capability *cap STG_UNUSED,
MessageThrowTo *msg USED_IF_THREADS)
{
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
debugTraceCap(DEBUG_sched, cap, "throwTo: sending a throwto message to cap %lu", (unsigned long)target_cap->no);
sendMessage(cap, target_cap, (Message*)msg);
diff --git a/rts/RaiseAsync.h b/rts/RaiseAsync.h
index 002c22d39a..00b57d443a 100644
--- a/rts/RaiseAsync.h
+++ b/rts/RaiseAsync.h
@@ -11,7 +11,7 @@
#define THROWTO_SUCCESS 0
#define THROWTO_BLOCKED 1
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
#include "BeginPrivate.h"
diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c
index 901293761a..54a10675ad 100644
--- a/rts/RetainerProfile.c
+++ b/rts/RetainerProfile.c
@@ -7,10 +7,10 @@
*
* ---------------------------------------------------------------------------*/
-#ifdef PROFILING
+#if defined(PROFILING)
// Turn off inlining when debugging - it obfuscates things
-#ifdef DEBUG
+#if defined(DEBUG)
#define INLINE
#else
#define INLINE inline
@@ -68,11 +68,11 @@ StgWord flip = 0; // flip bit
static void retainStack(StgClosure *, retainer, StgPtr, StgPtr);
static void retainClosure(StgClosure *, StgClosure *, retainer);
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
static void belongToHeap(StgPtr p);
#endif
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
/*
cStackSize records how many times retainStack() has been invoked recursively,
that is, the number of activation records for retainStack() on the C stack.
@@ -189,7 +189,7 @@ static stackElement *currentStackBoundary;
retainer profiling, maxStackSize + maxCStackSize is some value no greater
than the actual depth of the graph.
*/
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
static int stackSize, maxStackSize;
#endif
@@ -267,7 +267,7 @@ isEmptyRetainerStack( void )
/* -----------------------------------------------------------------------------
* Returns size of stack
* -------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
W_
retainerStackBlocks( void )
{
@@ -431,7 +431,7 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child )
stackElement se;
bdescr *nbd; // Next Block Descriptor
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("push(): stackTop = 0x%x, currentStackBoundary = 0x%x\n", stackTop, currentStackBoundary);
#endif
@@ -626,7 +626,7 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child )
}
if (stackTop - 1 < stackBottom) {
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("push() to the next stack.\n");
#endif
// currentStack->free is updated when the active stack is switched
@@ -658,7 +658,7 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child )
// field. Is this really harmless? Can we avoid the warning?
*stackTop = se;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
stackSize++;
if (stackSize > maxStackSize) maxStackSize = stackSize;
// ASSERT(stackSize >= 0);
@@ -684,7 +684,7 @@ popOffReal(void)
{
bdescr *pbd; // Previous Block Descriptor
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("pop() to the previous stack.\n");
#endif
@@ -695,7 +695,7 @@ popOffReal(void)
// The stack is completely empty.
stackTop++;
ASSERT(stackTop == stackLimit);
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
stackSize--;
if (stackSize > maxStackSize) maxStackSize = stackSize;
/*
@@ -716,7 +716,7 @@ popOffReal(void)
returnToOldStack(pbd);
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
stackSize--;
if (stackSize > maxStackSize) maxStackSize = stackSize;
/*
@@ -728,7 +728,7 @@ popOffReal(void)
static INLINE void
popOff(void) {
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("\tpopOff(): stackTop = 0x%x, currentStackBoundary = 0x%x\n", stackTop, currentStackBoundary);
#endif
@@ -738,7 +738,7 @@ popOff(void) {
// <= (instead of <) is wrong!
if (stackTop + 1 < stackLimit) {
stackTop++;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
stackSize--;
if (stackSize > maxStackSize) maxStackSize = stackSize;
/*
@@ -773,7 +773,7 @@ pop( StgClosure **c, StgClosure **cp, retainer *r )
{
stackElement *se;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("pop(): stackTop = 0x%x, currentStackBoundary = 0x%x\n", stackTop, currentStackBoundary);
#endif
@@ -972,7 +972,7 @@ initRetainerProfiling( void )
void
endRetainerProfiling( void )
{
-#ifdef SECOND_APPROACH
+#if defined(SECOND_APPROACH)
outputAllRetainerSet(prof_file);
#endif
}
@@ -1283,7 +1283,7 @@ retainStack( StgClosure *c, retainer c_child_r,
StgWord bitmap;
uint32_t size;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
cStackSize++;
if (cStackSize > maxCStackSize) maxCStackSize = cStackSize;
#endif
@@ -1297,7 +1297,7 @@ retainStack( StgClosure *c, retainer c_child_r,
oldStackBoundary = currentStackBoundary;
currentStackBoundary = stackTop;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("retainStack() called: oldStackBoundary = 0x%x, currentStackBoundary = 0x%x\n", oldStackBoundary, currentStackBoundary);
#endif
@@ -1390,11 +1390,11 @@ retainStack( StgClosure *c, retainer c_child_r,
// restore currentStackBoundary
currentStackBoundary = oldStackBoundary;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("retainStack() finished: currentStackBoundary = 0x%x\n", currentStackBoundary);
#endif
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
cStackSize--;
#endif
}
@@ -1473,11 +1473,11 @@ retainClosure( StgClosure *c0, StgClosure *cp0, retainer r0 )
retainer r, c_child_r;
StgWord typeOfc;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// StgPtr oldStackTop;
#endif
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// oldStackTop = stackTop;
// debugBelch("retainClosure() called: c0 = 0x%x, cp0 = 0x%x, r0 = 0x%x\n", c0, cp0, r0);
#endif
@@ -1494,7 +1494,7 @@ loop:
pop(&c, &cp, &r);
if (c == NULL) {
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("retainClosure() ends: oldStackTop = 0x%x, stackTop = 0x%x\n", oldStackTop, stackTop);
#endif
return;
@@ -1519,7 +1519,7 @@ inner_loop:
typeOfc = get_itbl(c)->type;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
switch (typeOfc) {
case IND_STATIC:
case CONSTR_NOCAF:
@@ -1540,7 +1540,7 @@ inner_loop:
case TSO:
if (((StgTSO *)c)->what_next == ThreadComplete ||
((StgTSO *)c)->what_next == ThreadKilled) {
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
debugBelch("ThreadComplete or ThreadKilled encountered in retainClosure()\n");
#endif
goto loop;
@@ -1759,7 +1759,7 @@ computeRetainerSet( void )
uint32_t g, n;
StgPtr ml;
bdescr *bd;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
RetainerSet tmpRetainerSet;
#endif
@@ -1803,7 +1803,7 @@ computeRetainerSet( void )
maybeInitRetainerSet((StgClosure *)*ml);
rtl = retainerSetOf((StgClosure *)*ml);
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
if (rtl == NULL) {
// first visit to *ml
// This is a violation of the interface rule!
@@ -1860,18 +1860,18 @@ computeRetainerSet( void )
void
resetStaticObjectForRetainerProfiling( StgClosure *static_objects )
{
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
uint32_t count;
#endif
StgClosure *p;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
count = 0;
#endif
p = static_objects;
while (p != END_OF_STATIC_OBJECT_LIST) {
p = UNTAG_STATIC_LIST_PTR(p);
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
count++;
#endif
switch (get_itbl(p)->type) {
@@ -1903,7 +1903,7 @@ resetStaticObjectForRetainerProfiling( StgClosure *static_objects )
break;
}
}
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("count in scavenged_static_objects = %d\n", count);
#endif
}
@@ -1920,19 +1920,19 @@ resetStaticObjectForRetainerProfiling( StgClosure *static_objects )
void
retainerProfile(void)
{
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
uint32_t i;
uint32_t totalHeapSize; // total raw heap size (computed by linear scanning)
#endif
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
debugBelch(" < retainerProfile() invoked : %d>\n", retainerGeneration);
#endif
stat_startRP();
// We haven't flipped the bit yet.
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
debugBelch("Before traversing:\n");
sumOfCostLinear = 0;
for (i = 0;i < N_CLOSURE_TYPES; i++)
@@ -1962,7 +1962,7 @@ retainerProfile(void)
// Now we flips flip.
flip = flip ^ 1;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
stackSize = 0;
maxStackSize = 0;
cStackSize = 0;
@@ -1971,7 +1971,7 @@ retainerProfile(void)
numObjectVisited = 0;
timesAnyObjectVisited = 0;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
debugBelch("During traversing:\n");
sumOfNewCost = 0;
sumOfNewCostExtra = 0;
@@ -1986,14 +1986,14 @@ retainerProfile(void)
retainer sets.
*/
initializeTraverseStack();
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
initializeAllRetainerSet();
#else
refreshAllRetainerSet();
#endif
computeRetainerSet();
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
debugBelch("After traversing:\n");
sumOfCostLinear = 0;
for (i = 0;i < N_CLOSURE_TYPES; i++)
@@ -2034,7 +2034,7 @@ retainerProfile(void)
// post-processing
closeTraverseStack();
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
closeAllRetainerSet();
#else
// Note that there is no post-processing for the retainer sets.
@@ -2043,7 +2043,7 @@ retainerProfile(void)
stat_endRP(
retainerGeneration - 1, // retainerGeneration has just been incremented!
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
maxCStackSize, maxStackSize,
#endif
(double)timesAnyObjectVisited / numObjectVisited);
@@ -2053,7 +2053,7 @@ retainerProfile(void)
* DEBUGGING CODE
* -------------------------------------------------------------------------- */
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
#define LOOKS_LIKE_PTR(r) ((LOOKS_LIKE_STATIC_CLOSURE(r) || \
((HEAP_ALLOCED(r) && ((Bdescr((P_)r)->flags & BF_FREE) == 0)))) && \
diff --git a/rts/RetainerProfile.h b/rts/RetainerProfile.h
index 959c346a84..6882a2a58a 100644
--- a/rts/RetainerProfile.h
+++ b/rts/RetainerProfile.h
@@ -9,7 +9,7 @@
#pragma once
-#ifdef PROFILING
+#if defined(PROFILING)
#include "RetainerSet.h"
@@ -41,7 +41,7 @@ retainerSetOf( const StgClosure *c )
}
// Used by Storage.c:memInventory()
-#ifdef DEBUG
+#if defined(DEBUG)
extern W_ retainerStackBlocks ( void );
#endif
diff --git a/rts/RetainerSet.c b/rts/RetainerSet.c
index 9c3043b84a..58080970e9 100644
--- a/rts/RetainerSet.c
+++ b/rts/RetainerSet.c
@@ -7,7 +7,7 @@
*
* ---------------------------------------------------------------------------*/
-#ifdef PROFILING
+#if defined(PROFILING)
#include "PosixSource.h"
#include "Rts.h"
@@ -78,7 +78,7 @@ initializeAllRetainerSet(void)
void
refreshAllRetainerSet(void)
{
-#ifdef FIRST_APPROACH
+#if defined(FIRST_APPROACH)
int i;
// first approach: completely refresh
@@ -145,7 +145,7 @@ addElement(retainer r, RetainerSet *rs)
RetainerSet *nrs; // New Retainer Set
StgWord hk; // Hash Key
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("addElement(%p, %p) = ", r, rs);
#endif
@@ -185,7 +185,7 @@ addElement(retainer r, RetainerSet *rs)
if (rs->element[i] != nrs->element[i + 1]) break;
if (i < rs->num) continue;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("%p\n", nrs);
#endif
// The set we are seeking already exists!
@@ -208,7 +208,7 @@ addElement(retainer r, RetainerSet *rs)
hashTable[hash(hk)] = nrs;
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// debugBelch("%p\n", nrs);
#endif
return nrs;
@@ -245,7 +245,7 @@ printRetainer(FILE *f, retainer cc)
* printRetainerSetShort() should always display the same output for
* a given retainer set regardless of the time of invocation.
* -------------------------------------------------------------------------- */
-#ifdef SECOND_APPROACH
+#if defined(SECOND_APPROACH)
#if defined(RETAINER_SCHEME_INFO)
// Retainer scheme 1: retainer = info table
void
@@ -411,7 +411,7 @@ printRetainerSetShort(FILE *f, retainerSet *rs, uint32_t max_length)
* of the run, so the user can find out for a given retainer set ID
* the full contents of that set.
* -------------------------------------------------------------------------- */
-#ifdef SECOND_APPROACH
+#if defined(SECOND_APPROACH)
void
outputAllRetainerSet(FILE *prof_file)
{
diff --git a/rts/RetainerSet.h b/rts/RetainerSet.h
index 38253a1e94..60b7c2e1d2 100644
--- a/rts/RetainerSet.h
+++ b/rts/RetainerSet.h
@@ -11,7 +11,7 @@
#include <stdio.h>
-#ifdef PROFILING
+#if defined(PROFILING)
#include "BeginPrivate.h"
@@ -41,16 +41,16 @@
#define RETAINER_SCHEME_CCS
// #define RETAINER_SCHEME_CC
-#ifdef RETAINER_SCHEME_INFO
+#if defined(RETAINER_SCHEME_INFO)
struct _StgInfoTable;
typedef struct _StgInfoTable *retainer;
#endif
-#ifdef RETAINER_SCHEME_CCS
+#if defined(RETAINER_SCHEME_CCS)
typedef CostCentreStack *retainer;
#endif
-#ifdef RETAINER_SCHEME_CC
+#if defined(RETAINER_SCHEME_CC)
typedef CostCentre *retainer;
#endif
@@ -83,7 +83,7 @@ typedef struct _RetainerSet {
that in the first approach, we do not free the memory allocated for
retainer sets; we just invalidate all retainer sets.
*/
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
// In thise case, FIRST_APPROACH must be turned on because the memory pool
// for retainer sets is freed each time.
#define FIRST_APPROACH
@@ -159,7 +159,7 @@ isMember(retainer r, RetainerSet *rs)
// Finds or creates a retainer set augmented with a new retainer.
RetainerSet *addElement(retainer, RetainerSet *);
-#ifdef SECOND_APPROACH
+#if defined(SECOND_APPROACH)
// Prints a single retainer set.
void printRetainerSetShort(FILE *, RetainerSet *, uint32_t);
#endif
@@ -168,7 +168,7 @@ void printRetainerSetShort(FILE *, RetainerSet *, uint32_t);
// store the sum of all costs and the number of all retainer sets.
void outputRetainerSet(FILE *, uint32_t *, uint32_t *);
-#ifdef SECOND_APPROACH
+#if defined(SECOND_APPROACH)
// Print all retainer sets at the exit of the program.
void outputAllRetainerSet(FILE *);
#endif
diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c
index 2ca5dc437f..533c0c41d4 100644
--- a/rts/RtsAPI.c
+++ b/rts/RtsAPI.c
@@ -555,7 +555,7 @@ rts_checkSchedStatus (char* site, Capability *cap)
stg_exit(EXIT_FAILURE);
case Interrupted:
errorBelch("%s: interrupted", site);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// The RTS is shutting down, and the process will probably
// soon exit. We don't want to preempt the shutdown
// by exiting the whole process here, so we just terminate the
diff --git a/rts/RtsDllMain.c b/rts/RtsDllMain.c
index 80241cd380..c844e6e65d 100644
--- a/rts/RtsDllMain.c
+++ b/rts/RtsDllMain.c
@@ -11,7 +11,7 @@
#include "RtsAPI.h"
#include "RtsDllMain.h"
-#ifdef HAVE_WINDOWS_H
+#if defined(HAVE_WINDOWS_H)
#include <windows.h>
#endif
diff --git a/rts/RtsDllMain.h b/rts/RtsDllMain.h
index 4b9480dd85..05538cb062 100644
--- a/rts/RtsDllMain.h
+++ b/rts/RtsDllMain.h
@@ -1,6 +1,6 @@
#include "Rts.h"
-#ifdef HAVE_WINDOWS_H
+#if defined(HAVE_WINDOWS_H)
#include <windows.h>
#endif
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index 8d713542cc..b51d644bdc 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -17,17 +17,17 @@
#include "hooks/Hooks.h"
#include "Capability.h"
-#ifdef HAVE_CTYPE_H
+#if defined(HAVE_CTYPE_H)
#include <ctype.h>
#endif
#include <string.h>
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
@@ -97,15 +97,15 @@ static StgWord64 decodeSize (
static void bad_option (const char *s);
-#ifdef DEBUG
+#if defined(DEBUG)
static void read_debug_flags(const char *arg);
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
static bool read_heap_profiling_flag(const char *arg);
#endif
-#ifdef TRACING
+#if defined(TRACING)
static void read_trace_flags(const char *arg);
#endif
@@ -153,7 +153,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.GcFlags.compactThreshold = 30.0;
RtsFlags.GcFlags.sweep = false;
RtsFlags.GcFlags.idleGCDelayTime = USToTime(300000); // 300ms
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
RtsFlags.GcFlags.doIdleGC = true;
#else
RtsFlags.GcFlags.doIdleGC = false;
@@ -189,7 +189,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.ProfFlags.doHeapProfile = false;
RtsFlags.ProfFlags. heapProfileInterval = USToTime(100000); // 100ms
-#ifdef PROFILING
+#if defined(PROFILING)
RtsFlags.ProfFlags.includeTSOs = false;
RtsFlags.ProfFlags.showCCSOnException = false;
RtsFlags.ProfFlags.maxRetainerSetSize = 8;
@@ -203,7 +203,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.ProfFlags.bioSelector = NULL;
#endif
-#ifdef TRACING
+#if defined(TRACING)
RtsFlags.TraceFlags.tracing = TRACE_NONE;
RtsFlags.TraceFlags.timestamp = false;
RtsFlags.TraceFlags.scheduler = false;
@@ -213,7 +213,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.TraceFlags.user = false;
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
// When profiling we want a lot more ticks
RtsFlags.MiscFlags.tickInterval = USToTime(1000); // 1ms
#else
@@ -225,7 +225,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.MiscFlags.machineReadable = false;
RtsFlags.MiscFlags.linkerMemBase = 0;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
RtsFlags.ParFlags.nCapabilities = 1;
RtsFlags.ParFlags.migrate = true;
RtsFlags.ParFlags.parGcEnabled = 1;
@@ -241,7 +241,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.ParFlags.maxLocalSparks = 4096;
#endif /* THREADED_RTS */
-#ifdef TICKY_TICKY
+#if defined(TICKY_TICKY)
RtsFlags.TickyFlags.showTickyStats = false;
RtsFlags.TickyFlags.tickyFile = NULL;
#endif
@@ -333,10 +333,10 @@ usage_text[] = {
" -xc Show current cost centre stack on raising an exception",
#endif /* PROFILING */
-#ifdef TRACING
+#if defined(TRACING)
"",
" -l[flags] Log events in binary format to the file <program>.eventlog",
-# ifdef DEBUG
+# if defined(DEBUG)
" -v[flags] Log events to stderr",
# endif
" where [flags] can contain:",
@@ -346,7 +346,7 @@ usage_text[] = {
" f par spark events (full detail)",
" u user events (emitted from Haskell code)",
" a all event classes above",
-# ifdef DEBUG
+# if defined(DEBUG)
" t add time stamps (only useful with -v)",
# endif
" -x disable an event class, for any flag above",
@@ -369,7 +369,7 @@ usage_text[] = {
" -V<secs> Master tick interval in seconds (0 == disable timer).",
" This sets the resolution for -C and the heap profile timer -i,",
" and is the frequence of time profile samples.",
-#ifdef PROFILING
+#if defined(PROFILING)
" Default: 0.001 sec.",
#else
" Default: 0.01 sec.",
@@ -618,7 +618,7 @@ void setupRtsFlags (int *argc, char *argv[], RtsConfig rts_config)
if (RtsFlags.GcFlags.statsFile != NULL) {
initStatsFile (RtsFlags.GcFlags.statsFile);
}
-#ifdef TICKY_TICKY
+#if defined(TICKY_TICKY)
if (RtsFlags.TickyFlags.tickyFile != NULL) {
initStatsFile (RtsFlags.TickyFlags.tickyFile);
}
@@ -703,7 +703,7 @@ static void procRtsOpts (int rts_argc0,
x*, which allows for more options.
*/
-#ifdef TICKY_TICKY
+#if defined(TICKY_TICKY)
# define TICKY_BUILD_ONLY(x) x
#else
# define TICKY_BUILD_ONLY(x) \
@@ -712,7 +712,7 @@ errorBelch("the flag %s requires the program to be built with -ticky", \
error = true;
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
# define PROFILING_BUILD_ONLY(x) x
#else
# define PROFILING_BUILD_ONLY(x) \
@@ -721,7 +721,7 @@ errorBelch("the flag %s requires the program to be built with -prof", \
error = true;
#endif
-#ifdef TRACING
+#if defined(TRACING)
# define TRACING_BUILD_ONLY(x) x
#else
# define TRACING_BUILD_ONLY(x) \
@@ -730,7 +730,7 @@ errorBelch("the flag %s requires the program to be built with -eventlog or -debu
error = true;
#endif
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
# define THREADED_BUILD_ONLY(x) x
#else
# define THREADED_BUILD_ONLY(x) \
@@ -739,7 +739,7 @@ errorBelch("the flag %s requires the program to be built with -threaded", \
error = true;
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
# define DEBUG_BUILD_ONLY(x) x
#else
# define DEBUG_BUILD_ONLY(x) \
@@ -1637,7 +1637,7 @@ decodeSize(const char *flag, uint32_t offset, StgWord64 min, StgWord64 max)
return val;
}
-#ifdef DEBUG
+#if defined(DEBUG)
static void read_debug_flags(const char* arg)
{
// Already parsed "-D"
@@ -1702,7 +1702,7 @@ static void read_debug_flags(const char* arg)
}
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
// Parse a "-h" flag, returning whether the parse resulted in an error.
static bool read_heap_profiling_flag(const char *arg)
{
diff --git a/rts/RtsMain.c b/rts/RtsMain.c
index 48df8e9db7..d9f05576a0 100644
--- a/rts/RtsMain.c
+++ b/rts/RtsMain.c
@@ -17,14 +17,14 @@
#include "Task.h"
#include "Excn.h"
-#ifdef DEBUG
+#if defined(DEBUG)
# include "Printer.h" /* for printing */
#endif
// Hack: we assume that we're building a batch-mode system unless
// INTERPRETER is set
-#ifndef INTERPRETER /* Hack */
+#if !defined(INTERPRETER) /* Hack */
// The rts entry point from a compiled program using a Haskell main
// function. This gets called from a tiny main function generated by
diff --git a/rts/RtsMessages.c b/rts/RtsMessages.c
index 0440669986..0859e5093b 100644
--- a/rts/RtsMessages.c
+++ b/rts/RtsMessages.c
@@ -19,7 +19,7 @@
#include <string.h>
#include <errno.h>
-#ifdef HAVE_WINDOWS_H
+#if defined(HAVE_WINDOWS_H)
#include <windows.h>
#endif
@@ -175,7 +175,7 @@ rtsFatalInternalErrorFn(const char *s, va_list ap)
fflush(stderr);
}
-#ifdef TRACING
+#if defined(TRACING)
if (RtsFlags.TraceFlags.tracing == TRACE_EVENTLOG) endEventLogging();
#endif
diff --git a/rts/RtsProbes.d b/rts/RtsProbes.d
index 226f881117..e5d8378845 100644
--- a/rts/RtsProbes.d
+++ b/rts/RtsProbes.d
@@ -6,7 +6,7 @@
*
* ---------------------------------------------------------------------------*/
-#ifdef __APPLE__ && __MACH__
+#if defined(__APPLE__) && __MACH__
# if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
# define USE_INTTYPES_H_FOR_RTS_PROBES_D
# endif
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 36a99d7a56..71a842d0a9 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -53,10 +53,10 @@
#include "posix/TTY.h"
#endif
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
-#ifdef HAVE_LOCALE_H
+#if defined(HAVE_LOCALE_H)
#include <locale.h>
#endif
@@ -111,7 +111,7 @@ void _fpreset(void)
x86_init_fpu();
}
-#ifdef __GNUC__
+#if defined(__GNUC__)
void __attribute__((alias("_fpreset"))) fpreset(void);
#else
void fpreset(void) {
@@ -186,7 +186,7 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
setFullProgArgv(*argc,*argv);
setupRtsFlags(argc, *argv, rts_config);
-#ifdef DEBUG
+#if defined(DEBUG)
/* load debugging symbols for current binary */
DEBUG_LoadSymbols((*argv)[0]);
#endif /* DEBUG */
@@ -196,7 +196,7 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
initStats1();
/* initTracing must be after setupRtsFlags() */
-#ifdef TRACING
+#if defined(TRACING)
initTracing();
#endif
@@ -243,7 +243,7 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
getStablePtr((StgPtr)runSparks_closure);
getStablePtr((StgPtr)ensureIOManagerIsRunning_closure);
getStablePtr((StgPtr)ioManagerCapabilitiesChanged_closure);
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
getStablePtr((StgPtr)blockedOnBadFD_closure);
getStablePtr((StgPtr)runHandlersPtr_closure);
#endif
@@ -431,14 +431,14 @@ hs_exit_(bool wait_foreign)
endProfiling();
freeProfiling();
-#ifdef PROFILING
+#if defined(PROFILING)
// Originally, this was in report_ccs_profiling(). Now, retainer
// profiling might tack some extra stuff on to the end of this file
// during endProfiling().
if (prof_file != NULL) fclose(prof_file);
#endif
-#ifdef TRACING
+#if defined(TRACING)
endTracing();
freeTracing();
#endif
@@ -515,7 +515,7 @@ shutdownHaskellAndExit(int n, int fastExit)
stg_exit(n);
}
-#ifndef mingw32_HOST_OS
+#if !defined(mingw32_HOST_OS)
static void exitBySignal(int sig) GNUC3_ATTRIBUTE(__noreturn__);
void
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
index dac801d5c2..11b1437f77 100644
--- a/rts/RtsSymbols.c
+++ b/rts/RtsSymbols.c
@@ -286,7 +286,7 @@
#define RTS_OPENBSD_ONLY_SYMBOLS
#endif
-#ifndef SMP
+#if !defined(SMP)
# define MAIN_CAP_SYM SymI_HasProto(MainCapability)
#else
# define MAIN_CAP_SYM
@@ -325,7 +325,7 @@
SymE_NeedsDataProto(ffi_type_uint8) \
SymE_NeedsDataProto(ffi_type_pointer)
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define RTS_RET_SYMBOLS /* nothing */
#else
#define RTS_RET_SYMBOLS \
diff --git a/rts/RtsSymbols.h b/rts/RtsSymbols.h
index c2b2f07d94..650b1f5fed 100644
--- a/rts/RtsSymbols.h
+++ b/rts/RtsSymbols.h
@@ -12,7 +12,7 @@
#include "LinkerInternals.h"
#include <stdbool.h>
-#ifdef LEADING_UNDERSCORE
+#if defined(LEADING_UNDERSCORE)
#define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s)
#else
#define MAYBE_LEADING_UNDERSCORE_STR(s) (s)
diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c
index b7a02189af..5357dc635e 100644
--- a/rts/RtsUtils.c
+++ b/rts/RtsUtils.c
@@ -15,7 +15,7 @@
#include "Schedule.h"
#include "RtsFlags.h"
-#ifdef HAVE_TIME_H
+#if defined(HAVE_TIME_H)
#include <time.h>
#endif
@@ -26,11 +26,11 @@
extern char *ctime_r(const time_t *, char *);
#endif
-#ifdef HAVE_FCNTL_H
+#if defined(HAVE_FCNTL_H)
#include <fcntl.h>
#endif
-#ifdef HAVE_GETTIMEOFDAY
+#if defined(HAVE_GETTIMEOFDAY)
#include <sys/time.h>
#endif
@@ -39,7 +39,7 @@ extern char *ctime_r(const time_t *, char *);
#include <stdarg.h>
#include <stdio.h>
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
#include <signal.h>
#endif
@@ -253,7 +253,7 @@ showStgWord64(StgWord64 x, char *s, bool with_commas)
// Can be used as a breakpoint to set on every heap check failure.
-#ifdef DEBUG
+#if defined(DEBUG)
void
heapCheckFail( void )
{
@@ -313,7 +313,7 @@ void printRtsInfo(void) {
// profiled or not. GHCi uses it (see #2197).
int rts_isProfiled(void)
{
-#ifdef PROFILING
+#if defined(PROFILING)
return 1;
#else
return 0;
@@ -324,7 +324,7 @@ int rts_isProfiled(void)
// dynamically-linked or not.
int rts_isDynamic(void)
{
-#ifdef DYNAMIC
+#if defined(DYNAMIC)
return 1;
#else
return 0;
@@ -334,7 +334,7 @@ int rts_isDynamic(void)
// Used for detecting a non-empty FPU stack on x86 (see #4914)
void checkFPUStack(void)
{
-#ifdef i386_HOST_ARCH
+#if defined(i386_HOST_ARCH)
static unsigned char buf[108];
asm("FSAVE %0":"=m" (buf));
diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h
index 4b513cc1ba..8d880c6e19 100644
--- a/rts/RtsUtils.h
+++ b/rts/RtsUtils.h
@@ -36,7 +36,7 @@ void stgFree(void* p);
char *time_str(void);
char *showStgWord64(StgWord64, char *, bool);
-#ifdef DEBUG
+#if defined(DEBUG)
void heapCheckFail( void );
#endif
diff --git a/rts/SMPClosureOps.h b/rts/SMPClosureOps.h
index 4ade2d018a..4ea1c55976 100644
--- a/rts/SMPClosureOps.h
+++ b/rts/SMPClosureOps.h
@@ -10,7 +10,7 @@
#include "BeginPrivate.h"
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
/* Lock closure, equivalent to ccall lockClosure but the condition is inlined.
* Arguments are swapped for uniformity with unlockClosure. */
diff --git a/rts/STM.c b/rts/STM.c
index f845b11161..5c8fd4ff40 100644
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -113,7 +113,7 @@
// If SHAKE is defined then validation will sometimes spuriously fail. They help test
// unusual code paths if genuine contention is rare
-#ifdef SHAKE
+#if defined(SHAKE)
static int shake_ctr = 0;
static int shake_lim = 1;
diff --git a/rts/STM.h b/rts/STM.h
index e9e5e27cd9..2484c2f991 100644
--- a/rts/STM.h
+++ b/rts/STM.h
@@ -32,7 +32,7 @@
#pragma once
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
//#define STM_CG_LOCK
#define STM_FG_LOCKS
#else
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 296461b38d..0a1d761b6a 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -44,10 +44,10 @@
#include "Stable.h"
#include "TopHandler.h"
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
@@ -55,11 +55,11 @@
#include <stdlib.h>
#include <stdarg.h>
-#ifdef HAVE_ERRNO_H
+#if defined(HAVE_ERRNO_H)
#include <errno.h>
#endif
-#ifdef TRACING
+#if defined(TRACING)
#include "eventlog/EventLog.h"
#endif
/* -----------------------------------------------------------------------------
@@ -154,7 +154,7 @@ static void scheduleDoGC(Capability **pcap, Task *task, bool force_major);
static void deleteThread (Capability *cap, StgTSO *tso);
static void deleteAllThreads (Capability *cap);
-#ifdef FORKPROCESS_PRIMOP_SUPPORTED
+#if defined(FORKPROCESS_PRIMOP_SUPPORTED)
static void deleteThread_(Capability *cap, StgTSO *tso);
#endif
@@ -375,7 +375,7 @@ schedule (Capability *initialCapability, Task *task)
// them back if it rises again. Presumably we should, but after
// the thread has been migrated we no longer know what capability
// it was originally on.
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (cap->disabled && !t->bound) {
Capability *dest_cap = capabilities[cap->no % enabled_capabilities];
migrateThread(cap, t, dest_cap);
@@ -411,7 +411,7 @@ run_thread:
prev_what_next = t->what_next;
errno = t->saved_errno;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
SetLastError(t->saved_winerror);
#endif
@@ -432,7 +432,7 @@ run_thread:
uint32_t prev;
prev = xchg((P_)&recent_activity, ACTIVITY_YES);
if (prev == ACTIVITY_DONE_GC) {
-#ifndef PROFILING
+#if !defined(PROFILING)
startTimer();
#endif
}
@@ -490,7 +490,7 @@ run_thread:
// XXX: possibly bogus for SMP because this thread might already
// be running again, see code below.
t->saved_errno = errno;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
// Similarly for Windows error code
t->saved_winerror = GetLastError();
#endif
@@ -1267,7 +1267,7 @@ scheduleHandleThreadBlocked( StgTSO *t
// threadPaused() might have raised a blocked throwTo
// exception, see maybePerformBlockedException().
-#ifdef DEBUG
+#if defined(DEBUG)
traceThreadStatus(DEBUG_sched, t);
#endif
}
@@ -1341,7 +1341,7 @@ scheduleHandleThreadFinished (Capability *cap STG_UNUSED, Task *task, StgTSO *t)
task->incall->rstat = Killed;
}
}
-#ifdef DEBUG
+#if defined(DEBUG)
removeThreadLabel((StgWord)task->incall->tso->id);
#endif
@@ -1471,7 +1471,7 @@ static bool requestSync (
* ensue if another thread is trying to synchronise.
* -------------------------------------------------------------------------- */
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static void acquireAllCapabilities(Capability *cap, Task *task)
{
Capability *tmpcap;
@@ -1506,7 +1506,7 @@ static void acquireAllCapabilities(Capability *cap, Task *task)
* the one passed in as cap.
* -------------------------------------------------------------------------- */
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static void releaseAllCapabilities(uint32_t n, Capability *cap, Task *task)
{
uint32_t i;
@@ -1533,7 +1533,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
bool heap_census;
uint32_t collect_gen;
bool major_gc;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
uint32_t gc_type;
uint32_t i;
uint32_t need_idle;
@@ -1560,7 +1560,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
collect_gen = calcNeeded(force_major || heap_census, NULL);
major_gc = (collect_gen == RtsFlags.GcFlags.generations-1);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (sched_state < SCHED_INTERRUPTING
&& RtsFlags.ParFlags.parGcEnabled
&& collect_gen >= RtsFlags.ParFlags.parGcGen
@@ -1673,7 +1673,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
stat_startGCSync(gc_threads[cap->no]);
-#ifdef DEBUG
+#if defined(DEBUG)
unsigned int old_n_capabilities = n_capabilities;
#endif
@@ -1833,7 +1833,7 @@ delete_threads_and_gc:
// fact that we've done a GC and turn off the timer signal;
// it will get re-enabled if we run any threads after the GC.
recent_activity = ACTIVITY_DONE_GC;
-#ifndef PROFILING
+#if !defined(PROFILING)
stopTimer();
#endif
break;
@@ -1934,7 +1934,7 @@ delete_threads_and_gc:
throwToSelf(cap, main_thread, heapOverflow_closure);
}
}
-#ifdef SPARKBALANCE
+#if defined(SPARKBALANCE)
/* JB
Once we are all together... this would be the place to balance all
spark pools. No concurrent stealing or adding of new sparks can
@@ -1960,12 +1960,12 @@ delete_threads_and_gc:
pid_t
forkProcess(HsStablePtr *entry
-#ifndef FORKPROCESS_PRIMOP_SUPPORTED
+#if !defined(FORKPROCESS_PRIMOP_SUPPORTED)
STG_UNUSED
#endif
)
{
-#ifdef FORKPROCESS_PRIMOP_SUPPORTED
+#if defined(FORKPROCESS_PRIMOP_SUPPORTED)
pid_t pid;
StgTSO* t,*next;
Capability *cap;
@@ -1980,7 +1980,7 @@ forkProcess(HsStablePtr *entry
cap = NULL;
waitForCapability(&cap, task);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
stopAllCapabilities(&cap, task);
#endif
@@ -1997,7 +1997,7 @@ forkProcess(HsStablePtr *entry
ACQUIRE_LOCK(&capabilities[i]->lock);
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
ACQUIRE_LOCK(&all_tasks_mutex);
#endif
@@ -2023,7 +2023,7 @@ forkProcess(HsStablePtr *entry
RELEASE_LOCK(&capabilities[i]->lock);
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
RELEASE_LOCK(&all_tasks_mutex);
#endif
@@ -2047,7 +2047,7 @@ forkProcess(HsStablePtr *entry
initMutex(&all_tasks_mutex);
#endif
-#ifdef TRACING
+#if defined(TRACING)
resetTracing();
#endif
@@ -2374,12 +2374,12 @@ suspendThread (StgRegTable *reg, bool interruptible)
int saved_errno;
StgTSO *tso;
Task *task;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
StgWord32 saved_winerror;
#endif
saved_errno = errno;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
saved_winerror = GetLastError();
#endif
@@ -2419,7 +2419,7 @@ suspendThread (StgRegTable *reg, bool interruptible)
RELEASE_LOCK(&cap->lock);
errno = saved_errno;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
SetLastError(saved_winerror);
#endif
return task;
@@ -2433,12 +2433,12 @@ resumeThread (void *task_)
Capability *cap;
Task *task = task_;
int saved_errno;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
StgWord32 saved_winerror;
#endif
saved_errno = errno;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
saved_winerror = GetLastError();
#endif
@@ -2475,7 +2475,7 @@ resumeThread (void *task_)
cap->r.rCurrentTSO = tso;
cap->in_haskell = true;
errno = saved_errno;
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
SetLastError(saved_winerror);
#endif
@@ -2816,7 +2816,7 @@ deleteThread (Capability *cap STG_UNUSED, StgTSO *tso)
}
}
-#ifdef FORKPROCESS_PRIMOP_SUPPORTED
+#if defined(FORKPROCESS_PRIMOP_SUPPORTED)
static void
deleteThread_(Capability *cap, StgTSO *tso)
{ // for forkProcess only:
diff --git a/rts/Stable.c b/rts/Stable.c
index 85970c809a..ecf216a550 100644
--- a/rts/Stable.c
+++ b/rts/Stable.c
@@ -115,7 +115,7 @@ static unsigned int SPT_size = 0;
static spEntry *old_SPTs[MAX_N_OLD_SPTS];
static uint32_t n_old_SPTs = 0;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
Mutex stable_mutex;
#endif
@@ -196,7 +196,7 @@ initStableTables(void)
"initStablePtrTable");
initSpEntryFreeList(stable_ptr_table,INIT_SPT_SIZE,NULL);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&stable_mutex);
#endif
}
@@ -300,7 +300,7 @@ exitStableTables(void)
freeOldSPTs();
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeMutex(&stable_mutex);
#endif
}
diff --git a/rts/Stable.h b/rts/Stable.h
index 5535637fa3..399a2b3877 100644
--- a/rts/Stable.h
+++ b/rts/Stable.h
@@ -43,7 +43,7 @@ void updateStableTables ( bool full );
void stableLock ( void );
void stableUnlock ( void );
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// needed by Schedule.c:forkProcess()
extern Mutex stable_mutex;
#endif
diff --git a/rts/StaticPtrTable.c b/rts/StaticPtrTable.c
index b793b9c56c..5d2737a262 100644
--- a/rts/StaticPtrTable.c
+++ b/rts/StaticPtrTable.c
@@ -16,7 +16,7 @@
static HashTable * spt = NULL;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static Mutex spt_lock;
#endif
@@ -38,7 +38,7 @@ void hs_spt_insert_stableptr(StgWord64 key[2], StgStablePtr *entry) {
spt = allocHashTable_( (HashFunction *)hashFingerprint
, (CompareFunction *)compareFingerprint
);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&spt_lock);
#endif
}
@@ -104,7 +104,7 @@ void exitStaticPtrTable() {
if (spt) {
freeHashTable(spt, freeSptEntry);
spt = NULL;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeMutex(&spt_lock);
#endif
}
diff --git a/rts/Stats.c b/rts/Stats.c
index 5f5fa58ee8..e31d124c57 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -29,7 +29,7 @@ static Time
start_exit_gc_elapsed, start_exit_gc_cpu,
end_exit_cpu, end_exit_elapsed;
-#ifdef PROFILING
+#if defined(PROFILING)
static Time RP_start_time = 0, RP_tot_time = 0; // retainer prof user time
static Time RPe_start_time = 0, RPe_tot_time = 0; // retainer prof elap time
@@ -37,7 +37,7 @@ static Time HC_start_time, HC_tot_time = 0; // heap census prof user time
static Time HCe_start_time, HCe_tot_time = 0; // heap census prof elap time
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
#define PROF_VAL(x) (x)
#else
#define PROF_VAL(x) 0
@@ -90,7 +90,7 @@ mut_user_time( void )
return mut_user_time_until(cpu);
}
-#ifdef PROFILING
+#if defined(PROFILING)
/*
mut_user_time_during_RP() returns the MUT time during retainer profiling.
The same is for mut_user_time_during_HC();
@@ -122,7 +122,7 @@ initStats0(void)
end_exit_cpu = 0;
end_exit_elapsed = 0;
-#ifdef PROFILING
+#if defined(PROFILING)
RP_start_time = 0;
RP_tot_time = 0;
RPe_start_time = 0;
@@ -430,7 +430,7 @@ stat_endGC (Capability *cap, gc_thread *gct,
/* -----------------------------------------------------------------------------
Called at the beginning of each Retainer Profiliing
-------------------------------------------------------------------------- */
-#ifdef PROFILING
+#if defined(PROFILING)
void
stat_startRP(void)
{
@@ -446,11 +446,11 @@ stat_startRP(void)
Called at the end of each Retainer Profiliing
-------------------------------------------------------------------------- */
-#ifdef PROFILING
+#if defined(PROFILING)
void
stat_endRP(
uint32_t retainerGeneration,
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
uint32_t maxCStackSize,
int maxStackSize,
#endif
@@ -464,7 +464,7 @@ stat_endRP(
fprintf(prof_file, "Retainer Profiling: %d, at %f seconds\n",
retainerGeneration, mut_user_time_during_RP());
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
fprintf(prof_file, "\tMax C stack size = %u\n", maxCStackSize);
fprintf(prof_file, "\tMax auxiliary stack size = %u\n", maxStackSize);
#endif
@@ -475,7 +475,7 @@ stat_endRP(
/* -----------------------------------------------------------------------------
Called at the beginning of each heap census
-------------------------------------------------------------------------- */
-#ifdef PROFILING
+#if defined(PROFILING)
void
stat_startHeapCensus(void)
{
@@ -490,7 +490,7 @@ stat_startHeapCensus(void)
/* -----------------------------------------------------------------------------
Called at the end of each heap census
-------------------------------------------------------------------------- */
-#ifdef PROFILING
+#if defined(PROFILING)
void
stat_endHeapCensus(void)
{
@@ -510,7 +510,7 @@ stat_endHeapCensus(void)
were left unused when the heap-check failed.
-------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
#define TICK_VAR_INI(arity) \
StgInt SLOW_CALLS_##arity = 1; \
StgInt RIGHT_ARITY_##arity = 1; \
@@ -708,7 +708,7 @@ stat_exit (void)
statsPrintf(" GC time %7.3fs (%7.3fs elapsed)\n",
TimeToSecondsDbl(gc_cpu), TimeToSecondsDbl(gc_elapsed));
-#ifdef PROFILING
+#if defined(PROFILING)
statsPrintf(" RP time %7.3fs (%7.3fs elapsed)\n",
TimeToSecondsDbl(RP_tot_time), TimeToSecondsDbl(RPe_tot_time));
statsPrintf(" PROF time %7.3fs (%7.3fs elapsed)\n",
@@ -718,7 +718,7 @@ stat_exit (void)
TimeToSecondsDbl(exit_cpu), TimeToSecondsDbl(exit_elapsed));
statsPrintf(" Total time %7.3fs (%7.3fs elapsed)\n\n",
TimeToSecondsDbl(tot_cpu), TimeToSecondsDbl(tot_elapsed));
-#ifndef THREADED_RTS
+#if !defined(THREADED_RTS)
statsPrintf(" %%GC time %5.1f%% (%.1f%% elapsed)\n\n",
TimeToSecondsDbl(gc_cpu)*100/TimeToSecondsDbl(tot_cpu),
TimeToSecondsDbl(gc_elapsed)*100/TimeToSecondsDbl(tot_elapsed));
diff --git a/rts/Stats.h b/rts/Stats.h
index 7ccb7c4616..ff018716c4 100644
--- a/rts/Stats.h
+++ b/rts/Stats.h
@@ -32,10 +32,10 @@ void stat_endGC (Capability *cap, struct gc_thread_ *_gct, W_ live,
W_ copied, W_ slop, uint32_t gen, uint32_t n_gc_threads,
W_ par_max_copied);
-#ifdef PROFILING
+#if defined(PROFILING)
void stat_startRP(void);
void stat_endRP(uint32_t,
-#ifdef DEBUG_RETAINER
+#if defined(DEBUG_RETAINER)
uint32_t, int,
#endif
double);
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 5f7f2b910f..2166249c2a 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -59,12 +59,12 @@
#include "StgRun.h"
#include "Capability.h"
-#ifdef DEBUG
+#if defined(DEBUG)
#include "RtsUtils.h"
#include "Printer.h"
#endif
-#ifdef USE_MINIINTERPRETER
+#if defined(USE_MINIINTERPRETER)
/* -----------------------------------------------------------------------------
any architecture (using miniinterpreter)
@@ -90,7 +90,7 @@ StgFunPtr StgReturn(void)
#else /* !USE_MINIINTERPRETER */
-#ifdef LEADING_UNDERSCORE
+#if defined(LEADING_UNDERSCORE)
#define STG_RUN "_StgRun"
#define STG_RETURN "_StgReturn"
#else
@@ -114,7 +114,7 @@ StgWord8 *win32AllocStack(void)
x86 architecture
-------------------------------------------------------------------------- */
-#ifdef i386_HOST_ARCH
+#if defined(i386_HOST_ARCH)
#if defined(darwin_HOST_OS) || defined(ios_HOST_OS)
#define STG_GLOBAL ".globl "
@@ -241,7 +241,7 @@ StgRunIsImplementedInAssembler(void)
enough space. Oh well, it's not much harder this way.
------------------------------------------------------------------------- */
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
#define STG_GLOBAL ".globl "
@@ -360,7 +360,7 @@ StgRunIsImplementedInAssembler(void)
Updated info (GHC 4.08.2): not saving %i7 any more (see below).
-------------------------------------------------------------------------- */
-#ifdef sparc_HOST_ARCH
+#if defined(sparc_HOST_ARCH)
StgRegTable *
StgRun(StgFunPtr f, StgRegTable *basereg) {
@@ -409,7 +409,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
Everything is in assembler, so we don't have to deal with GCC...
-------------------------------------------------------------------------- */
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
#define STG_GLOBAL ".globl "
@@ -538,9 +538,9 @@ StgRunIsImplementedInAssembler(void)
Everything is in assembler, so we don't have to deal with GCC...
-------------------------------------------------------------------------- */
-#ifdef powerpc64_HOST_ARCH
+#if defined(powerpc64_HOST_ARCH)
-#ifdef linux_HOST_OS
+#if defined(linux_HOST_OS)
static void GNUC3_ATTRIBUTE(used)
StgRunIsImplementedInAssembler(void)
{
@@ -668,7 +668,7 @@ StgRunIsImplementedInAssembler(void)
#endif
-#ifdef powerpc64le_HOST_ARCH
+#if defined(powerpc64le_HOST_ARCH)
/* -----------------------------------------------------------------------------
PowerPC 64 little endian architecture
@@ -680,7 +680,7 @@ StgRunIsImplementedInAssembler(void)
ARM architecture
-------------------------------------------------------------------------- */
-#ifdef arm_HOST_ARCH
+#if defined(arm_HOST_ARCH)
#if defined(__thumb__)
#define THUMB_FUNC ".thumb\n\t.thumb_func\n\t"
@@ -757,7 +757,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
}
#endif
-#ifdef aarch64_HOST_ARCH
+#if defined(aarch64_HOST_ARCH)
StgRegTable *
StgRun(StgFunPtr f, StgRegTable *basereg) {
diff --git a/rts/StgStartup.cmm b/rts/StgStartup.cmm
index 3a80e45bed..a650e5c367 100644
--- a/rts/StgStartup.cmm
+++ b/rts/StgStartup.cmm
@@ -72,7 +72,7 @@ INFO_TABLE_RET(stg_stop_thread, STOP_FRAME,
need to identify the platform stack pointer and return address values for
the StgRun's caller.
*/
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
// offset of 8 in MachSp value due to return address
unwind MachSp = MachSp + RESERVED_C_STACK_BYTES + STG_RUN_STACK_FRAME_SIZE + 8,
UnwindReturnReg = W_[MachSp + RESERVED_C_STACK_BYTES + STG_RUN_STACK_FRAME_SIZE];
diff --git a/rts/StgStdThunks.cmm b/rts/StgStdThunks.cmm
index 208c8d6ada..204cd1a04e 100644
--- a/rts/StgStdThunks.cmm
+++ b/rts/StgStdThunks.cmm
@@ -27,7 +27,7 @@
matching.
-------------------------------------------------------------------------- */
-#ifdef PROFILING
+#if defined(PROFILING)
#define SAVE_CCS W_ saved_ccs; saved_ccs = CCCS;
#define RESTORE_CCS CCCS = saved_ccs;
#else
@@ -48,7 +48,7 @@
* so we untag it before accessing the field.
*
*/
-#ifdef PROFILING
+#if defined(PROFILING)
/* When profiling, we cannot shortcut by checking the tag,
* because LDV profiling relies on entering closures to mark them as
* "used".
diff --git a/rts/Task.c b/rts/Task.c
index b8df4d2215..4376148c7a 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -334,7 +334,7 @@ boundTaskExiting (Task *task)
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
#define TASK_ID(t) (t)->id
#else
#define TASK_ID(t) (t)
@@ -501,7 +501,7 @@ void rts_setInCallCapability (
Task *task = getTask();
task->preferred_capability = preferred_capability;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (affinity) {
if (RtsFlags.ParFlags.setAffinity) {
setThreadAffinity(preferred_capability, n_capabilities);
@@ -513,7 +513,7 @@ void rts_setInCallCapability (
void rts_pinThreadToNumaNode (
int node USED_IF_THREADS)
{
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (RtsFlags.GcFlags.numa) {
Task *task = getTask();
task->node = capNoToNumaNode(node);
@@ -524,7 +524,7 @@ void rts_pinThreadToNumaNode (
#endif
}
-#ifdef DEBUG
+#if defined(DEBUG)
void printAllTasks(void);
diff --git a/rts/ThreadPaused.c b/rts/ThreadPaused.c
index c270e69a51..4ebc6328e2 100644
--- a/rts/ThreadPaused.c
+++ b/rts/ThreadPaused.c
@@ -240,7 +240,7 @@ threadPaused(Capability *cap, StgTSO *tso)
bh = ((StgUpdateFrame *)frame)->updatee;
bh_info = bh->header.info;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
retry:
#endif
// Note [suspend duplicate work]
@@ -311,7 +311,7 @@ threadPaused(Capability *cap, StgTSO *tso)
// an EAGER_BLACKHOLE or CAF_BLACKHOLE gets turned into a
// BLACKHOLE here.
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// first we turn it into a WHITEHOLE to claim it, and if
// successful we write our TSO and then the BLACKHOLE info pointer.
cur_bh_info = (const StgInfoTable *)
diff --git a/rts/Threads.c b/rts/Threads.c
index 9cfd36a7c9..c87551180b 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -112,7 +112,7 @@ createThread(Capability *cap, W_ size)
tso->trec = NO_TREC;
-#ifdef PROFILING
+#if defined(PROFILING)
tso->prof.cccs = CCS_MAIN;
#endif
@@ -263,7 +263,7 @@ tryWakeupThread (Capability *cap, StgTSO *tso)
{
traceEventThreadWakeup (cap, tso, tso->cap->no);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (tso->cap != cap)
{
MessageWakeup *msg;
@@ -826,7 +826,7 @@ loop:
* Debugging: why is a thread blocked
* ------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
void
printThreadBlockage(StgTSO *tso)
{
diff --git a/rts/Threads.h b/rts/Threads.h
index faef2cbbc8..600d4eaff0 100644
--- a/rts/Threads.h
+++ b/rts/Threads.h
@@ -22,7 +22,7 @@ void migrateThread (Capability *from, StgTSO *tso, Capability *to);
// Wakes up a thread on a Capability (probably a different Capability
// from the one held by the current Task).
//
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
void wakeupThreadOnCapability (Capability *cap,
Capability *other_cap,
StgTSO *tso);
@@ -42,7 +42,7 @@ W_ threadStackUnderflow (Capability *cap, StgTSO *tso);
bool performTryPutMVar(Capability *cap, StgMVar *mvar, StgClosure *value);
-#ifdef DEBUG
+#if defined(DEBUG)
void printThreadBlockage (StgTSO *tso);
void printThreadStatus (StgTSO *t);
void printAllThreads (void);
diff --git a/rts/Timer.c b/rts/Timer.c
index a8b0e20a5f..8e2fb4a835 100644
--- a/rts/Timer.c
+++ b/rts/Timer.c
@@ -65,7 +65,7 @@ handle_tick(int unused STG_UNUSED)
if (ticks_to_gc == 0) {
if (RtsFlags.GcFlags.doIdleGC) {
recent_activity = ACTIVITY_INACTIVE;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
wakeUpRts();
// The scheduler will call stopTimer() when it has done
// the GC.
@@ -76,7 +76,7 @@ handle_tick(int unused STG_UNUSED)
// but only if we're not profiling (e.g. passed -h or -p RTS
// flags). If we are profiling we need to keep the timer active
// so that samples continue to be collected.
-#ifdef PROFILING
+#if defined(PROFILING)
if (!(RtsFlags.ProfFlags.doHeapProfile
|| RtsFlags.CcFlags.doCostCentres)) {
stopTimer();
diff --git a/rts/TopHandler.c b/rts/TopHandler.c
index ff53b32338..8e868e6e92 100644
--- a/rts/TopHandler.c
+++ b/rts/TopHandler.c
@@ -2,7 +2,7 @@
#include "Stable.h"
#include "TopHandler.h"
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static Mutex m; // Protects the operations on topHandlerPtr,
// which aren't atomic
#endif
@@ -47,7 +47,7 @@ StgTSO *getTopHandlerThread(void) {
}
void initTopHandler(void) {
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&m);
#endif
topHandlerPtr = NULL;
@@ -56,7 +56,7 @@ void initTopHandler(void) {
void exitTopHandler(void) {
freeStablePtr(topHandlerPtr);
topHandlerPtr = NULL;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeMutex(&m);
#endif
}
diff --git a/rts/Trace.c b/rts/Trace.c
index 3defedbe2f..8978e2722b 100644
--- a/rts/Trace.c
+++ b/rts/Trace.c
@@ -12,7 +12,7 @@
// internal headers
#include "Trace.h"
-#ifdef TRACING
+#if defined(TRACING)
#include "GetTime.h"
#include "GetEnv.h"
@@ -23,7 +23,7 @@
#include "Printer.h"
#include "RtsFlags.h"
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
@@ -35,7 +35,7 @@ int TRACE_spark_full;
int TRACE_user;
int TRACE_cap;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static Mutex trace_utx;
#endif
@@ -54,7 +54,7 @@ void initTracing (void)
{
const EventLogWriter *eventlog_writer = getEventLogWriter();
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&trace_utx);
#endif
@@ -141,10 +141,10 @@ void tracingAddCapapilities (uint32_t from, uint32_t to)
Emitting trace messages/events
--------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
static void tracePreface (void)
{
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
debugBelch("%12lx: ", (unsigned long)osThreadId());
#endif
if (RtsFlags.TraceFlags.timestamp) {
@@ -153,7 +153,7 @@ static void tracePreface (void)
}
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
static char *thread_stop_reasons[] = {
[HeapOverflow] = "heap overflow",
[StackOverflow] = "stack overflow",
@@ -176,7 +176,7 @@ static char *thread_stop_reasons[] = {
};
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
static void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag,
StgTSO *tso,
StgWord info1 STG_UNUSED,
@@ -229,7 +229,7 @@ static void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag,
void traceSchedEvent_ (Capability *cap, EventTypeNum tag,
StgTSO *tso, StgWord info1, StgWord info2)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
traceSchedEvent_stderr(cap, tag, tso, info1, info2);
} else
@@ -239,7 +239,7 @@ void traceSchedEvent_ (Capability *cap, EventTypeNum tag,
}
}
-#ifdef DEBUG
+#if defined(DEBUG)
static void traceGcEvent_stderr (Capability *cap, EventTypeNum tag)
{
ACQUIRE_LOCK(&trace_utx);
@@ -281,7 +281,7 @@ static void traceGcEvent_stderr (Capability *cap, EventTypeNum tag)
void traceGcEvent_ (Capability *cap, EventTypeNum tag)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
traceGcEvent_stderr(cap, tag);
} else
@@ -294,7 +294,7 @@ void traceGcEvent_ (Capability *cap, EventTypeNum tag)
void traceGcEventAtT_ (Capability *cap, StgWord64 ts, EventTypeNum tag)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
traceGcEvent_stderr(cap, tag);
} else
@@ -310,7 +310,7 @@ void traceHeapEvent_ (Capability *cap,
CapsetID heap_capset,
W_ info1)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
/* no stderr equivalent for these ones */
} else
@@ -327,7 +327,7 @@ void traceEventHeapInfo_ (CapsetID heap_capset,
W_ mblockSize,
W_ blockSize)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
/* no stderr equivalent for these ones */
} else
@@ -349,7 +349,7 @@ void traceEventGcStats_ (Capability *cap,
W_ par_max_copied,
W_ par_tot_copied)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
/* no stderr equivalent for these ones */
} else
@@ -364,7 +364,7 @@ void traceEventGcStats_ (Capability *cap,
void traceCapEvent_ (Capability *cap,
EventTypeNum tag)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
ACQUIRE_LOCK(&trace_utx);
@@ -397,7 +397,7 @@ void traceCapsetEvent_ (EventTypeNum tag,
CapsetID capset,
StgWord info)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR && TRACE_sched)
// When events go to stderr, it is annoying to see the capset
// events every time, so we only emit them with -Ds.
@@ -482,7 +482,7 @@ void traceOSProcessInfo_(void) {
}
}
-#ifdef DEBUG
+#if defined(DEBUG)
static void traceSparkEvent_stderr (Capability *cap, EventTypeNum tag,
StgWord info1)
{
@@ -534,7 +534,7 @@ static void traceSparkEvent_stderr (Capability *cap, EventTypeNum tag,
void traceSparkEvent_ (Capability *cap, EventTypeNum tag, StgWord info1)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
traceSparkEvent_stderr(cap, tag, info1);
} else
@@ -548,7 +548,7 @@ void traceSparkCounters_ (Capability *cap,
SparkCounters counters,
StgWord remaining)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
/* we currently don't do debug tracing of spark stats but we must
test for TRACE_STDERR because of the !eventlog_enabled case. */
@@ -562,7 +562,7 @@ void traceSparkCounters_ (Capability *cap,
void traceTaskCreate_ (Task *task,
Capability *cap)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
/* We currently don't do debug tracing of tasks but we must
test for TRACE_STDERR because of the !eventlog_enabled case. */
@@ -579,7 +579,7 @@ void traceTaskMigrate_ (Task *task,
Capability *cap,
Capability *new_cap)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
/* We currently don't do debug tracing of tasks but we must
test for TRACE_STDERR because of the !eventlog_enabled case. */
@@ -593,7 +593,7 @@ void traceTaskMigrate_ (Task *task,
void traceTaskDelete_ (Task *task)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
/* We currently don't do debug tracing of tasks but we must
test for TRACE_STDERR because of the !eventlog_enabled case. */
@@ -627,7 +627,7 @@ void traceHeapProfSampleString(StgWord8 profile_id,
}
}
-#ifdef PROFILING
+#if defined(PROFILING)
void traceHeapProfCostCentre(StgWord32 ccID,
const char *label,
const char *module,
@@ -648,7 +648,7 @@ void traceHeapProfSampleCostCentre(StgWord8 profile_id,
}
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
static void vtraceCap_stderr(Capability *cap, char *msg, va_list ap)
{
ACQUIRE_LOCK(&trace_utx);
@@ -675,7 +675,7 @@ void traceCap_(Capability *cap, char *msg, ...)
va_list ap;
va_start(ap,msg);
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
vtraceCap_stderr(cap, msg, ap);
} else
@@ -687,7 +687,7 @@ void traceCap_(Capability *cap, char *msg, ...)
va_end(ap);
}
-#ifdef DEBUG
+#if defined(DEBUG)
static void vtrace_stderr(char *msg, va_list ap)
{
ACQUIRE_LOCK(&trace_utx);
@@ -705,7 +705,7 @@ void trace_(char *msg, ...)
va_list ap;
va_start(ap,msg);
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
vtrace_stderr(msg, ap);
} else
@@ -723,7 +723,7 @@ void traceUserMsg(Capability *cap, char *msg)
by the wrappers in Trace.h. But traceUserMsg is special since it has no
wrapper (it's called from cmm code), so we check TRACE_user here
*/
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR && TRACE_user) {
// Use "%s" as format string to ignore format specifiers in msg (#3874).
traceCap_stderr(cap, "%s", msg);
@@ -742,7 +742,7 @@ void traceUserMarker(Capability *cap, char *markername)
/* Note: traceUserMarker is special since it has no wrapper (it's called
from cmm code), so we check eventlog_enabled and TRACE_user here.
*/
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR && TRACE_user) {
traceCap_stderr(cap, "User marker: %s", markername);
} else
@@ -760,7 +760,7 @@ void traceThreadLabel_(Capability *cap,
StgTSO *tso,
char *label)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
ACQUIRE_LOCK(&trace_utx);
tracePreface();
@@ -776,7 +776,7 @@ void traceThreadLabel_(Capability *cap,
void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG)
{
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) {
printThreadStatus(tso);
} else
@@ -786,7 +786,7 @@ void traceThreadStatus_ (StgTSO *tso USED_IF_DEBUG)
}
}
-#ifdef DEBUG
+#if defined(DEBUG)
void traceBegin (const char *str, ...)
{
va_list ap;
diff --git a/rts/Trace.h b/rts/Trace.h
index 4fb06e1fdd..2058ac2e05 100644
--- a/rts/Trace.h
+++ b/rts/Trace.h
@@ -81,12 +81,12 @@ extern int TRACE_cap;
//
// -----------------------------------------------------------------------------
-#ifdef DEBUG
+#if defined(DEBUG)
void traceBegin (const char *str, ...);
void traceEnd (void);
#endif
-#ifdef TRACING
+#if defined(TRACING)
/*
* Record a scheduler event
@@ -215,7 +215,7 @@ void traceThreadLabel_(Capability *cap,
/*
* Emit a debug message (only when DEBUG is defined)
*/
-#ifdef DEBUG
+#if defined(DEBUG)
#define debugTrace(class, msg, ...) \
if (RTS_UNLIKELY(class)) { \
trace_(msg, ##__VA_ARGS__); \
@@ -224,7 +224,7 @@ void traceThreadLabel_(Capability *cap,
#define debugTrace(class, str, ...) /* nothing */
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
#define debugTraceCap(class, cap, msg, ...) \
if (RTS_UNLIKELY(class)) { \
traceCap_(cap, msg, ##__VA_ARGS__); \
@@ -284,7 +284,7 @@ void traceHeapProfBegin(StgWord8 profile_id);
void traceHeapProfSampleBegin(StgInt era);
void traceHeapProfSampleString(StgWord8 profile_id,
const char *label, StgWord residency);
-#ifdef PROFILING
+#if defined(PROFILING)
void traceHeapProfCostCentre(StgWord32 ccID,
const char *label,
const char *module,
@@ -765,7 +765,7 @@ INLINE_HEADER void traceEventCreateSparkThread(Capability *cap STG_UNUSED,
INLINE_HEADER void traceSparkCounters(Capability *cap STG_UNUSED)
{
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (RTS_UNLIKELY(TRACE_spark_sampled)) {
traceSparkCounters_(cap, cap->spark_stats, sparkPoolSize(cap->sparks));
}
diff --git a/rts/Updates.h b/rts/Updates.h
index adbfb49832..1ba398bd35 100644
--- a/rts/Updates.h
+++ b/rts/Updates.h
@@ -8,7 +8,7 @@
#pragma once
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
#include "BeginPrivate.h"
#endif
@@ -32,7 +32,7 @@
* instructions off the common case in the update code, which is
* worthwhile (the update code is often part of the inner loop).
*/
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define UPDATE_FRAME_FIELDS(w_,p_,info_ptr,ccs,p2,updatee) \
w_ info_ptr, \
@@ -85,6 +85,6 @@ INLINE_HEADER void updateWithIndirection (Capability *cap,
#endif /* CMINUSMINUS */
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
#include "EndPrivate.h"
#endif
diff --git a/rts/Weak.c b/rts/Weak.c
index 46a853d6ff..f3e91fb31b 100644
--- a/rts/Weak.c
+++ b/rts/Weak.c
@@ -103,7 +103,7 @@ scheduleFinalizers(Capability *cap, StgWeak *list)
runCFinalizers((StgCFinalizerList *)w->cfinalizers);
-#ifdef PROFILING
+#if defined(PROFILING)
// A weak pointer is inherently used, so we do not need to call
// LDV_recordDead().
//
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index ce4cb3847a..6f09425fe1 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -9,7 +9,7 @@
#include "PosixSource.h"
#include "Rts.h"
-#ifdef TRACING
+#if defined(TRACING)
#include "Trace.h"
#include "Capability.h"
@@ -19,10 +19,10 @@
#include <string.h>
#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
@@ -44,7 +44,7 @@ typedef struct _EventsBuf {
EventsBuf *capEventBuf; // one EventsBuf for each Capability
EventsBuf eventBuf; // an EventsBuf not associated with any Capability
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
Mutex eventBufMutex; // protected by this mutex
#endif
@@ -287,7 +287,7 @@ initEventLogging(const EventLogWriter *ev_writer)
* Use a single buffer to store the header with event types, then flush
* the buffer so all buffers are empty for writing events.
*/
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// XXX n_capabilities hasn't been initislised yet
n_caps = RtsFlags.ParFlags.nCapabilities;
#else
@@ -493,7 +493,7 @@ initEventLogging(const EventLogWriter *ev_writer)
postBlockMarker(&capEventBuf[c]);
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&eventBufMutex);
#endif
}
@@ -1211,7 +1211,7 @@ void postHeapProfSampleString(StgWord8 profile_id,
RELEASE_LOCK(&eventBufMutex);
}
-#ifdef PROFILING
+#if defined(PROFILING)
void postHeapProfCostCentre(StgWord32 ccID,
const char *label,
const char *module,
diff --git a/rts/eventlog/EventLog.h b/rts/eventlog/EventLog.h
index 90bb214495..11c2577745 100644
--- a/rts/eventlog/EventLog.h
+++ b/rts/eventlog/EventLog.h
@@ -14,7 +14,7 @@
#include "BeginPrivate.h"
-#ifdef TRACING
+#if defined(TRACING)
/*
* Descriptions of EventTags for events.
@@ -141,7 +141,7 @@ void postHeapProfSampleString(StgWord8 profile_id,
const char *label,
StgWord64 residency);
-#ifdef PROFILING
+#if defined(PROFILING)
void postHeapProfCostCentre(StgWord32 ccID,
const char *label,
const char *module,
diff --git a/rts/eventlog/EventLogWriter.c b/rts/eventlog/EventLogWriter.c
index d6db743119..d8e5a44192 100644
--- a/rts/eventlog/EventLogWriter.c
+++ b/rts/eventlog/EventLogWriter.c
@@ -14,10 +14,10 @@
#include <string.h>
#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
@@ -39,7 +39,7 @@ initEventLogFileWriter(void)
prog = stgMallocBytes(strlen(prog_name) + 1, "initEventLogFileWriter");
strcpy(prog, prog_name);
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
// on Windows, drop the .exe suffix if there is one
{
char *suff;
diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c
index 006d63d3b5..97546c2457 100644
--- a/rts/linker/LoadArchive.c
+++ b/rts/linker/LoadArchive.c
@@ -537,7 +537,7 @@ static HsInt loadArchive_ (pathchar *path)
oc = mkOc(path, image, memberSize, false, archiveMemberName
, misalignment);
-#ifdef OBJFORMAT_MACHO
+#if defined(OBJFORMAT_MACHO)
ocInit_MachO( oc );
#endif
diff --git a/rts/linker/M32Alloc.h b/rts/linker/M32Alloc.h
index e71f500e08..645f6b2422 100644
--- a/rts/linker/M32Alloc.h
+++ b/rts/linker/M32Alloc.h
@@ -12,7 +12,7 @@
#include <fcntl.h>
#include <sys/mman.h>
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c
index 9f2cb0edba..55ca853456 100644
--- a/rts/linker/MachO.c
+++ b/rts/linker/MachO.c
@@ -784,7 +784,7 @@ relocateAddress(
#endif /* aarch64_HOST_ARCH */
-#ifndef aarch64_HOST_ARCH
+#if !defined(aarch64_HOST_ARCH)
static int
relocateSection(
ObjectCode* oc,
@@ -813,7 +813,7 @@ relocateSection(
for(i = 0; i < n; i++)
{
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
MachORelocationInfo *reloc = &relocs[i];
char *thingPtr = image + sect->offset + reloc->r_address;
@@ -1042,7 +1042,7 @@ relocateSection(
scat->r_value)
- scat->r_value;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if(scat->r_type == PPC_RELOC_SECTDIFF
|| scat->r_type == PPC_RELOC_LO16_SECTDIFF
|| scat->r_type == PPC_RELOC_HI16_SECTDIFF
@@ -1066,7 +1066,7 @@ relocateSection(
- relocateAddress(oc, nSections, sections, pair->r_value));
i++;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if(scat->r_type == PPC_RELOC_HI16
|| scat->r_type == PPC_RELOC_LO16
|| scat->r_type == PPC_RELOC_HA16
@@ -1119,7 +1119,7 @@ relocateSection(
return 0;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
if(scat->r_type == GENERIC_RELOC_VANILLA
|| scat->r_type == PPC_RELOC_SECTDIFF)
#else /* powerpc_HOST_ARCH */
@@ -1130,7 +1130,7 @@ relocateSection(
{
*wordPtr = word;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if (scat->r_type == PPC_RELOC_LO16_SECTDIFF
|| scat->r_type == PPC_RELOC_LO16)
{
@@ -1184,7 +1184,7 @@ relocateSection(
if (reloc->r_length == 2) {
unsigned long word = 0;
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
unsigned long jumpIsland = 0;
long offsetToJumpIsland = 0xBADBAD42; // initialise to bad value
// to avoid warning and to catch
@@ -1200,7 +1200,7 @@ relocateSection(
if (reloc->r_type == GENERIC_RELOC_VANILLA) {
word = *wordPtr;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if (reloc->r_type == PPC_RELOC_LO16) {
word = ((unsigned short*) wordPtr)[1];
word |= ((unsigned long) relocs[i+1].r_address & 0xFFFF) << 16;
@@ -1246,7 +1246,7 @@ relocateSection(
}
if (reloc->r_pcrel) {
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
// In the .o file, this should be a relative jump to NULL
// and we'll change it to a relative jump to the symbol
ASSERT(word + reloc->r_address == 0);
@@ -1272,7 +1272,7 @@ relocateSection(
*wordPtr = word;
continue;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if(reloc->r_type == PPC_RELOC_LO16)
{
((unsigned short*) wordPtr)[1] = word & 0xFFFF;
@@ -1860,7 +1860,7 @@ ocRunInit_MachO ( ObjectCode *oc )
return 1;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
/*
* The Mach-O object format uses leading underscores. But not everywhere.
* There is a small number of runtime support functions defined in
diff --git a/rts/linker/MachO.h b/rts/linker/MachO.h
index c07e2944a1..b495c2b9b1 100644
--- a/rts/linker/MachO.h
+++ b/rts/linker/MachO.h
@@ -15,7 +15,7 @@ int ocRunInit_MachO ( ObjectCode* oc );
int machoGetMisalignment( FILE * );
int ocAllocateSymbolExtras_MachO ( ObjectCode* oc );
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
void machoInitSymbolsWithoutUnderscore( void );
#endif
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index c27dd31c01..809840028e 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -51,7 +51,7 @@
#define USED_IF_x86_64_HOST_ARCH STG_UNUSED
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
#include "RtsUtils.h"
#include "RtsSymbolInfo.h"
@@ -669,7 +669,7 @@ cstring_from_section_name (uint8_t* name, uint8_t* strtab)
}
/* See Note [mingw-w64 name decoration scheme] */
-#ifndef x86_64_HOST_ARCH
+#if !defined(x86_64_HOST_ARCH)
static void
zapTrailingAtSign ( uint8_t* sym )
{
@@ -1557,7 +1557,7 @@ SymbolAddr *lookupSymbol_PEi386(SymbolName *lbl)
SymbolAddr* sym;
/* See Note [mingw-w64 name decoration scheme] */
-#ifndef x86_64_HOST_ARCH
+#if !defined(x86_64_HOST_ARCH)
zapTrailingAtSign ( (unsigned char*)lbl );
#endif
sym = lookupSymbolInDLLs((unsigned char*)lbl);
diff --git a/rts/linker/PEi386.h b/rts/linker/PEi386.h
index b034d6c7c9..29ef6ec906 100644
--- a/rts/linker/PEi386.h
+++ b/rts/linker/PEi386.h
@@ -82,7 +82,7 @@ struct _IndirectAddr {
} IndirectAddr;
/* See Note [mingw-w64 name decoration scheme] */
-#ifndef x86_64_HOST_ARCH
+#if !defined(x86_64_HOST_ARCH)
#define STRIP_LEADING_UNDERSCORE 1
#else
#define STRIP_LEADING_UNDERSCORE 0
diff --git a/rts/linker/SymbolExtras.c b/rts/linker/SymbolExtras.c
index 07000331ef..20591fe20c 100644
--- a/rts/linker/SymbolExtras.c
+++ b/rts/linker/SymbolExtras.c
@@ -102,7 +102,7 @@ int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first )
}
-#ifndef arm_HOST_ARCH
+#if !defined(arm_HOST_ARCH)
SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
unsigned long symbolNumber,
unsigned long target )
@@ -114,7 +114,7 @@ SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
extra = &oc->symbol_extras[symbolNumber - oc->first_symbol_extra];
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
// lis r12, hi16(target)
extra->jumpIsland.lis_r12 = 0x3d80;
extra->jumpIsland.hi_addr = target >> 16;
@@ -129,7 +129,7 @@ SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
// bctr
extra->jumpIsland.bctr = 0x4e800420;
#endif /* powerpc_HOST_ARCH */
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
// jmp *-14(%rip)
static uint8_t jmp[] = { 0xFF, 0x25, 0xF2, 0xFF, 0xFF, 0xFF };
extra->addr = target;
@@ -140,7 +140,7 @@ SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
}
#endif
-#ifdef arm_HOST_ARCH
+#if defined(arm_HOST_ARCH)
/*
Note [The ARM/Thumb Story]
~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/rts/linker/SymbolExtras.h b/rts/linker/SymbolExtras.h
index d28baf49df..4974c06e7d 100644
--- a/rts/linker/SymbolExtras.h
+++ b/rts/linker/SymbolExtras.h
@@ -9,7 +9,7 @@
int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first );
-#ifdef arm_HOST_ARCH
+#if defined(arm_HOST_ARCH)
SymbolExtra* makeArmSymbolExtra( ObjectCode const* oc,
unsigned long symbolNumber,
unsigned long target,
diff --git a/rts/package.conf.in b/rts/package.conf.in
index c328c1f75e..2f722f10e7 100644
--- a/rts/package.conf.in
+++ b/rts/package.conf.in
@@ -17,7 +17,7 @@ hidden-modules:
import-dirs:
-#ifdef INSTALLING
+#if defined(INSTALLING)
library-dirs: LIB_DIR"/rts" FFI_LIB_DIR
#else /* !INSTALLING */
library-dirs: TOP"/rts/dist/build" FFI_LIB_DIR
@@ -26,22 +26,22 @@ library-dirs: TOP"/rts/dist/build" FFI_LIB_DIR
hs-libraries: "HSrts" FFI_LIB
extra-libraries:
-#ifdef HAVE_LIBM
+#if defined(HAVE_LIBM)
"m" /* for ldexp() */
#endif
-#ifdef HAVE_LIBRT
+#if defined(HAVE_LIBRT)
, "rt"
#endif
-#ifdef HAVE_LIBDL
+#if defined(HAVE_LIBDL)
, "dl"
#endif
-#ifdef HAVE_LIBFFI
+#if defined(HAVE_LIBFFI)
, "ffi"
#endif
#if HAVE_LIBNUMA
, "numa"
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
,"wsock32" /* for the linker */
,"gdi32" /* for the linker */
,"winmm" /* for the linker */
@@ -52,7 +52,7 @@ extra-libraries:
#if defined(DEBUG) && defined(HAVE_LIBBFD)
,"bfd", "iberty" /* for debugging */
#endif
-#ifdef HAVE_LIBMINGWEX
+#if defined(HAVE_LIBMINGWEX)
# ifndef INSTALLING /* Bundled Mingw is behind */
,"mingwex"
# endif
@@ -62,7 +62,7 @@ extra-libraries:
, "dw" /* for backtraces */
#endif
-#ifdef INSTALLING
+#if defined(INSTALLING)
include-dirs: INCLUDE_DIR FFI_INCLUDE_DIR
#else /* !INSTALLING */
include-dirs: TOP"/rts/dist/build" TOP"/includes" TOP"/includes/dist-derivedconstants/header" FFI_INCLUDE_DIR
@@ -73,7 +73,7 @@ hugs-options:
cc-options:
ld-options:
-#ifdef LEADING_UNDERSCORE
+#if defined(LEADING_UNDERSCORE)
"-Wl,-u,_base_GHCziTopHandler_runIO_closure"
, "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure"
@@ -274,7 +274,7 @@ ld-options:
* path. This is important to use the static gmp in preference on Mac OS.
* The used option is specific to the Darwin linker.
*/
-#ifdef darwin_HOST_OS
+#if defined(darwin_HOST_OS)
, "-Wl,-search_paths_first"
#endif
diff --git a/rts/posix/Clock.h b/rts/posix/Clock.h
index d027351d31..92d0581877 100644
--- a/rts/posix/Clock.h
+++ b/rts/posix/Clock.h
@@ -8,20 +8,20 @@
#pragma once
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
# include <unistd.h>
#endif
-#ifdef HAVE_TIME_H
+#if defined(HAVE_TIME_H)
# include <time.h>
#endif
-#ifdef HAVE_SYS_TIME_H
+#if defined(HAVE_SYS_TIME_H)
# include <sys/time.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
diff --git a/rts/posix/GetTime.c b/rts/posix/GetTime.c
index 5be9c8e350..8d20d18bfb 100644
--- a/rts/posix/GetTime.c
+++ b/rts/posix/GetTime.c
@@ -13,11 +13,11 @@
#include "GetTime.h"
#include "Clock.h"
-#if HAVE_SYS_RESOURCE_H
+#if defined(HAVE_SYS_RESOURCE_H)
# include <sys/resource.h>
#endif
-#ifdef HAVE_SYS_TIMES_H
+#if defined(HAVE_SYS_TIMES_H)
# include <sys/times.h>
#endif
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
index 48b154fa11..330da21e1f 100644
--- a/rts/posix/OSMem.c
+++ b/rts/posix/OSMem.c
@@ -15,25 +15,25 @@
#include "sm/OSMem.h"
#include "sm/HeapAlloc.h"
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
-#ifdef HAVE_SYS_MMAN_H
+#if defined(HAVE_SYS_MMAN_H)
#include <sys/mman.h>
#endif
-#ifdef HAVE_STRING_H
+#if defined(HAVE_STRING_H)
#include <string.h>
#endif
-#ifdef HAVE_FCNTL_H
+#if defined(HAVE_FCNTL_H)
#include <fcntl.h>
#endif
-#ifdef HAVE_NUMA_H
+#if defined(HAVE_NUMA_H)
#include <numa.h>
#endif
-#ifdef HAVE_NUMAIF_H
+#if defined(HAVE_NUMAIF_H)
#include <numaif.h>
#endif
@@ -114,7 +114,7 @@ my_mmap (void *addr, W_ size, int operation)
{
void *ret;
-#ifdef darwin_HOST_OS
+#if defined(darwin_HOST_OS)
// Without MAP_FIXED, Apple's mmap ignores addr.
// With MAP_FIXED, it overwrites already mapped regions, whic
// mmap(0, ... MAP_FIXED ...) is worst of all: It unmaps the program text
@@ -160,7 +160,7 @@ my_mmap (void *addr, W_ size, int operation)
# if defined(MAP_NORESERVE)
flags = MAP_NORESERVE;
# else
-# ifdef USE_LARGE_ADDRESS_SPACE
+# if defined(USE_LARGE_ADDRESS_SPACE)
# error USE_LARGE_ADDRESS_SPACE needs MAP_NORESERVE
# endif
errorBelch("my_mmap(,,MEM_RESERVE) not supported on this platform");
@@ -170,7 +170,7 @@ my_mmap (void *addr, W_ size, int operation)
else
flags = 0;
-#ifdef hpux_HOST_OS
+#if defined(hpux_HOST_OS)
ret = mmap(addr, size, prot, flags | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
#elif defined(linux_HOST_OS)
ret = mmap(addr, size, prot, flags | MAP_ANON | MAP_PRIVATE, -1, 0);
@@ -414,7 +414,7 @@ void setExecutable (void *p, W_ len, bool exec)
}
}
-#ifdef USE_LARGE_ADDRESS_SPACE
+#if defined(USE_LARGE_ADDRESS_SPACE)
static void *
osTryReserveHeapMemory (W_ len, void *hint)
@@ -533,13 +533,13 @@ void osDecommitMemory(void *at, W_ size)
// We only do this in DEBUG because it forces the OS to remove
// all MMU entries for this page range, and there is no reason
// to do so unless there is memory pressure
-#ifdef DEBUG
+#if defined(DEBUG)
r = mprotect(at, size, PROT_NONE);
if(r < 0)
sysErrorBelch("unable to make released memory unaccessible");
#endif
-#ifdef MADV_FREE
+#if defined(MADV_FREE)
// Try MADV_FREE first, FreeBSD has both and MADV_DONTNEED
// just swaps memory out. Linux >= 4.5 has both DONTNEED and FREE; either
// will work as they both allow the system to free anonymous pages.
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index 43d2cc9b62..e2471a223c 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -62,7 +62,7 @@
#include <sys/cpuset.h>
#endif
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
@@ -70,11 +70,11 @@
#include <mach/mach.h>
#endif
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
# include <signal.h>
#endif
-#ifdef HAVE_NUMA_H
+#if defined(HAVE_NUMA_H)
#include <numa.h>
#endif
@@ -137,7 +137,7 @@ createOSThread (OSThreadId* pId, char *name STG_UNUSED,
int result = pthread_create(pId, NULL, (void *(*)(void *))startProc, param);
if (!result) {
pthread_detach(*pId);
-#ifdef HAVE_PTHREAD_SETNAME_NP
+#if defined(HAVE_PTHREAD_SETNAME_NP)
pthread_setname_np(*pId, name);
#endif
}
diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c
index 80909f113f..7471948cc0 100644
--- a/rts/posix/Signals.c
+++ b/rts/posix/Signals.c
@@ -18,7 +18,7 @@
#include "Stable.h"
#include "Libdw.h"
-#ifdef alpha_HOST_ARCH
+#if defined(alpha_HOST_ARCH)
# if defined(linux_HOST_OS)
# include <asm/fpu.h>
# else
@@ -26,23 +26,23 @@
# endif
#endif
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
# include <unistd.h>
#endif
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
# include <signal.h>
#endif
-#ifdef HAVE_ERRNO_H
+#if defined(HAVE_ERRNO_H)
# include <errno.h>
#endif
-#ifdef HAVE_EVENTFD_H
+#if defined(HAVE_EVENTFD_H)
# include <sys/eventfd.h>
#endif
-#ifdef HAVE_TERMIOS_H
+#if defined(HAVE_TERMIOS_H)
#include <termios.h>
#endif
@@ -70,7 +70,7 @@ static uint32_t n_haskell_handlers = 0;
static sigset_t userSignals;
static sigset_t savedSignals;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
static Mutex sig_mutex; // protects signal_handlers, nHandlers
#endif
@@ -82,7 +82,7 @@ void
initUserSignals(void)
{
sigemptyset(&userSignals);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initMutex(&sig_mutex);
#endif
}
@@ -95,7 +95,7 @@ freeSignalHandlers(void) {
nHandlers = 0;
n_haskell_handlers = 0;
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
closeMutex(&sig_mutex);
#endif
}
@@ -637,7 +637,7 @@ install_vtalrm_handler(int sig, TickProc handle_tick)
sigemptyset(&action.sa_mask);
-#ifdef SA_RESTART
+#if defined(SA_RESTART)
// specify SA_RESTART. One consequence if we don't do this is
// that readline gets confused by the -threaded RTS. It seems
// that if a SIGALRM handler is installed without SA_RESTART,
@@ -706,7 +706,7 @@ initDefaultHandlers(void)
}
#endif
-#ifdef alpha_HOST_ARCH
+#if defined(alpha_HOST_ARCH)
ieee_set_fp_control(0);
#endif
diff --git a/rts/posix/Signals.h b/rts/posix/Signals.h
index 0fe8c486a7..208c773a04 100644
--- a/rts/posix/Signals.h
+++ b/rts/posix/Signals.h
@@ -8,7 +8,7 @@
#pragma once
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
# include <signal.h>
#endif
diff --git a/rts/posix/TTY.c b/rts/posix/TTY.c
index 2ce822a99a..88fca28306 100644
--- a/rts/posix/TTY.c
+++ b/rts/posix/TTY.c
@@ -12,10 +12,10 @@
#include "RtsUtils.h" // __hscore_get/set prototypes
#include "TTY.h"
-#ifdef HAVE_TERMIOS_H
+#if defined(HAVE_TERMIOS_H)
#include <termios.h>
#endif
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
#include <signal.h>
#endif
diff --git a/rts/posix/itimer/Pthread.c b/rts/posix/itimer/Pthread.c
index 5c708ecf4d..a4f55527dd 100644
--- a/rts/posix/itimer/Pthread.c
+++ b/rts/posix/itimer/Pthread.c
@@ -44,18 +44,18 @@
#include "posix/Clock.h"
/* As recommended in the autoconf manual */
-# ifdef TIME_WITH_SYS_TIME
+# if defined(TIME_WITH_SYS_TIME)
# include <sys/time.h>
# include <time.h>
# else
-# ifdef HAVE_SYS_TIME_H
+# if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
# else
# include <time.h>
# endif
# endif
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
# include <signal.h>
#endif
@@ -65,7 +65,7 @@
#include <unistd.h>
#include <fcntl.h>
-#ifdef HAVE_SYS_TIMERFD_H
+#if defined(HAVE_SYS_TIMERFD_H)
#include <sys/timerfd.h>
#define USE_TIMERFD_FOR_ITIMER 1
#else
@@ -76,7 +76,7 @@
* TFD_CLOEXEC has been added in Linux 2.6.26.
* If it is not available, we use fcntl(F_SETFD).
*/
-#ifndef TFD_CLOEXEC
+#if !defined(TFD_CLOEXEC)
#define TFD_CLOEXEC 0
#endif
@@ -169,7 +169,7 @@ initTicker (Time interval, TickProc handle_tick)
* to the thread we create so we can later join to it if requested
*/
if (! pthread_create(&thread, NULL, itimer_thread_func, (void*)handle_tick)) {
-#ifdef HAVE_PTHREAD_SETNAME_NP
+#if defined(HAVE_PTHREAD_SETNAME_NP)
pthread_setname_np(thread, "ghc_ticker");
#endif
} else {
diff --git a/rts/posix/itimer/Setitimer.c b/rts/posix/itimer/Setitimer.c
index bdf537d478..1221a72a83 100644
--- a/rts/posix/itimer/Setitimer.c
+++ b/rts/posix/itimer/Setitimer.c
@@ -16,18 +16,18 @@
#include "posix/Signals.h"
/* As recommended in the autoconf manual */
-# ifdef TIME_WITH_SYS_TIME
+# if defined(TIME_WITH_SYS_TIME)
# include <sys/time.h>
# include <time.h>
# else
-# ifdef HAVE_SYS_TIME_H
+# if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
# else
# include <time.h>
# endif
# endif
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
# include <signal.h>
#endif
diff --git a/rts/posix/itimer/TimerCreate.c b/rts/posix/itimer/TimerCreate.c
index bee3108d38..43081d8a30 100644
--- a/rts/posix/itimer/TimerCreate.c
+++ b/rts/posix/itimer/TimerCreate.c
@@ -15,7 +15,7 @@
#include "posix/Clock.h"
#include "posix/Signals.h"
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
# include <signal.h>
#endif
diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c
index c729c1874f..2a02ecc9c5 100644
--- a/rts/sm/BlockAlloc.c
+++ b/rts/sm/BlockAlloc.c
@@ -855,7 +855,7 @@ void returnMemoryToOS(uint32_t n /* megablocks */)
Debugging
-------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
static void
check_tail (bdescr *bd)
{
diff --git a/rts/sm/BlockAlloc.h b/rts/sm/BlockAlloc.h
index 9b561df5db..217d669a13 100644
--- a/rts/sm/BlockAlloc.h
+++ b/rts/sm/BlockAlloc.h
@@ -19,7 +19,7 @@ extern W_ countBlocks (bdescr *bd);
extern W_ countAllocdBlocks (bdescr *bd);
extern void returnMemoryToOS(uint32_t n);
-#ifdef DEBUG
+#if defined(DEBUG)
void checkFreeListSanity(void);
W_ countFreeList(void);
void markBlocks (bdescr *bd);
diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c
index 4864e601f8..72ab6f24cf 100644
--- a/rts/sm/CNF.c
+++ b/rts/sm/CNF.c
@@ -26,10 +26,10 @@
#include <string.h>
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
-#ifdef HAVE_LIMITS_H
+#if defined(HAVE_LIMITS_H)
#include <limits.h>
#endif
@@ -227,7 +227,7 @@ compactAllocateBlockInternal(Capability *cap,
break;
default:
-#ifdef DEBUG
+#if defined(DEBUG)
ASSERT(!"code should not be reached");
#else
RTS_UNREACHABLE;
@@ -319,7 +319,7 @@ countCompactBlocks(bdescr *outer)
return count;
}
-#ifdef DEBUG
+#if defined(DEBUG)
// Like countCompactBlocks, but adjusts the size so each mblock is assumed to
// only contain BLOCKS_PER_MBLOCK blocks. Used in memInventory().
StgWord
@@ -639,7 +639,7 @@ StgWord shouldCompact (StgCompactNFData *str, StgClosure *p)
Sanity-checking a compact
-------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
STATIC_INLINE void
check_object_in_compact (StgCompactNFData *str, StgClosure *p)
{
@@ -788,7 +788,7 @@ any_needs_fixup(StgCompactNFDataBlock *block)
return false;
}
-#ifdef DEBUG
+#if defined(DEBUG)
static void
spew_failing_pointer(StgWord *fixup_table, uint32_t count, StgWord address)
{
@@ -857,7 +857,7 @@ find_pointer(StgWord *fixup_table, uint32_t count, StgClosure *q)
fail:
// We should never get here
-#ifdef DEBUG
+#if defined(DEBUG)
spew_failing_pointer(fixup_table, count, address);
#endif
return NULL;
@@ -1171,7 +1171,7 @@ compactFixupPointers(StgCompactNFData *str,
dbl_link_onto(bd, &g0->compact_objects);
RELEASE_SM_LOCK;
-#ifdef DEBUG
+#if defined(DEBUG)
if (root)
verify_consistency_loop(str);
#endif
diff --git a/rts/sm/CNF.h b/rts/sm/CNF.h
index c4655dc92d..6482130d2b 100644
--- a/rts/sm/CNF.h
+++ b/rts/sm/CNF.h
@@ -29,7 +29,7 @@ StgWord compactContains(StgCompactNFData *str,
StgPtr what);
StgWord countCompactBlocks(bdescr *outer);
-#ifdef DEBUG
+#if defined(DEBUG)
StgWord countAllocdCompactBlocks(bdescr *outer);
#endif
diff --git a/rts/sm/Compact.c b/rts/sm/Compact.c
index 1f7f08748a..0e2fea8990 100644
--- a/rts/sm/Compact.c
+++ b/rts/sm/Compact.c
@@ -28,7 +28,7 @@
#include "Stable.h"
// Turn off inlining when debugging - it obfuscates things
-#ifdef DEBUG
+#if defined(DEBUG)
# undef STATIC_INLINE
# define STATIC_INLINE static
#endif
diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c
index e515c7b440..78adf62f6c 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -115,7 +115,7 @@ copy_tag(StgClosure **p, const StgInfoTable *info,
const StgInfoTable *new_info;
new_info = (const StgInfoTable *)cas((StgPtr)&src->header.info, (W_)info, MK_FORWARDING_PTR(to));
if (new_info != info) {
-#ifdef PROFILING
+#if defined(PROFILING)
// We copied this object at the same time as another
// thread. We'll evacuate the object again and the copy
// we just made will be discarded at the next GC, but we
@@ -136,7 +136,7 @@ copy_tag(StgClosure **p, const StgInfoTable *info,
*p = TAG_CLOSURE(tag,(StgClosure*)to);
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
// We store the size of the just evacuated object in the LDV word so that
// the profiler can guess the position of the next object later.
// This is safe only if we are sure that no other thread evacuates
@@ -171,7 +171,7 @@ copy_tag_nolock(StgClosure **p, const StgInfoTable *info,
// __builtin_prefetch(to + size + 2, 1);
// }
-#ifdef PROFILING
+#if defined(PROFILING)
// We store the size of the just evacuated object in the LDV word so that
// the profiler can guess the position of the next object later.
SET_EVACUAEE_FOR_LDV(from, size);
@@ -195,7 +195,7 @@ copyPart(StgClosure **p, StgClosure *src, uint32_t size_to_reserve,
spin:
info = xchg((StgPtr)&src->header.info, (W_)&stg_WHITEHOLE_info);
if (info == (W_)&stg_WHITEHOLE_info) {
-#ifdef PROF_SPIN
+#if defined(PROF_SPIN)
whitehole_spin++;
#endif
goto spin;
@@ -221,7 +221,7 @@ spin:
src->header.info = (const StgInfoTable*)MK_FORWARDING_PTR(to);
*p = (StgClosure *)to;
-#ifdef PROFILING
+#if defined(PROFILING)
// We store the size of the just evacuated object in the LDV word so that
// the profiler can guess the position of the next object later.
SET_EVACUAEE_FOR_LDV(from, size_to_reserve);
@@ -344,7 +344,7 @@ evacuate_static_object (StgClosure **link_field, StgClosure *q)
// See Note [STATIC_LINK fields] for how the link field bits work
if ((((StgWord)(link)&STATIC_BITS) | prev_static_flag) != 3) {
StgWord new_list_head = (StgWord)q | static_flag;
-#ifndef THREADED_RTS
+#if !defined(THREADED_RTS)
*link_field = gct->static_objects;
gct->static_objects = (StgClosure *)new_list_head;
#else
@@ -707,7 +707,7 @@ loop:
case THUNK_1_1:
case THUNK_2_0:
case THUNK_0_2:
-#ifdef NO_PROMOTE_THUNKS
+#if defined(NO_PROMOTE_THUNKS)
#error bitrotted
#endif
copy(p,info,q,sizeofW(StgThunk)+2,gen_no);
@@ -1067,7 +1067,7 @@ selector_loop:
// Select the right field from the constructor
val = selectee->payload[field];
-#ifdef PROFILING
+#if defined(PROFILING)
// For the purposes of LDV profiling, we have destroyed
// the original selector thunk, p.
if (era > 0) {
diff --git a/rts/sm/Evac_thr.c b/rts/sm/Evac_thr.c
index 4fff4ec8ac..94703a609c 100644
--- a/rts/sm/Evac_thr.c
+++ b/rts/sm/Evac_thr.c
@@ -1,4 +1,4 @@
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
#define PARALLEL_GC
#include "Evac.c"
#endif
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 0dafb8c3ea..515a7fe6d8 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -104,7 +104,7 @@ bool major_gc;
static W_ g0_pcnt_kept = 30; // percentage of g0 live at last minor GC
/* Mut-list stats */
-#ifdef DEBUG
+#if defined(DEBUG)
uint32_t mutlist_MUTVARS,
mutlist_MUTARRS,
mutlist_MVARS,
@@ -199,7 +199,7 @@ GarbageCollect (uint32_t collect_gen,
saved_gct = gct;
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
CostCentreStack *save_CCS[n_capabilities];
#endif
@@ -224,7 +224,7 @@ GarbageCollect (uint32_t collect_gen,
// lock the StablePtr table
stableLock();
-#ifdef DEBUG
+#if defined(DEBUG)
mutlist_MUTVARS = 0;
mutlist_MUTARRS = 0;
mutlist_MVARS = 0;
@@ -238,7 +238,7 @@ GarbageCollect (uint32_t collect_gen,
#endif
// attribute any costs to CCS_GC
-#ifdef PROFILING
+#if defined(PROFILING)
for (n = 0; n < n_capabilities; n++) {
save_CCS[n] = capabilities[n]->r.rCCCS;
capabilities[n]->r.rCCCS = CCS_GC;
@@ -291,7 +291,7 @@ GarbageCollect (uint32_t collect_gen,
debugTrace(DEBUG_gc, "GC (gen %d, using %d thread(s))",
N, n_gc_threads);
-#ifdef DEBUG
+#if defined(DEBUG)
// check for memory leaks if DEBUG is on
memInventory(DEBUG_gc);
#endif
@@ -423,7 +423,7 @@ GarbageCollect (uint32_t collect_gen,
// Now see which stable names are still alive.
gcStableTables();
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
if (n_gc_threads == 1) {
for (n = 0; n < n_capabilities; n++) {
pruneSparkQueue(capabilities[n]);
@@ -437,7 +437,7 @@ GarbageCollect (uint32_t collect_gen,
}
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
// We call processHeapClosureForDead() on every closure destroyed during
// the current garbage collection, so we invoke LdvCensusForDead().
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV
@@ -699,7 +699,7 @@ GarbageCollect (uint32_t collect_gen,
checkUnload (gct->scavenged_static_objects);
}
-#ifdef PROFILING
+#if defined(PROFILING)
// resetStaticObjectForRetainerProfiling() must be called before
// zeroing below.
@@ -762,19 +762,19 @@ GarbageCollect (uint32_t collect_gen,
// extra GC trace info
IF_DEBUG(gc, statDescribeGens());
-#ifdef DEBUG
+#if defined(DEBUG)
// symbol-table based profiling
/* heapCensus(to_blocks); */ /* ToDo */
#endif
// restore enclosing cost centre
-#ifdef PROFILING
+#if defined(PROFILING)
for (n = 0; n < n_capabilities; n++) {
capabilities[n]->r.rCCCS = save_CCS[n];
}
#endif
-#ifdef DEBUG
+#if defined(DEBUG)
// check for memory leaks if DEBUG is on
memInventory(DEBUG_gc);
#endif
@@ -823,7 +823,7 @@ new_gc_thread (uint32_t n, gc_thread *t)
t->cap = capabilities[n];
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
t->id = 0;
initSpinLock(&t->gc_spin);
initSpinLock(&t->mut_spin);
@@ -1024,7 +1024,7 @@ loop:
// scavenge_loop() only exits when there's no work to do
-#ifdef DEBUG
+#if defined(DEBUG)
r = dec_running();
#else
dec_running();
@@ -1085,7 +1085,7 @@ gcWorkerThread (Capability *cap)
scavenge_until_all_done();
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// Now that the whole heap is marked, we discard any sparks that
// were found to be unreachable. The main GC thread is currently
// marking heap reachable via weak pointers, so it is
diff --git a/rts/sm/GC.h b/rts/sm/GC.h
index a176fde3f6..c6b0c13a46 100644
--- a/rts/sm/GC.h
+++ b/rts/sm/GC.h
@@ -35,7 +35,7 @@ extern StgPtr mark_sp;
extern bool work_stealing;
-#ifdef DEBUG
+#if defined(DEBUG)
extern uint32_t mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS,
mutlist_TVAR,
mutlist_TVAR_WATCH_QUEUE,
diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h
index 15f1f13f20..bb206db64c 100644
--- a/rts/sm/GCThread.h
+++ b/rts/sm/GCThread.h
@@ -119,7 +119,7 @@ typedef struct gen_workspace_ {
typedef struct gc_thread_ {
Capability *cap;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
OSThreadId id; // The OS thread that this struct belongs to
SpinLock gc_spin;
SpinLock mut_spin;
diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c
index 3717faebed..0373c2b925 100644
--- a/rts/sm/GCUtils.c
+++ b/rts/sm/GCUtils.c
@@ -22,11 +22,11 @@
#include "GCUtils.h"
#include "Printer.h"
#include "Trace.h"
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
#include "WSDeque.h"
#endif
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
SpinLock gc_alloc_block_sync;
#endif
@@ -346,7 +346,7 @@ alloc_todo_block (gen_workspace *ws, uint32_t size)
* Debugging
* -------------------------------------------------------------------------- */
-#ifdef DEBUG
+#if defined(DEBUG)
void
printMutableList(bdescr *bd)
{
diff --git a/rts/sm/GCUtils.h b/rts/sm/GCUtils.h
index 657fb783d1..2e2d4b199d 100644
--- a/rts/sm/GCUtils.h
+++ b/rts/sm/GCUtils.h
@@ -51,7 +51,7 @@ isPartiallyFull(bdescr *bd)
}
-#ifdef DEBUG
+#if defined(DEBUG)
void printMutableList (bdescr *bd);
#endif
diff --git a/rts/sm/HeapAlloc.h b/rts/sm/HeapAlloc.h
index a74e79a86d..9a36d106bb 100644
--- a/rts/sm/HeapAlloc.h
+++ b/rts/sm/HeapAlloc.h
@@ -48,7 +48,7 @@
the 4GB block in question.
-------------------------------------------------------------------------- */
-#ifdef USE_LARGE_ADDRESS_SPACE
+#if defined(USE_LARGE_ADDRESS_SPACE)
struct mblock_address_range {
W_ begin, end;
diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c
index 833dd8c7c2..344bd3f0e9 100644
--- a/rts/sm/MBlock.c
+++ b/rts/sm/MBlock.c
@@ -61,7 +61,7 @@ W_ mpc_misses = 0;
with recently decommitted blocks
*/
-#ifdef USE_LARGE_ADDRESS_SPACE
+#if defined(USE_LARGE_ADDRESS_SPACE)
// Large address space means we use two-step allocation: reserve
// something large upfront, and then commit as needed
@@ -591,7 +591,7 @@ void *
getMBlocksOnNode(uint32_t node, uint32_t n)
{
void *addr = getMBlocks(n);
-#ifdef DEBUG
+#if defined(DEBUG)
if (RtsFlags.DebugFlags.numa) return addr; // faking NUMA
#endif
osBindMBlocksToNode(addr, n * MBLOCK_SIZE, numa_map[node]);
@@ -619,7 +619,7 @@ freeAllMBlocks(void)
{
debugTrace(DEBUG_gc, "freeing all megablocks");
-#ifdef USE_LARGE_ADDRESS_SPACE
+#if defined(USE_LARGE_ADDRESS_SPACE)
{
struct free_list *iter, *next;
@@ -654,10 +654,10 @@ initMBlocks(void)
{
osMemInit();
-#ifdef USE_LARGE_ADDRESS_SPACE
+#if defined(USE_LARGE_ADDRESS_SPACE)
{
W_ size;
-#ifdef aarch64_HOST_ARCH
+#if defined(aarch64_HOST_ARCH)
size = (W_)1 << 38; // 1/4 TByte
#else
size = (W_)1 << 40; // 1 TByte
diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c
index e7dfd6e57c..c7a87a2d76 100644
--- a/rts/sm/MarkWeak.c
+++ b/rts/sm/MarkWeak.c
@@ -359,7 +359,7 @@ static void tidyThreadList (generation *gen)
}
}
-#ifdef DEBUG
+#if defined(DEBUG)
static void checkWeakPtrSanity(StgWeak *hd, StgWeak *tl)
{
StgWeak *w, *prev;
@@ -411,7 +411,7 @@ markWeakPtrList ( void )
for (w = gen->weak_ptr_list; w != NULL; w = w->link) {
// w might be WEAK, EVACUATED, or DEAD_WEAK (actually CON_STATIC) here
-#ifdef DEBUG
+#if defined(DEBUG)
{ // careful to do this assertion only reading the info ptr
// once, because during parallel GC it might change under our feet.
const StgInfoTable *info;
diff --git a/rts/sm/OSMem.h b/rts/sm/OSMem.h
index 4a19b348e5..3b0cee9630 100644
--- a/rts/sm/OSMem.h
+++ b/rts/sm/OSMem.h
@@ -38,7 +38,7 @@ roundUpToPage (size_t x)
}
-#ifdef USE_LARGE_ADDRESS_SPACE
+#if defined(USE_LARGE_ADDRESS_SPACE)
/*
If "large address space" is enabled, we allocate memory in two
diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index 2b91540ec5..6bfa1cb494 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -16,7 +16,7 @@
#include "PosixSource.h"
#include "Rts.h"
-#ifdef DEBUG /* whole file */
+#if defined(DEBUG) /* whole file */
#include "RtsUtils.h"
#include "sm/Storage.h"
@@ -808,7 +808,7 @@ findMemoryLeak (void)
markBlocks(capabilities[i]->pinned_object_block);
}
-#ifdef PROFILING
+#if defined(PROFILING)
// TODO:
// if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER) {
// markRetainerBlocks();
@@ -913,7 +913,7 @@ memInventory (bool show)
}
retainer_blocks = 0;
-#ifdef PROFILING
+#if defined(PROFILING)
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER) {
retainer_blocks = retainerStackBlocks();
}
diff --git a/rts/sm/Sanity.h b/rts/sm/Sanity.h
index f9f1b3b787..9227e6fd18 100644
--- a/rts/sm/Sanity.h
+++ b/rts/sm/Sanity.h
@@ -8,7 +8,7 @@
#pragma once
-#ifdef DEBUG
+#if defined(DEBUG)
#include "BeginPrivate.h"
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c
index bbe049cc2a..ab7b69f6a8 100644
--- a/rts/sm/Scav.c
+++ b/rts/sm/Scav.c
@@ -86,7 +86,7 @@ scavengeTSO (StgTSO *tso)
) {
evacuate(&tso->block_info.closure);
}
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// in the THREADED_RTS, block_info.closure must always point to a
// valid closure, because we assume this in throwTo(). In the
// non-threaded RTS it might be a FD (for
@@ -117,7 +117,7 @@ static void
evacuate_hash_entry(MapHashData *dat, StgWord key, const void *value)
{
StgClosure *p = (StgClosure*)key;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
gc_thread *old_gct = gct;
#endif
@@ -1640,7 +1640,7 @@ scavenge_mutable_list(bdescr *bd, generation *gen)
p = (StgPtr)*q;
ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
-#ifdef DEBUG
+#if defined(DEBUG)
switch (get_itbl((StgClosure *)p)->type) {
case MUT_VAR_CLEAN:
// can happen due to concurrent writeMutVars
diff --git a/rts/sm/Scav.h b/rts/sm/Scav.h
index 865a78a242..6d265a7f40 100644
--- a/rts/sm/Scav.h
+++ b/rts/sm/Scav.h
@@ -18,7 +18,7 @@
void scavenge_loop (void);
void scavenge_capability_mut_lists (Capability *cap);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
void scavenge_loop1 (void);
void scavenge_capability_mut_Lists1 (Capability *cap);
#endif
diff --git a/rts/sm/Scav_thr.c b/rts/sm/Scav_thr.c
index 372e779b96..af3dc7a64f 100644
--- a/rts/sm/Scav_thr.c
+++ b/rts/sm/Scav_thr.c
@@ -1,4 +1,4 @@
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
#define PARALLEL_GC
#include "Scav.c"
#endif
diff --git a/rts/sm/ShouldCompact.h b/rts/sm/ShouldCompact.h
index bce8ced288..d80076460f 100644
--- a/rts/sm/ShouldCompact.h
+++ b/rts/sm/ShouldCompact.h
@@ -18,6 +18,6 @@
#define SHOULDCOMPACT_NOTIN_CNF 2
#define SHOULDCOMPACT_PINNED 3
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
extern StgWord shouldCompact (StgCompactNFData *str, StgClosure *p);
#endif
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 43f67f4899..4aa4b12868 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -71,7 +71,7 @@ uint32_t n_nurseries;
*/
volatile StgWord next_nursery[MAX_NUMA_NODES];
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
/*
* Storage manager mutex: protects all the above state from
* simultaneous access by two STG threads.
@@ -113,7 +113,7 @@ initGeneration (generation *gen, int g)
gen->mark = 0;
gen->compact = 0;
gen->bitmap = NULL;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initSpinLock(&gen->sync);
#endif
gen->threads = END_TSO_QUEUE;
@@ -195,9 +195,9 @@ initStorage (void)
exec_block = NULL;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
initSpinLock(&gc_alloc_block_sync);
-#ifdef PROF_SPIN
+#if defined(PROF_SPIN)
whitehole_spin = 0;
#endif
#endif
@@ -381,7 +381,7 @@ lockCAF (StgRegTable *reg, StgIndStatic *caf)
orig_info = caf->header.info;
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
const StgInfoTable *cur_info;
if (orig_info == &stg_IND_STATIC_info ||
@@ -452,7 +452,7 @@ newCAF(StgRegTable *reg, StgIndStatic *caf)
regTableToCapability(reg), oldest_gen->no);
}
-#ifdef DEBUG
+#if defined(DEBUG)
// In the DEBUG rts, we keep track of live CAFs by chaining them
// onto a list debug_caf_list. This is so that we can tell if we
// ever enter a GC'd CAF, and emit a suitable barf().
@@ -642,7 +642,7 @@ resetNurseries (void)
}
assignNurseriesToCapabilities(0, n_capabilities);
-#ifdef DEBUG
+#if defined(DEBUG)
bdescr *bd;
for (n = 0; n < n_nurseries; n++) {
for (bd = nurseries[n].blocks; bd; bd = bd->link) {
@@ -1515,7 +1515,7 @@ void freeExec (void *addr)
#endif /* switch(HOST_OS) */
-#ifdef DEBUG
+#if defined(DEBUG)
// handy function for use in gdb, because Bdescr() is inlined.
extern bdescr *_bdescr (StgPtr p);
diff --git a/rts/win32/AsyncIO.c b/rts/win32/AsyncIO.c
index 9e6594f601..3f1e9ed63e 100644
--- a/rts/win32/AsyncIO.c
+++ b/rts/win32/AsyncIO.c
@@ -218,7 +218,7 @@ shutdownAsyncIO(bool wait_threads)
int
awaitRequests(bool wait)
{
-#ifndef THREADED_RTS
+#if !defined(THREADED_RTS)
// none of this is actually used in the threaded RTS
start:
diff --git a/rts/win32/ConsoleHandler.c b/rts/win32/ConsoleHandler.c
index d30fd81e67..3d283b0162 100644
--- a/rts/win32/ConsoleHandler.c
+++ b/rts/win32/ConsoleHandler.c
@@ -272,7 +272,7 @@ rts_InstallConsoleEvent(int action, StgStablePtr *handler)
}
break;
case STG_SIG_HAN:
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// handler is stored in an MVar in the threaded RTS
console_handler = STG_SIG_HAN;
#else
diff --git a/rts/win32/GetTime.c b/rts/win32/GetTime.c
index 30f1068f3a..90c0d0d244 100644
--- a/rts/win32/GetTime.c
+++ b/rts/win32/GetTime.c
@@ -11,7 +11,7 @@
#include <windows.h>
-#ifdef HAVE_TIME_H
+#if defined(HAVE_TIME_H)
# include <time.h>
#endif
diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c
index ad72ffba29..c67b95be82 100644
--- a/rts/win32/OSMem.c
+++ b/rts/win32/OSMem.c
@@ -441,7 +441,7 @@ void setExecutable (void *p, W_ len, bool exec)
}
}
-#ifdef USE_LARGE_ADDRESS_SPACE
+#if defined(USE_LARGE_ADDRESS_SPACE)
static void* heap_base = NULL;
diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c
index d2f867ccc7..4deb14a5f4 100644
--- a/rts/win32/OSThreads.c
+++ b/rts/win32/OSThreads.c
@@ -150,7 +150,7 @@ osThreadIsAlive(OSThreadId id)
return (exit_code == STILL_ACTIVE);
}
-#ifdef USE_CRITICAL_SECTIONS
+#if defined(USE_CRITICAL_SECTIONS)
void
initMutex (Mutex* pMut)
{
@@ -195,7 +195,7 @@ getThreadLocalVar (ThreadLocalKey *key)
{
void *r;
r = TlsGetValue(*key);
-#ifdef DEBUG
+#if defined(DEBUG)
// r is allowed to be NULL - it can mean that either there was an
// error or the stored value is in fact NULL.
if (GetLastError() != NO_ERROR) {
@@ -257,7 +257,7 @@ forkOS_createThread ( HsStablePtr entry )
typedef DWORD(WINAPI *GetItemCountProc)(WORD);
typedef DWORD(WINAPI *GetGroupCountProc)(void);
typedef BOOL(WINAPI *SetThreadGroupAffinityProc)(HANDLE, const GROUP_AFFINITY*, PGROUP_AFFINITY);
-#ifndef ALL_PROCESSOR_GROUPS
+#if !defined(ALL_PROCESSOR_GROUPS)
#define ALL_PROCESSOR_GROUPS 0xffff
#endif
#endif
diff --git a/rts/win32/ThrIOManager.c b/rts/win32/ThrIOManager.c
index 13c5e220bb..86133b6000 100644
--- a/rts/win32/ThrIOManager.c
+++ b/rts/win32/ThrIOManager.c
@@ -36,7 +36,7 @@ getIOManagerEvent (void)
// This function has to exist even in the non-THREADED_RTS,
// because code in GHC.Conc refers to it. It won't ever be called
// unless we're in the threaded RTS, however.
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
HANDLE hRes;
ACQUIRE_LOCK(&event_buf_mutex);
diff --git a/rts/win32/veh_excn.c b/rts/win32/veh_excn.c
index c94dc5a830..d925ad8919 100644
--- a/rts/win32/veh_excn.c
+++ b/rts/win32/veh_excn.c
@@ -22,7 +22,7 @@
#define CALL_LAST 0
// this should be in <excpt.h>, but it's been removed from MinGW distributions
-#ifndef EH_UNWINDING
+#if !defined(EH_UNWINDING)
#define EH_UNWINDING 0x02
#endif /* EH_UNWINDING */
diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs
index f9d6ea1e3f..90ae5d7ac0 100644
--- a/utils/genapply/Main.hs
+++ b/utils/genapply/Main.hs
@@ -257,7 +257,7 @@ stackCheck regstatus args args_in_regs fun_info_label (prof_sp, norm_sp) =
char '}'
| otherwise = empty
in
- vcat [ text "#ifdef PROFILING",
+ vcat [ text "#if defined(PROFILING)",
cmp_sp prof_sp,
text "#else",
cmp_sp norm_sp,
@@ -392,7 +392,7 @@ genMkPAP regstatus macro jump live ticker disamb
shuffle_extra_args = (doc, (shuffle_prof_stack, shuffle_norm_stack))
where
- doc = vcat [ text "#ifdef PROFILING",
+ doc = vcat [ text "#if defined(PROFILING)",
shuffle_prof_doc,
text "#else",
shuffle_norm_doc,
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 9e18c97bc1..80ff77c24b 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -11,8 +11,8 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- We never want to link against terminfo while bootstrapping.
-#ifdef BOOTSTRAPPING
-#ifdef WITH_TERMINFO
+#if defined(BOOTSTRAPPING)
+#if defined(WITH_TERMINFO)
#undef WITH_TERMINFO
#endif
#endif
@@ -89,11 +89,11 @@ import System.Posix hiding (fdToHandle)
import qualified System.Info(os)
#endif
-#ifdef WITH_TERMINFO
+#if defined(WITH_TERMINFO)
import System.Console.Terminfo as Terminfo
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
# if defined(i386_HOST_ARCH)
# define WINDOWS_CCONV stdcall
# elif defined(x86_64_HOST_ARCH)
@@ -1440,7 +1440,7 @@ listPackages verbosity my_flags mPackageName mModuleName = do
if simple_output then show_simple stack else do
-#ifndef WITH_TERMINFO
+#if !defined(WITH_TERMINFO)
mapM_ show_normal stack
#else
let
diff --git a/utils/hp2ps/HpFile.c b/utils/hp2ps/HpFile.c
index deef58201d..e21acf3f91 100644
--- a/utils/hp2ps/HpFile.c
+++ b/utils/hp2ps/HpFile.c
@@ -8,7 +8,7 @@
#include "HpFile.h"
#include "Utilities.h"
-#ifndef atof
+#if !defined(atof)
double atof PROTO((const char *));
#endif
diff --git a/utils/hp2ps/Main.c b/utils/hp2ps/Main.c
index 7731d4c8f0..a44e41c862 100644
--- a/utils/hp2ps/Main.c
+++ b/utils/hp2ps/Main.c
@@ -244,7 +244,7 @@ Fp(char *rootname, char **filename, char *suffix, char *mode)
return(OpenFile(*filename, mode));
}
-#ifdef DEBUG
+#if defined(DEBUG)
void
_stgAssert (filename, linenum)
char *filename;
diff --git a/utils/hp2ps/Main.h b/utils/hp2ps/Main.h
index b023d42656..1eea93f0a2 100644
--- a/utils/hp2ps/Main.h
+++ b/utils/hp2ps/Main.h
@@ -3,14 +3,14 @@
#include "ghcconfig.h"
#include <stdio.h>
-#ifdef __STDC__
+#if defined(__STDC__)
#define PROTO(x) x
#else
#define PROTO(x) ()
#endif
/* our own ASSERT macro (for C) */
-#ifndef DEBUG
+#if !defined(DEBUG)
#define ASSERT(predicate) /*nothing*/
#else
@@ -34,7 +34,7 @@ typedef int boolish;
/* Use "long long" if we have it: the numbers in profiles can easily
* overflow 32 bits after a few seconds execution.
*/
-#ifdef HAVE_LONG_LONG
+#if defined(HAVE_LONG_LONG)
typedef long long int intish;
#else
typedef long int intish;
diff --git a/utils/lndir/lndir-Xos.h b/utils/lndir/lndir-Xos.h
index c6d1e3652c..b423f6b641 100644
--- a/utils/lndir/lndir-Xos.h
+++ b/utils/lndir/lndir-Xos.h
@@ -29,9 +29,9 @@
* Get major data types (esp. caddr_t)
*/
-#ifdef USG
-#ifndef __TYPES__
-#ifdef CRAY
+#if defined(USG)
+#if !defined(__TYPES__)
+#if defined(CRAY)
#define word word_t
#endif /* CRAY */
#include <sys/types.h> /* forgot to protect it... */
@@ -54,12 +54,12 @@
* need to have #defines here.
*/
-#ifndef X_NOT_STDC_ENV
+#if !defined(X_NOT_STDC_ENV)
#include <string.h>
#define index strchr
#define rindex strrchr
#else
-#ifdef SYSV
+#if defined(SYSV)
#include <string.h>
#define index strchr
#define rindex strrchr
@@ -74,18 +74,18 @@
/*
* Get open(2) constants
*/
-#ifdef X_NOT_POSIX
+#if defined(X_NOT_POSIX)
#include <fcntl.h>
-#ifdef USL
+#if defined(USL)
#include <unistd.h>
#endif /* USL */
-#ifdef CRAY
+#if defined(CRAY)
#include <unistd.h>
#endif /* CRAY */
-#ifdef MOTOROLA
+#if defined(MOTOROLA)
#include <unistd.h>
#endif /* MOTOROLA */
-#ifdef SYSV386
+#if defined(SYSV386)
#include <unistd.h>
#endif /* SYSV386 */
#include <sys/file.h>
@@ -104,13 +104,13 @@
* Get struct timeval
*/
-#ifdef SYSV
+#if defined(SYSV)
-#ifndef USL
+#if !defined(USL)
#include <sys/time.h>
#endif
#include <time.h>
-#ifdef CRAY
+#if defined(CRAY)
#undef word
#endif /* CRAY */
#if defined(USG) && !defined(CRAY) && !defined(MOTOROLA)
@@ -118,7 +118,7 @@ struct timeval {
long tv_sec;
long tv_usec;
};
-#ifndef USL_SHARELIB
+#if !defined(USL_SHARELIB)
struct timezone {
int tz_minuteswest;
int tz_dsttime;
@@ -144,6 +144,6 @@ struct timezone {
#define SIGCHLD SIGCLD
#endif
-#ifdef ISC
+#if defined(ISC)
#include <sys/bsdtypes.h>
#endif
diff --git a/utils/lndir/lndir-Xosdefs.h b/utils/lndir/lndir-Xosdefs.h
index 7e232c97c5..09658937ad 100644
--- a/utils/lndir/lndir-Xosdefs.h
+++ b/utils/lndir/lndir-Xosdefs.h
@@ -34,63 +34,63 @@
* You may still have to define _POSIX_SOURCE to get it.
*/
-#ifdef NOSTDHDRS
+#if defined(NOSTDHDRS)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
-#ifdef NeXT
+#if defined(NeXT)
#define X_NOT_POSIX
#endif
-#ifdef sony
-#ifndef SYSTYPE_SYSV
+#if defined(sony)
+#if !defined(SYSTYPE_SYSV)
#define X_NOT_POSIX
#endif
#endif
-#ifdef UTEK
+#if defined(UTEK)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
-#ifdef CRAY
+#if defined(CRAY)
#define X_NOT_POSIX
#endif
-#ifdef vax
-#ifndef ultrix /* assume vanilla BSD */
+#if defined(vax)
+#if !defined(ultrix) /* assume vanilla BSD */
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
#endif
-#ifdef luna
+#if defined(luna)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
-#ifdef Mips
+#if defined(Mips)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
-#ifdef USL
-#ifdef SYSV /* (release 3.2) */
+#if defined(USL)
+#if defined(SYSV) /* (release 3.2) */
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
#endif
-#ifdef SYSV386
-#ifdef SYSV
+#if defined(SYSV386)
+#if defined(SYSV)
#define X_NOT_POSIX
#define X_NOT_STDC_ENV
#endif
#endif
-#ifdef MOTOROLA
-#ifdef SYSV
+#if defined(MOTOROLA)
+#if defined(SYSV)
#define X_NOT_STDC_ENV
#endif
#endif
diff --git a/utils/lndir/lndir.c b/utils/lndir/lndir.c
index 8269f6ec9e..87f2824166 100644
--- a/utils/lndir/lndir.c
+++ b/utils/lndir/lndir.c
@@ -52,27 +52,27 @@ in this Software without prior written authorization from the X Consortium.
#include <sys/param.h>
#include <errno.h>
-#ifndef X_NOT_POSIX
+#if !defined(X_NOT_POSIX)
#include <dirent.h>
#else
-#ifdef SYSV
+#if defined(SYSV)
#include <dirent.h>
#else
-#ifdef USG
+#if defined(USG)
#include <dirent.h>
#else
#include <sys/dir.h>
-#ifndef dirent
+#if !defined(dirent)
#define dirent direct
#endif
#endif
#endif
#endif
-#ifndef MAXPATHLEN
+#if !defined(MAXPATHLEN)
#define MAXPATHLEN 2048
#endif
-#ifdef __CYGWIN32__
+#if defined(__CYGWIN32__)
#include <sys/cygwin.h>
#endif
@@ -80,7 +80,7 @@ in this Software without prior written authorization from the X Consortium.
#include <stdarg.h>
#endif
-#ifdef X_NOT_STDC_ENV
+#if defined(X_NOT_STDC_ENV)
extern int errno;
#endif
int silent = 0; /* -silent */
@@ -92,13 +92,13 @@ char *curdir;
int force=0;
-#ifdef WIN32
+#if defined(WIN32)
#define mymkdir(X, Y) mkdir(X)
#else
#define mymkdir(X, Y) mkdir(X, Y)
#endif
-#ifndef WIN32
+#if !defined(WIN32)
#define SYMLINKS
#define BELIEVE_ST_NLINK
#endif
@@ -177,7 +177,7 @@ int copyfile(const char *oldpath, const char *newpath) {
ssize_t s;
char buf[BUFSIZE];
-#ifdef SYMLINKS
+#if defined(SYMLINKS)
if (copy == 0) {
return symlink(oldpath, newpath);
} else {
@@ -217,7 +217,7 @@ int copyfile(const char *oldpath, const char *newpath) {
}
fclose(f_old);
return 0;
-#ifdef SYMLINKS
+#if defined(SYMLINKS)
}
#endif
}
@@ -289,7 +289,7 @@ int rel; /* if true, prepend "../" to fn before using */
strcpy (p, dp->d_name);
if (
-#ifdef BELIEVE_ST_NLINK
+#if defined(BELIEVE_ST_NLINK)
n_dirs > 0
#else
/* st_nlink is 1 on Windows, so we have to keep looking for
@@ -302,14 +302,14 @@ int rel; /* if true, prepend "../" to fn before using */
continue;
}
-#ifdef S_ISDIR
+#if defined(S_ISDIR)
if(S_ISDIR(sb.st_mode))
#else
if (sb.st_mode & S_IFDIR)
#endif
{
/* directory */
-#ifndef __CYGWIN32__ /* don't trust cygwin's n_dirs count */
+#if !defined(__CYGWIN32__) /* don't trust cygwin's n_dirs count */
n_dirs--;
#endif
if (dp->d_name[0] == '.' &&
@@ -343,7 +343,7 @@ int rel; /* if true, prepend "../" to fn before using */
continue;
}
}
-#ifdef SYMLINKS
+#if defined(SYMLINKS)
if (readlink (dp->d_name, symbuf, sizeof(symbuf) - 1) >= 0) {
msg ("%s: is a link instead of a directory", dp->d_name);
curdir = rcurdir = ocurdir;
@@ -365,7 +365,7 @@ int rel; /* if true, prepend "../" to fn before using */
}
/* non-directory */
-#ifdef SYMLINKS
+#if defined(SYMLINKS)
symlen = readlink (dp->d_name, symbuf, sizeof(symbuf) - 1);
if (symlen >= 0)
symbuf[symlen] = '\0';
@@ -409,7 +409,7 @@ char **av;
char *prog_name = av[0];
char* tn;
struct stat fs, ts;
-#ifdef __CYGWIN32__
+#if defined(__CYGWIN32__)
/*
The lndir code assumes unix-style paths to work. cygwin
lets you get away with using dos'ish paths (e.g., "f:/oo")
@@ -442,7 +442,7 @@ char **av;
quit (1, "usage: %s [-f] [-silent] [-ignorelinks] fromdir [todir]",
prog_name);
-#ifdef __CYGWIN32__
+#if defined(__CYGWIN32__)
cygwin_conv_to_full_posix_path(av[0], fn);
#else
fn = av[0];
@@ -460,7 +460,7 @@ char **av;
}
else {
quiterr (1, tn);
-#ifdef S_ISDIR
+#if defined(S_ISDIR)
if (!(S_ISDIR(ts.st_mode)))
#else
if (!(ts.st_mode & S_IFDIR))
@@ -474,7 +474,7 @@ char **av;
/* from directory */
if (stat (fn, &fs) < 0)
quiterr (1, fn);
-#ifdef S_ISDIR
+#if defined(S_ISDIR)
if (!(S_ISDIR(fs.st_mode)))
#else
if (!(fs.st_mode & S_IFDIR))
diff --git a/utils/unlit/unlit.c b/utils/unlit/unlit.c
index 9a697eba95..4eb91d71be 100644
--- a/utils/unlit/unlit.c
+++ b/utils/unlit/unlit.c
@@ -61,7 +61,7 @@
#define LENBEGINCODE 12
#define ENDCODE "\\end{code}"
#define LENENDCODE 10
-#ifdef PSEUDOCODE
+#if defined(PSEUDOCODE)
/* According to Will Partain, the inventor of pseudocode, this gone now. */
#define MISSINGENDPSEUDOCODE "unlit: missing \\end{pseudocode}\n"
#define BEGINPSEUDOCODE "\\begin{pseudocode}"
@@ -227,7 +227,7 @@ static line readline(FILE *istream, FILE *ostream) {
return BEGIN;
if (strcmp(buf, ENDCODE) == 0)
return END;
-#ifdef PSEUDOCODE
+#if defined(PSEUDOCODE)
else if (strcmp(buf, BEGINPSEUDOCODE) == 0)
return PSEUDO;
#endif
@@ -280,7 +280,7 @@ static void unlit(char *file, FILE *istream, FILE *ostream)
}
defnsread++;
}
-#ifdef PSEUDOCODE
+#if defined(PSEUDOCODE)
if (this == PSEUDO) {
char lineb[1000];
for(;;) {