diff options
author | Erik de Castro Lopo <erik.decastrolopo@ambiata.com> | 2017-04-05 05:53:46 +1000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2017-04-05 05:53:47 +1000 |
commit | 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2 (patch) | |
tree | 0f330ad348b5100f1a21312e7c91e43966789ec8 /rts/linker/MachO.c | |
parent | 5e968f9261b798222a845ef38a54621b45013678 (diff) | |
download | haskell-7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2.tar.gz |
Enable new warning for fragile/incorrect CPP #if usage
The C code in the RTS now gets built with `-Wundef` and the Haskell code
(stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever
`#if` is used on undefined identifiers.
Test Plan: Validate on Linux and Windows
Reviewers: austin, angerman, simonmar, bgamari, Phyx
Reviewed By: bgamari
Subscribers: thomie, snowleopard
Differential Revision: https://phabricator.haskell.org/D3278
Diffstat (limited to 'rts/linker/MachO.c')
-rw-r--r-- | rts/linker/MachO.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index 16b712a804..a7c9189250 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -248,7 +248,8 @@ ocVerifyImage_MachO(ObjectCode * oc) IF_DEBUG(linker, debugBelch("ocVerifyImage_MachO: start\n")); -#if x86_64_HOST_ARCH || powerpc64_HOST_ARCH || aarch64_HOST_ARCH +#if defined(x86_64_HOST_ARCH) || defined(powerpc64_HOST_ARCH) \ + || defined(aarch64_HOST_ARCH) if(header->magic != MH_MAGIC_64) { errorBelch("Could not load image %s: bad magic!\n" " Expected %08x (64bit), got %08x%s\n", @@ -281,7 +282,7 @@ resolveImports( IF_DEBUG(linker, debugBelch("resolveImports: start\n")); -#if i386_HOST_ARCH +#if defined(i386_HOST_ARCH) int isJumpTable = 0; if (strcmp(sect->sectname,"__jump_table") == 0) { @@ -319,7 +320,7 @@ resolveImports( } ASSERT(addr); -#if i386_HOST_ARCH +#if defined(i386_HOST_ARCH) if (isJumpTable) { checkProddableBlock(oc,oc->image + sect->offset + i*itemSize, 5); @@ -1922,7 +1923,8 @@ machoGetMisalignment( FILE * f ) } fseek(f, -sizeof(header), SEEK_CUR); -#if x86_64_HOST_ARCH || powerpc64_HOST_ARCH || aarch64_HOST_ARCH +#if defined(x86_64_HOST_ARCH) || defined(powerpc64_HOST_ARCH) \ + || defined(aarch64_HOST_ARCH) if(header.magic != MH_MAGIC_64) { barf("Bad magic. Expected: %08x, got: %08x.", MH_MAGIC_64, header.magic); |