summaryrefslogtreecommitdiff
path: root/includes/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 /includes/rts
parente5b3492f23c2296d0d8221e1787ee585331f726e (diff)
downloadhaskell-945c45ad50ed31e3acb96fdaafb21640c4669f12.tar.gz
Prefer #if defined to #ifdef
Our new CPP linter enforces this.
Diffstat (limited to 'includes/rts')
-rw-r--r--includes/rts/EventLogFormat.h2
-rw-r--r--includes/rts/Flags.h2
-rw-r--r--includes/rts/OSThreads.h14
-rw-r--r--includes/rts/Threads.h2
-rw-r--r--includes/rts/prof/LDV.h4
-rw-r--r--includes/rts/storage/Block.h12
-rw-r--r--includes/rts/storage/ClosureMacros.h8
-rw-r--r--includes/rts/storage/Closures.h4
-rw-r--r--includes/rts/storage/InfoTables.h24
-rw-r--r--includes/rts/storage/MBlock.h2
-rw-r--r--includes/rts/storage/TSO.h6
11 files changed, 40 insertions, 40 deletions
diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h
index 160aa19303..b63f842008 100644
--- a/includes/rts/EventLogFormat.h
+++ b/includes/rts/EventLogFormat.h
@@ -230,7 +230,7 @@
#define CAPSET_TYPE_OSPROCESS 2 /* caps belong to the same OS process */
#define CAPSET_TYPE_CLOCKDOMAIN 3 /* caps share a local clock/time */
-#ifndef EVENTLOG_CONSTANTS_ONLY
+#if !defined(EVENTLOG_CONSTANTS_ONLY)
typedef StgWord16 EventTypeNum;
typedef StgWord64 EventTimestamp; /* in nanoseconds */
diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h
index 405fce166d..6700f9d95f 100644
--- a/includes/rts/Flags.h
+++ b/includes/rts/Flags.h
@@ -245,7 +245,7 @@ typedef struct _RTS_FLAGS {
PAR_FLAGS ParFlags;
} RTS_FLAGS;
-#ifdef COMPILING_RTS_MAIN
+#if defined(COMPILING_RTS_MAIN)
extern DLLIMPORT RTS_FLAGS RtsFlags;
#elif IN_STG_CODE
/* Hack because the C code generator can't generate '&label'. */
diff --git a/includes/rts/OSThreads.h b/includes/rts/OSThreads.h
index 520d592ec6..abb3120088 100644
--- a/includes/rts/OSThreads.h
+++ b/includes/rts/OSThreads.h
@@ -16,7 +16,7 @@
#if defined(HAVE_PTHREAD_H) && !defined(mingw32_HOST_OS)
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define OS_ACQUIRE_LOCK(mutex) foreign "C" pthread_mutex_lock(mutex)
#define OS_RELEASE_LOCK(mutex) foreign "C" pthread_mutex_unlock(mutex)
@@ -36,7 +36,7 @@ typedef pthread_key_t ThreadLocalKey;
#define INIT_COND_VAR PTHREAD_COND_INITIALIZER
-#ifdef LOCK_DEBUG
+#if defined(LOCK_DEBUG)
#define LOCK_DEBUG_BELCH(what, mutex) \
debugBelch("%s(0x%p) %s %d\n", what, mutex, __FILE__, __LINE__)
#else
@@ -75,7 +75,7 @@ EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex)
# elif defined(HAVE_WINDOWS_H)
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
/* We jump through a hoop here to get a CCall EnterCriticalSection
and LeaveCriticalSection, as that's what C-- wants. */
@@ -110,7 +110,7 @@ typedef DWORD ThreadLocalKey;
typedef CRITICAL_SECTION Mutex;
-#ifdef LOCK_DEBUG
+#if defined(LOCK_DEBUG)
#define OS_ACQUIRE_LOCK(mutex) \
debugBelch("ACQUIRE_LOCK(0x%p) %s %d\n", mutex,__FILE__,__LINE__); \
@@ -158,7 +158,7 @@ typedef HANDLE Mutex;
# endif
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
//
// General thread operations
//
@@ -202,7 +202,7 @@ void setThreadNode (uint32_t node);
void releaseThreadNode (void);
#endif // !CMINUSMINUS
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
#define ACQUIRE_LOCK(l) OS_ACQUIRE_LOCK(l)
#define RELEASE_LOCK(l) OS_RELEASE_LOCK(l)
@@ -216,7 +216,7 @@ void releaseThreadNode (void);
#endif /* defined(THREADED_RTS) */
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
//
// Support for forkOS (defined regardless of THREADED_RTS, but does
// nothing when !THREADED_RTS).
diff --git a/includes/rts/Threads.h b/includes/rts/Threads.h
index 17a64c1ba0..fceacdc75d 100644
--- a/includes/rts/Threads.h
+++ b/includes/rts/Threads.h
@@ -14,7 +14,7 @@
#pragma once
-#ifdef HAVE_SYS_TYPES_H
+#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
diff --git a/includes/rts/prof/LDV.h b/includes/rts/prof/LDV.h
index fdbab4d901..dc7a0cabdf 100644
--- a/includes/rts/prof/LDV.h
+++ b/includes/rts/prof/LDV.h
@@ -13,7 +13,7 @@
#pragma once
-#ifdef PROFILING
+#if defined(PROFILING)
/* retrieves the LDV word from closure c */
#define LDVW(c) (((StgClosure *)(c))->header.prof.hp.ldvw)
@@ -28,7 +28,7 @@
* to zero.
*/
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#else
diff --git a/includes/rts/storage/Block.h b/includes/rts/storage/Block.h
index 3c6f2b1fba..c1d251856a 100644
--- a/includes/rts/storage/Block.h
+++ b/includes/rts/storage/Block.h
@@ -24,7 +24,7 @@
#error "Size of pointer is suspicious."
#endif
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define BLOCK_SIZE (1<<BLOCK_SHIFT)
#else
#define BLOCK_SIZE (UNIT<<BLOCK_SHIFT)
@@ -39,7 +39,7 @@
/* Megablock related constants (MBLOCK_SHIFT is defined in Constants.h) */
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define MBLOCK_SIZE (1<<MBLOCK_SHIFT)
#else
#define MBLOCK_SIZE (UNIT<<MBLOCK_SHIFT)
@@ -83,7 +83,7 @@
// client of the block allocator API. All other fields can be
// freely modified.
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
typedef struct bdescr_ {
StgPtr start; // [READ ONLY] start addr of memory
@@ -160,7 +160,7 @@ typedef struct bdescr_ {
/* Finding the block descriptor for a given block -------------------------- */
-#ifdef CMINUSMINUS
+#if defined(CMINUSMINUS)
#define Bdescr(p) \
((((p) & MBLOCK_MASK & ~BLOCK_MASK) >> (BLOCK_SHIFT-BDESCR_SHIFT)) \
@@ -206,7 +206,7 @@ EXTERN_INLINE bdescr *Bdescr(StgPtr p)
/* Number of usable blocks in a megablock */
-#ifndef CMINUSMINUS // already defined in DerivedConstants.h
+#if !defined(CMINUSMINUS) // already defined in DerivedConstants.h
#define BLOCKS_PER_MBLOCK ((MBLOCK_SIZE - FIRST_BLOCK_OFF) / BLOCK_SIZE)
#endif
@@ -221,7 +221,7 @@ EXTERN_INLINE bdescr *Bdescr(StgPtr p)
(1 + (W_)MBLOCK_ROUND_UP((n-BLOCKS_PER_MBLOCK) * BLOCK_SIZE) / MBLOCK_SIZE)
-#ifndef CMINUSMINUS
+#if !defined(CMINUSMINUS)
/* to the end... */
/* Double-linked block lists: --------------------------------------------- */
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h
index af77df37b5..be1569ba8e 100644
--- a/includes/rts/storage/ClosureMacros.h
+++ b/includes/rts/storage/ClosureMacros.h
@@ -54,7 +54,7 @@ INLINE_HEADER const StgInfoTable *GET_INFO(StgClosure *c) {
#define GET_ENTRY(c) (ENTRY_CODE(GET_INFO(c)))
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info);
EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgInfoTable *)info - 1;}
EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info);
@@ -116,8 +116,8 @@ INLINE_HEADER StgHalfWord GET_TAG(const StgClosure *con)
Macros for building closures
-------------------------------------------------------------------------- */
-#ifdef PROFILING
-#ifdef DEBUG_RETAINER
+#if defined(PROFILING)
+#if defined(DEBUG_RETAINER)
/*
For the sake of debugging, we take the safest way for the moment. Actually, this
is useful to check the sanity of heap before beginning retainer profiling.
@@ -540,7 +540,7 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n)
#define OVERWRITING_CLOSURE_OFS(c,n) /* nothing */
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
void LDV_recordDead (const StgClosure *c, uint32_t size);
#endif
diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h
index f5baead002..af89507f97 100644
--- a/includes/rts/storage/Closures.h
+++ b/includes/rts/storage/Closures.h
@@ -51,14 +51,14 @@ typedef struct {
typedef struct {
const StgInfoTable* info;
-#ifdef PROFILING
+#if defined(PROFILING)
StgProfHeader prof;
#endif
} StgHeader;
typedef struct {
const StgInfoTable* info;
-#ifdef PROFILING
+#if defined(PROFILING)
StgProfHeader prof;
#endif
StgSMPThunkHeader smp;
diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h
index 3201c105e1..c621e5e749 100644
--- a/includes/rts/storage/InfoTables.h
+++ b/includes/rts/storage/InfoTables.h
@@ -27,7 +27,7 @@
hackery can go away sometime.
------------------------------------------------------------------------- */
-#ifdef x86_64_TARGET_ARCH
+#if defined(x86_64_TARGET_ARCH)
#define OFFSET_FIELD(n) StgHalfInt n; StgHalfWord __pad_##n
#else
#define OFFSET_FIELD(n) StgInt n
@@ -38,7 +38,7 @@
-------------------------------------------------------------------------- */
typedef struct {
-#ifndef TABLES_NEXT_TO_CODE
+#if !defined(TABLES_NEXT_TO_CODE)
char *closure_type;
char *closure_desc;
#else
@@ -167,7 +167,7 @@ typedef union {
StgWord bitmap; /* word-sized bit pattern describing */
/* a stack frame: see below */
-#ifndef TABLES_NEXT_TO_CODE
+#if !defined(TABLES_NEXT_TO_CODE)
StgLargeBitmap* large_bitmap; /* pointer to large bitmap structure */
#else
OFFSET_FIELD(large_bitmap_offset); /* offset from info table to large bitmap structure */
@@ -187,7 +187,7 @@ typedef struct StgInfoTable_ {
StgFunPtr entry; /* pointer to the entry code */
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
StgProfInfo prof;
#endif
@@ -201,7 +201,7 @@ typedef struct StgInfoTable_ {
- a bitmap of SRT entries
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
StgCode code[];
#endif
} *StgInfoTablePtr; // StgInfoTable defined in rts/Types.h
@@ -339,7 +339,7 @@ typedef struct StgConInfoTable_ {
* GET_SRT(info)
* info must be a Stg[Ret|Thunk]InfoTable* (an info table that has a SRT)
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_SRT(info) ((StgSRT*) (((StgWord) ((info)+1)) + (info)->srt_offset))
#else
#define GET_SRT(info) ((info)->srt)
@@ -349,7 +349,7 @@ typedef struct StgConInfoTable_ {
* GET_CON_DESC(info)
* info must be a StgConInfoTable*.
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_CON_DESC(info) \
((const char *)((StgWord)((info)+1) + (info->con_desc)))
#else
@@ -360,20 +360,20 @@ typedef struct StgConInfoTable_ {
* GET_FUN_SRT(info)
* info must be a StgFunInfoTable*
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_FUN_SRT(info) ((StgSRT*) (((StgWord) ((info)+1)) + (info)->f.srt_offset))
#else
#define GET_FUN_SRT(info) ((info)->f.srt)
#endif
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_LARGE_BITMAP(info) ((StgLargeBitmap*) (((StgWord) ((info)+1)) \
+ (info)->layout.large_bitmap_offset))
#else
#define GET_LARGE_BITMAP(info) ((info)->layout.large_bitmap)
#endif
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_FUN_LARGE_BITMAP(info) ((StgLargeBitmap*) (((StgWord) ((info)+1)) \
+ (info)->f.b.bitmap_offset))
#else
@@ -383,12 +383,12 @@ typedef struct StgConInfoTable_ {
/*
* GET_PROF_TYPE, GET_PROF_DESC
*/
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_PROF_TYPE(info) ((char *)((StgWord)((info)+1) + (info->prof.closure_type_off)))
#else
#define GET_PROF_TYPE(info) ((info)->prof.closure_type)
#endif
-#ifdef TABLES_NEXT_TO_CODE
+#if defined(TABLES_NEXT_TO_CODE)
#define GET_PROF_DESC(info) ((char *)((StgWord)((info)+1) + (info->prof.closure_desc_off)))
#else
#define GET_PROF_DESC(info) ((info)->prof.closure_desc)
diff --git a/includes/rts/storage/MBlock.h b/includes/rts/storage/MBlock.h
index 9fbe92ec7d..20aed08e82 100644
--- a/includes/rts/storage/MBlock.h
+++ b/includes/rts/storage/MBlock.h
@@ -26,7 +26,7 @@ extern void freeAllMBlocks(void);
extern void *getFirstMBlock(void **state);
extern void *getNextMBlock(void **state, void *mblock);
-#ifdef THREADED_RTS
+#if defined(THREADED_RTS)
// needed for HEAP_ALLOCED below
extern SpinLock gc_alloc_block_sync;
#endif
diff --git a/includes/rts/storage/TSO.h b/includes/rts/storage/TSO.h
index e50e336a32..93018581fd 100644
--- a/includes/rts/storage/TSO.h
+++ b/includes/rts/storage/TSO.h
@@ -173,13 +173,13 @@ typedef struct StgTSO_ {
*/
StgWord32 tot_stack_size;
-#ifdef TICKY_TICKY
+#if defined(TICKY_TICKY)
/* TICKY-specific stuff would go here. */
#endif
-#ifdef PROFILING
+#if defined(PROFILING)
StgTSOProfInfo prof;
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
StgWord32 saved_winerror;
#endif