[commit: ghc] master: We define the `<XXX>_HOST_ARCH` to `1`, but never to `0`in (b5ca082)
git at git.haskell.org
git at git.haskell.org
Thu May 11 13:00:59 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b5ca082d297bc6306f445cb672a07b907dff8b18/ghc
>---------------------------------------------------------------
commit b5ca082d297bc6306f445cb672a07b907dff8b18
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date: Thu May 11 18:14:26 2017 +0800
We define the `<XXX>_HOST_ARCH` to `1`, but never to `0`in
compiler/ghc.mk
@echo "#define $(HostArch_CPP)_HOST_ARCH 1" >> $@
@echo "#define $(TargetArch_CPP)_HOST_ARCH 1" >> $@
this leads to warnigns like:
> warning: 'x86_64_HOST_ARCH' is not defined, evaluates to 0 [-Wundef]
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3555
>---------------------------------------------------------------
b5ca082d297bc6306f445cb672a07b907dff8b18
rts/linker/MachOTypes.h | 7 ++++---
rts/sm/HeapAlloc.h | 2 +-
rts/win32/OSThreads.c | 16 ++++++++--------
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/rts/linker/MachOTypes.h b/rts/linker/MachOTypes.h
index 7d9d64c..4176c48 100644
--- a/rts/linker/MachOTypes.h
+++ b/rts/linker/MachOTypes.h
@@ -6,13 +6,14 @@
#include <mach-o/loader.h>
-#if x86_64_HOST_ARCH || powerpc64_HOST_ARCH \
- || aarch64_HOST_ARCH || arm64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH) || defined(powerpc64_HOST_ARCH) \
+ || defined(aarch64_HOST_ARCH) || defined(arm64_HOST_ARCH)
typedef struct mach_header_64 MachOHeader;
typedef struct segment_command_64 MachOSegmentCommand;
typedef struct section_64 MachOSection;
typedef struct nlist_64 MachONList;
-#elif i386_HOST_ARCH || powerpc_HOST_ARCH || arm_HOST_ARCH
+#elif defined(i386_HOST_ARCH) || defined(powerpc_HOST_ARCH) \
+ || defined(arm_HOST_ARCH)
typedef struct mach_header MachOHeader;
typedef struct segment_command MachOSegmentCommand;
typedef struct section MachOSection;
diff --git a/rts/sm/HeapAlloc.h b/rts/sm/HeapAlloc.h
index 9a36d10..197317f 100644
--- a/rts/sm/HeapAlloc.h
+++ b/rts/sm/HeapAlloc.h
@@ -130,7 +130,7 @@ extern StgWord8 mblock_map[];
#define MBC_LINE_BITS 0
#define MBC_TAG_BITS 15
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
// 32bits are enough for 'entry' as modern amd64 boxes have
// only 48bit sized virtual addres.
typedef StgWord32 MbcCacheLine;
diff --git a/rts/win32/OSThreads.c b/rts/win32/OSThreads.c
index 4deb14a..ad42340 100644
--- a/rts/win32/OSThreads.c
+++ b/rts/win32/OSThreads.c
@@ -251,7 +251,7 @@ forkOS_createThread ( HsStablePtr entry )
(unsigned*)&pId) == 0);
}
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
/* We still support Windows Vista, so we can't depend on it
and must manually resolve these. */
typedef DWORD(WINAPI *GetItemCountProc)(WORD);
@@ -306,7 +306,7 @@ getNumberOfProcessorsGroups (void)
static uint8_t n_groups = 0;
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
if (!n_groups)
{
/* We still support Windows Vista. Which means we can't rely
@@ -328,7 +328,7 @@ getNumberOfProcessorsGroups (void)
return n_groups;
}
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
static uint8_t*
getProcessorsDistribution (void)
{
@@ -377,7 +377,7 @@ getProcessorsCumulativeSum(void)
cpuGroupCumulativeCache = malloc(n_groups * sizeof(uint32_t));
memset(cpuGroupCumulativeCache, 0, n_groups * sizeof(uint32_t));
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
uint8_t* proc_dist = getProcessorsDistribution();
uint32_t cum_num_proc = 0;
for (int i = 0; i < n_groups; i++)
@@ -419,7 +419,7 @@ createProcessorGroupMap (void)
/* For 32bit Windows and 64bit older than Windows 7, create a default mapping. */
memset(cpuGroupCache, 0, numProcs * sizeof(uint8_t));
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
uint8_t* proc_dist = getProcessorsDistribution();
int totalProcs = 0;
@@ -443,7 +443,7 @@ getNumberOfProcessors (void)
{
static uint32_t nproc = 0;
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
/* We still support Windows Vista. Which means we can't rely
on the API being available. So we'll have to resolve manually. */
HMODULE kernel = GetModuleHandleW(L"kernel32");
@@ -510,7 +510,7 @@ setThreadAffinity (uint32_t n, uint32_t m) // cap N of M
mask[group] |= 1 << ix;
}
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
/* We still support Windows Vista. Which means we can't rely
on the API being available. So we'll have to resolve manually. */
HMODULE kernel = GetModuleHandleW(L"kernel32");
@@ -520,7 +520,7 @@ setThreadAffinity (uint32_t n, uint32_t m) // cap N of M
for (i = 0; i < n_groups; i++)
{
-#if x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
// If we support the new API, use it.
if (mask[i] > 0 && SetThreadGroupAffinity)
{
More information about the ghc-commits
mailing list