summaryrefslogtreecommitdiff
path: root/rts
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 /rts
parente5b3492f23c2296d0d8221e1787ee585331f726e (diff)
downloadhaskell-945c45ad50ed31e3acb96fdaafb21640c4669f12.tar.gz
Prefer #if defined to #ifdef
Our new CPP linter enforces this.
Diffstat (limited to 'rts')
-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
128 files changed, 591 insertions, 591 deletions
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 */