diff options
author | John Ericson <git@JohnEricson.me> | 2019-07-10 11:54:47 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-07-14 01:21:48 -0400 |
commit | d7c6c4717cdf1b7bd8550e37da66c52275c802f0 (patch) | |
tree | 7488a774c7b8e288b4373bcdc9121b53ba1492ea | |
parent | bd9fc1b2adea718be089b8370d2e82ea55af6539 (diff) | |
download | haskell-d7c6c4717cdf1b7bd8550e37da66c52275c802f0.tar.gz |
Expunge #ifdef and #ifndef from the codebase
These are unexploded minds as far as the linter is concerned. I don't
want to hit in my MRs by mistake!
I did this with `sed`, and then rolled back some changes in the docs,
config.guess, and the linter itself.
59 files changed, 108 insertions, 108 deletions
diff --git a/compiler/main/CodeOutput.hs b/compiler/main/CodeOutput.hs index 050e6f5c14..6f80df9676 100644 --- a/compiler/main/CodeOutput.hs +++ b/compiler/main/CodeOutput.hs @@ -252,8 +252,8 @@ outputForeignStubs dflags mod location stubs then Just stub_c else Nothing ) where - cplusplus_hdr = "#ifdef __cplusplus\nextern \"C\" {\n#endif\n" - cplusplus_ftr = "#ifdef __cplusplus\n}\n#endif\n" + cplusplus_hdr = "#if defined(__cplusplus)\nextern \"C\" {\n#endif\n" + cplusplus_ftr = "#if defined(__cplusplus)\n}\n#endif\n" -- Don't use doOutput for dumping the f. export stubs diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 7009771aa4..2315be3519 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -3020,7 +3020,7 @@ dynamic_flags_deps = [ , make_ord_flag defGhcFlag "rdynamic" $ noArg $ #if defined(linux_HOST_OS) addOptl "-rdynamic" -#elif defined (mingw32_HOST_OS) +#elif defined(mingw32_HOST_OS) addOptl "-Wl,--export-all-symbols" #else -- ignored for compat w/ gcc: diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index aa4afa5451..dba5a4495f 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -576,7 +576,7 @@ only _ = panic "Util: only" isIn, isn'tIn :: Eq a => String -> a -> [a] -> Bool -# ifndef DEBUG +# if !defined(DEBUG) isIn _msg x ys = x `elem` ys isn'tIn _msg x ys = x `notElem` ys diff --git a/docs/coding-style.html b/docs/coding-style.html index 6be9263d97..dbf0f8729a 100644 --- a/docs/coding-style.html +++ b/docs/coding-style.html @@ -88,7 +88,7 @@ together implement a subsystem which is described by a single external header file). <p><li>We use the following GCC extensions, but surround them with -<tt>#ifdef __GNUC__</tt>: +<tt>#if defined(__GNUC__)</tt>: <ul> <li>Function attributes (mostly just <code>no_return</code> and @@ -169,7 +169,7 @@ Instead, add an appropriate test to the configure.ac script and use the result of that test instead. <pre> - #ifdef HAVE_BSD_H + #if defined(HAVE_BSD_H) // use a BSD library #endif </pre> @@ -192,10 +192,10 @@ than trying to find a bug which only shows up when running GHC on itself and doesn't manifest itself until 10 seconds after the actual cause of the problem. -<p>We put all our debugging code inside <tt>#ifdef DEBUG</tt>. The +<p>We put all our debugging code inside <tt>#if defined(DEBUG)</tt>. The general policy is we don't ship code with debugging checks and assertions in it, but we do run with those checks in place when -developing and testing. Anything inside <tt>#ifdef DEBUG</tt> should +developing and testing. Anything inside <tt>#if defined(DEBUG)</tt> should not slow down the code by more than a factor of 2. <p>We also have more expensive "sanity checking" code for hardcore @@ -472,7 +472,7 @@ and by keeping it to 80 columns we can ensure that code looks OK on everyone's screen. Long lines are hard to read, and a sign that the code needs to be restructured anyway. -<li> When commenting out large chunks of code, use <code>#ifdef 0 +<li> When commenting out large chunks of code, use <code>#if defined(0) ... #endif</code> rather than <code>/* ... */</code> because C doesn't have nested comments. diff --git a/docs/storage-mgt/rp.tex b/docs/storage-mgt/rp.tex index 199b284b19..ced5c0cd4f 100644 --- a/docs/storage-mgt/rp.tex +++ b/docs/storage-mgt/rp.tex @@ -204,7 +204,7 @@ ways of building executable programs from source files: normal way and profiling way. We are concerned only about profiling way, and all the pieces of code implementing profiling way are wrapped by the @PROFILING@ -pre-processing directive (as in @\#ifdef PROFILING@). +pre-processing directive (as in @\#if defined(PROFILING)@). Therefore, all the additions and changes that we make to the source code are assumed to be wrapped by the @PROFILING@ pre-processing directive as well unless otherwise mentioned.} diff --git a/libraries/base/System/Environment/Blank.hsc b/libraries/base/System/Environment/Blank.hsc index 637a039809..02d369b5d6 100644 --- a/libraries/base/System/Environment/Blank.hsc +++ b/libraries/base/System/Environment/Blank.hsc @@ -40,7 +40,7 @@ module System.Environment.Blank ) where import Foreign.C -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) import Foreign.Ptr import GHC.Windows import Control.Monad @@ -61,7 +61,7 @@ import System.Environment withProgName, getEnvironment ) -#ifndef mingw32_HOST_OS +#if !defined(mingw32_HOST_OS) import qualified System.Environment as Environment #endif @@ -85,7 +85,7 @@ throwInvalidArgument from = -- | Similar to 'System.Environment.lookupEnv'. getEnv :: String -> IO (Maybe String) -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) getEnv = (<$> getEnvironment) . lookup #else getEnv = Environment.lookupEnv diff --git a/libraries/base/tests/IO/T12010/T12010.hsc b/libraries/base/tests/IO/T12010/T12010.hsc index e13a5fe5c7..9bcb92ef83 100644 --- a/libraries/base/tests/IO/T12010/T12010.hsc +++ b/libraries/base/tests/IO/T12010/T12010.hsc @@ -7,7 +7,7 @@ import Foreign.Marshal.Alloc import GHC.IO.FD import System.Exit -#ifdef _WIN32 +#if defined(_WIN32) #include <winsock.h> #else #include <sys/socket.h> @@ -21,7 +21,7 @@ sOCK_STREAM = #const SOCK_STREAM main :: IO () main = do -#ifdef _WIN32 +#if defined(_WIN32) void $ initWinSock #endif sock <- c_socket aF_INET sOCK_STREAM 0 @@ -34,6 +34,6 @@ main = do foreign import stdcall unsafe "socket" c_socket :: CInt -> CInt -> CInt -> IO CInt -#ifdef _WIN32 +#if defined(_WIN32) foreign import ccall unsafe "initWinSock" initWinSock :: IO Int #endif diff --git a/libraries/libiserv/src/GHCi/Utils.hsc b/libraries/libiserv/src/GHCi/Utils.hsc index b90cfacb5f..f606eb9d94 100644 --- a/libraries/libiserv/src/GHCi/Utils.hsc +++ b/libraries/libiserv/src/GHCi/Utils.hsc @@ -5,7 +5,7 @@ module GHCi.Utils import Foreign.C import GHC.IO.Handle (Handle()) -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) import GHC.IO.Handle.FD (fdToHandle) #else import System.Posix @@ -15,7 +15,7 @@ import System.Posix -- | Gets a GHC Handle File description from the given OS Handle or POSIX fd. getGhcHandle :: CInt -> IO Handle -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) getGhcHandle handle = _open_osfhandle handle (#const _O_BINARY) >>= fdToHandle foreign import ccall "io.h _open_osfhandle" _open_osfhandle :: diff --git a/rts/Capability.c b/rts/Capability.c index bda3b0e681..33a94398cd 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -842,7 +842,7 @@ void waitForCapability (Capability **pCap, Task *task) * * ------------------------------------------------------------------------- */ -#if defined (THREADED_RTS) +#if defined(THREADED_RTS) /* See Note [GC livelock] in Schedule.c for why we have gcAllowed and return the bool */ @@ -948,7 +948,7 @@ yieldCapability (Capability** pCap, Task *task, bool gcAllowed) * get every Capability into the GC. * ------------------------------------------------------------------------- */ -#if defined (THREADED_RTS) +#if defined(THREADED_RTS) void prodCapability (Capability *cap, Task *task) @@ -970,7 +970,7 @@ prodCapability (Capability *cap, Task *task) * * ------------------------------------------------------------------------- */ -#if defined (THREADED_RTS) +#if defined(THREADED_RTS) bool tryGrabCapability (Capability *cap, Task *task) diff --git a/rts/Capability.h b/rts/Capability.h index dc1c6c2073..2a5f127793 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -160,7 +160,7 @@ struct Capability_ { } // typedef Capability is defined in RtsAPI.h // We never want a Capability to overlap a cache line with anything // else, so round it up to a cache line size: -#ifndef mingw32_HOST_OS +#if !defined(mingw32_HOST_OS) ATTRIBUTE_ALIGNED(64) #endif ; diff --git a/rts/Hash.c b/rts/Hash.c index 658187b944..2f611c9079 100644 --- a/rts/Hash.c +++ b/rts/Hash.c @@ -80,7 +80,7 @@ int hashStr(const HashTable *table, StgWord w) { const char *key = (char*) w; -#ifdef x86_64_HOST_ARCH +#if defined(x86_64_HOST_ARCH) StgWord h = XXH64 (key, strlen(key), 1048583); #else StgWord h = XXH32 (key, strlen(key), 1048583); diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 75871a5f98..9bdd7530d5 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -361,7 +361,7 @@ void freeSegments(ObjectCode *oc); || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) # define OBJFORMAT_ELF # include "linker/ElfTypes.h" -#elif defined (mingw32_HOST_OS) +#elif defined(mingw32_HOST_OS) # define OBJFORMAT_PEi386 # include "linker/PEi386Types.h" #elif defined(darwin_HOST_OS) || defined(ios_HOST_OS) diff --git a/rts/RtsMessages.c b/rts/RtsMessages.c index a90962e89f..6f13580e06 100644 --- a/rts/RtsMessages.c +++ b/rts/RtsMessages.c @@ -114,7 +114,7 @@ vdebugBelch(const char*s, va_list ap) #define BUFSIZE 512 -#if defined (mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) static int isGUIApp(void) { diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 7f62643d3c..e34fcf03f5 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -49,7 +49,7 @@ SymE_HasProto(libdwPoolRelease) \ SymE_HasProto(libdwPoolClear) -#if !defined (mingw32_HOST_OS) +#if !defined(mingw32_HOST_OS) #define RTS_POSIX_ONLY_SYMBOLS \ SymI_HasProto(__hscore_get_saved_termios) \ SymI_HasProto(__hscore_set_saved_termios) \ diff --git a/rts/StgCRunAsm.S b/rts/StgCRunAsm.S index 9274a445b5..1dd74d3652 100644 --- a/rts/StgCRunAsm.S +++ b/rts/StgCRunAsm.S @@ -2,7 +2,7 @@ #include "rts/Constants.h" #if defined(powerpc64le_HOST_ARCH) -# ifdef linux_HOST_OS +# if defined(linux_HOST_OS) # define STACK_FRAME_SIZE RESERVED_C_STACK_BYTES+304 .file "StgCRun.c" .abiversion 2 diff --git a/rts/Ticky.c b/rts/Ticky.c index 55df113d5d..a0611fe4c4 100644 --- a/rts/Ticky.c +++ b/rts/Ticky.c @@ -25,7 +25,7 @@ StgEntCounter *ticky_entry_ctrs = NULL; /* root of list of them */ /* We want Haskell code compiled with -ticky to be linkable with any * version of the RTS, so we have to make sure all the symbols that * ticky-compiled code may refer to are defined by every RTS. (#3439) - * Hence the #ifdef is here, rather than up above. + * Hence the #if defined(is) here, rather than up above. */ #if defined(TICKY_TICKY) diff --git a/rts/Trace.c b/rts/Trace.c index e345377eef..d5c4319076 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -458,7 +458,7 @@ void traceOSProcessInfo_(void) { CAPSET_OSPROCESS_DEFAULT, getpid()); -#if !defined (mingw32_HOST_OS) +#if !defined(mingw32_HOST_OS) /* Windows has no strong concept of process hierarchy, so no getppid(). * In any case, this trace event is mainly useful for tracing programs * that use 'forkProcess' which Windows doesn't support anyway. diff --git a/rts/linker/ELFRelocs/AArch64.def b/rts/linker/ELFRelocs/AArch64.def index c21df07d2d..d77b681dc6 100644 --- a/rts/linker/ELFRelocs/AArch64.def +++ b/rts/linker/ELFRelocs/AArch64.def @@ -1,5 +1,5 @@ -#ifndef ELF_RELOC +#if !defined(ELF_RELOC) #error "ELF_RELOC must be defined" #endif diff --git a/rts/linker/ELFRelocs/ARM.def b/rts/linker/ELFRelocs/ARM.def index 730fc5b883..eb21e6cef6 100644 --- a/rts/linker/ELFRelocs/ARM.def +++ b/rts/linker/ELFRelocs/ARM.def @@ -1,5 +1,5 @@ -#ifndef ELF_RELOC +#if !defined(ELF_RELOC) #error "ELF_RELOC must be defined" #endif diff --git a/rts/linker/ELFRelocs/i386.def b/rts/linker/ELFRelocs/i386.def index 1d28cf595c..3191195ea8 100644 --- a/rts/linker/ELFRelocs/i386.def +++ b/rts/linker/ELFRelocs/i386.def @@ -1,5 +1,5 @@ -#ifndef ELF_RELOC +#if !defined(ELF_RELOC) #error "ELF_RELOC must be defined" #endif diff --git a/rts/linker/ELFRelocs/x86_64.def b/rts/linker/ELFRelocs/x86_64.def index 18fdcf9472..197931fa51 100644 --- a/rts/linker/ELFRelocs/x86_64.def +++ b/rts/linker/ELFRelocs/x86_64.def @@ -1,5 +1,5 @@ -#ifndef ELF_RELOC +#if !defined(ELF_RELOC) #error "ELF_RELOC must be defined" #endif diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 954993f086..0882f8d349 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -1122,13 +1122,13 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC, #endif switch (reloc_type) { -# ifdef i386_HOST_ARCH +# if defined(i386_HOST_ARCH) case COMPAT_R_386_NONE: break; case COMPAT_R_386_32: *pP = value; break; case COMPAT_R_386_PC32: *pP = value - P; break; # endif -# ifdef arm_HOST_ARCH +# if defined(arm_HOST_ARCH) case COMPAT_R_ARM_ABS32: /* (S + A) | T */ // Specified by Linux ARM ABI to be equivalent to ABS32 case COMPAT_R_ARM_TARGET1: diff --git a/rts/linker/ElfTypes.h b/rts/linker/ElfTypes.h index 852d82a498..e5333d71a7 100644 --- a/rts/linker/ElfTypes.h +++ b/rts/linker/ElfTypes.h @@ -1,4 +1,4 @@ -#ifndef ElfTypes_h +#if !defined(ElfTypes_h) #define ElfTypes_h #if defined(OBJFORMAT_ELF) diff --git a/rts/linker/elf_compat.h b/rts/linker/elf_compat.h index c42f1f8949..b409728a09 100644 --- a/rts/linker/elf_compat.h +++ b/rts/linker/elf_compat.h @@ -9,7 +9,7 @@ // under which it is distrubuted. // -#ifndef RTS_ELF_COMPAT_H +#if !defined(RTS_ELF_COMPAT_H) #define RTS_ELF_COMPAT_H #define PASTE(x,y) x ## y diff --git a/rts/linker/elf_util.h b/rts/linker/elf_util.h index d94eb6992e..2ece198268 100644 --- a/rts/linker/elf_util.h +++ b/rts/linker/elf_util.h @@ -1,4 +1,4 @@ -#ifndef RTS_LINKER_ELF_UTIL_H +#if !defined(RTS_LINKER_ELF_UTIL_H) #define RTS_LINKER_ELF_UTIL_H #include "LinkerInternals.h" diff --git a/rts/linker/util.h b/rts/linker/util.h index f2aa50649d..77f06978ab 100644 --- a/rts/linker/util.h +++ b/rts/linker/util.h @@ -1,4 +1,4 @@ -#ifndef RTS_LINKER_UTIL_H +#if !defined(RTS_LINKER_UTIL_H) #define RTS_LINKER_UTIL_H #include <stdint.h> diff --git a/rts/package.conf.in b/rts/package.conf.in index dc44b74ac1..a0e124a061 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -55,7 +55,7 @@ extra-libraries: ,"bfd", "iberty" /* for debugging */ #endif #if defined(HAVE_LIBMINGWEX) -# ifndef INSTALLING /* Bundled Mingw is behind */ +# if !defined(INSTALLING) /* Bundled Mingw is behind */ ,"mingwex" # endif #endif diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index cf4b705d74..dc8c4122f7 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -49,17 +49,17 @@ #include <sys/sysctl.h> #endif -#ifndef MAP_FAILED +#if !defined(MAP_FAILED) # define MAP_FAILED ((void *)-1) #endif #if defined(hpux_HOST_OS) -# ifndef MAP_ANON +# if !defined(MAP_ANON) # define MAP_ANON MAP_ANONYMOUS # endif #endif -#ifndef darwin_HOST_OS +#if !defined(darwin_HOST_OS) # undef RESERVE_FLAGS # if defined(MAP_GUARD) # define RESERVE_FLAGS MAP_GUARD /* FreeBSD */ diff --git a/rts/posix/Select.c b/rts/posix/Select.c index 211d47dbec..5b143e1bf7 100644 --- a/rts/posix/Select.c +++ b/rts/posix/Select.c @@ -23,11 +23,11 @@ #include "Stats.h" #include "GetTime.h" -# ifdef HAVE_SYS_SELECT_H +# if defined(HAVE_SYS_SELECT_H) # include <sys/select.h> # endif -# ifdef HAVE_SYS_TYPES_H +# if defined(HAVE_SYS_TYPES_H) # include <sys/types.h> # endif diff --git a/rts/win32/ConsoleHandler.c b/rts/win32/ConsoleHandler.c index 545a76a004..3ddf4103da 100644 --- a/rts/win32/ConsoleHandler.c +++ b/rts/win32/ConsoleHandler.c @@ -37,7 +37,7 @@ void initUserSignals(void) { console_handler = STG_SIG_DFL; -#if !defined (THREADED_RTS) +#if !defined(THREADED_RTS) stg_pending_events = 0; if (hConsoleEvent == INVALID_HANDLE_VALUE) { hConsoleEvent = @@ -59,7 +59,7 @@ freeSignalHandlers(void) { void finiUserSignals(void) { -#if !defined (THREADED_RTS) +#if !defined(THREADED_RTS) if (hConsoleEvent != INVALID_HANDLE_VALUE) { CloseHandle(hConsoleEvent); } @@ -162,7 +162,7 @@ void awaitUserSignals(void) } -#if !defined (THREADED_RTS) +#if !defined(THREADED_RTS) /* * Function: startSignalHandlers() * diff --git a/rts/xxhash.c b/rts/xxhash.c index 833b99f3b2..fd63ba89dd 100644 --- a/rts/xxhash.c +++ b/rts/xxhash.c @@ -49,7 +49,7 @@ * See http://stackoverflow.com/a/32095106/646947 for details. * Prefer these methods in priority order (0 > 1 > 2) */ -#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ +#if !defined(XXH_FORCE_MEMORY_ACCESS) /* can be defined externally, on command line for example */ # if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) # define XXH_FORCE_MEMORY_ACCESS 2 # elif defined(__INTEL_COMPILER) || \ @@ -73,7 +73,7 @@ * to improve speed for Big-endian CPU. * This option has no impact on Little_Endian CPU. */ -#ifndef XXH_FORCE_NATIVE_FORMAT /* can be defined externally */ +#if !defined(XXH_FORCE_NATIVE_FORMAT) /* can be defined externally */ # define XXH_FORCE_NATIVE_FORMAT 0 #endif @@ -84,7 +84,7 @@ * set it to 0 when the input is guaranteed to be aligned, * or when alignment doesn't matter for performance. */ -#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ +#if !defined(XXH_FORCE_ALIGN_CHECK) /* can be defined externally */ # if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) # define XXH_FORCE_ALIGN_CHECK 0 # else @@ -112,12 +112,12 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcp /* ************************************* * Compiler Specific Options ***************************************/ -#ifdef _MSC_VER /* Visual Studio */ +#if defined(_MSC_VER) /* Visual Studio */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ # define FORCE_INLINE static __forceinline #else -# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# ifdef __GNUC__ +# if defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# if defined(__GNUC__) # define FORCE_INLINE static inline __attribute__((always_inline)) # else # define FORCE_INLINE static inline @@ -131,8 +131,8 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcp /* ************************************* * Basic Types ***************************************/ -#ifndef MEM_MODULE -# if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +#if !defined(MEM_MODULE) +# if !defined(__VMS) && (defined(__cplusplus) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) # include <stdint.h> typedef uint8_t BYTE; typedef uint16_t U16; @@ -206,7 +206,7 @@ static U32 XXH_swap32 (U32 x) typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; /* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example on the compiler command line */ -#ifndef XXH_CPU_LITTLE_ENDIAN +#if !defined(XXH_CPU_LITTLE_ENDIAN) static const int g_one = 1; # define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&g_one)) #endif @@ -267,7 +267,7 @@ FORCE_INLINE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH U32 h32; #define XXH_get32bits(p) XXH_readLE32_align(p, endian, align) -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) if (p==NULL) { len=0; bEnd=p=(const BYTE*)(size_t)16; @@ -380,7 +380,7 @@ FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state, const void const BYTE* p = (const BYTE*)input; const BYTE* const bEnd = p + len; -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) if (input==NULL) return XXH_ERROR; #endif @@ -513,7 +513,7 @@ XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src } -#ifndef XXH_NO_LONG_LONG +#if !defined(XXH_NO_LONG_LONG) /* ******************************************************************* * 64-bits hash functions @@ -521,9 +521,9 @@ XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src /*====== Memory access ======*/ -#ifndef MEM_MODULE +#if !defined(MEM_MODULE) # define MEM_MODULE -# if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# if !defined(__VMS) && (defined(__cplusplus) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) # include <stdint.h> typedef uint64_t U64; # else @@ -627,7 +627,7 @@ FORCE_INLINE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH U64 h64; #define XXH_get64bits(p) XXH_readLE64_align(p, endian, align) -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) if (p==NULL) { len=0; bEnd=p=(const BYTE*)(size_t)32; @@ -749,7 +749,7 @@ FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state, const void const BYTE* p = (const BYTE*)input; const BYTE* const bEnd = p + len; -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER +#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) if (input==NULL) return XXH_ERROR; #endif diff --git a/rts/xxhash.h b/rts/xxhash.h index 9d831e03b3..98ec9639cb 100644 --- a/rts/xxhash.h +++ b/rts/xxhash.h @@ -64,10 +64,10 @@ XXH64 13.8 GB/s 1.9 GB/s XXH32 6.8 GB/s 6.0 GB/s */ -#ifndef XXHASH_H_5627135585666179 +#if !defined(XXHASH_H_5627135585666179) #define XXHASH_H_5627135585666179 1 -#if defined (__cplusplus) +#if defined(__cplusplus) extern "C" { #endif @@ -91,13 +91,13 @@ typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; * `xxhash.c` is automatically included. * It's not useful to compile and link it as a separate module. */ -#ifdef XXH_PRIVATE_API -# ifndef XXH_STATIC_LINKING_ONLY +#if defined(XXH_PRIVATE_API) +# if !defined(XXH_STATIC_LINKING_ONLY) # define XXH_STATIC_LINKING_ONLY # endif # if defined(__GNUC__) # define XXH_PUBLIC_API static __inline __attribute__((unused)) -# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) +# elif defined(__cplusplus) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) # define XXH_PUBLIC_API static inline # elif defined(_MSC_VER) # define XXH_PUBLIC_API static __inline @@ -119,7 +119,7 @@ with the value of XXH_NAMESPACE (therefore, avoid NULL and numeric values). Note that no change is required within the calling program as long as it includes `xxhash.h` : regular symbol name will be automatically translated by this header. */ -#ifdef XXH_NAMESPACE +#if defined(XXH_NAMESPACE) # define XXH_CAT(A,B) A##B # define XXH_NAME2(A,B) XXH_CAT(A,B) # define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) @@ -211,7 +211,7 @@ XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src */ -#ifndef XXH_NO_LONG_LONG +#if !defined(XXH_NO_LONG_LONG) /*-********************************************************************** * 64-bits hash ************************************************************************/ @@ -241,7 +241,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src #endif /* XXH_NO_LONG_LONG */ -#ifdef XXH_STATIC_LINKING_ONLY +#if defined(XXH_STATIC_LINKING_ONLY) /* ================================================================================================ This section contains definitions which are not guaranteed to remain stable. @@ -266,7 +266,7 @@ struct XXH32_state_s { unsigned reserved; /* never read nor write, will be removed in a future version */ }; /* typedef'd to XXH32_state_t */ -#ifndef XXH_NO_LONG_LONG /* remove 64-bits support */ +#if !defined(XXH_NO_LONG_LONG) /* remove 64-bits support */ struct XXH64_state_s { unsigned long long total_len; unsigned long long v1; @@ -279,14 +279,14 @@ struct XXH64_state_s { }; /* typedef'd to XXH64_state_t */ #endif -#ifdef XXH_PRIVATE_API +#if defined(XXH_PRIVATE_API) # include "xxhash.c" /* include xxhash function bodies as `static`, for inlining */ #endif #endif /* XXH_STATIC_LINKING_ONLY */ -#if defined (__cplusplus) +#if defined(__cplusplus) } #endif diff --git a/testsuite/tests/codeGen/should_run/T7600.hs b/testsuite/tests/codeGen/should_run/T7600.hs index 9f0e118b44..4193fdc33f 100644 --- a/testsuite/tests/codeGen/should_run/T7600.hs +++ b/testsuite/tests/codeGen/should_run/T7600.hs @@ -103,7 +103,7 @@ main = test_run float_number double_number -- in "0x" ++ str -- -- fixEndian :: [a] -> [a] --- -- #ifdef WORDS_BIGENDIAN +-- -- #if defined(WORDS_BIGENDIAN) -- -- fixEndian = id -- -- #else -- fixEndian = reverse diff --git a/testsuite/tests/codeGen/should_run/cgrun044.hs b/testsuite/tests/codeGen/should_run/cgrun044.hs index 17811f110a..f5f3939895 100644 --- a/testsuite/tests/codeGen/should_run/cgrun044.hs +++ b/testsuite/tests/codeGen/should_run/cgrun044.hs @@ -11,7 +11,7 @@ import Data.Array.ST #include "ghcconfig.h" reverse_if_bigendian :: [a] -> [a] -#ifdef WORDS_BIGENDIAN +#if defined(WORDS_BIGENDIAN) reverse_if_bigendian = reverse #else reverse_if_bigendian = id diff --git a/testsuite/tests/concurrent/should_run/conc036.hs b/testsuite/tests/concurrent/should_run/conc036.hs index 528649ce56..6bfee0336a 100644 --- a/testsuite/tests/concurrent/should_run/conc036.hs +++ b/testsuite/tests/concurrent/should_run/conc036.hs @@ -8,7 +8,7 @@ import Prelude hiding (catch) import Foreign import System.IO -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) sleep n = sleepBlock (n*1000) foreign import stdcall unsafe "Sleep" sleepBlock :: Int -> IO () #else diff --git a/testsuite/tests/concurrent/should_run/conc037.hs b/testsuite/tests/concurrent/should_run/conc037.hs index 7da76f5025..6f6d5e2d0a 100644 --- a/testsuite/tests/concurrent/should_run/conc037.hs +++ b/testsuite/tests/concurrent/should_run/conc037.hs @@ -4,7 +4,7 @@ module Main where import Control.Concurrent -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) foreign import stdcall safe "Sleep" _sleepBlock :: Int -> IO () sleepBlock n = _sleepBlock (n*1000) #else diff --git a/testsuite/tests/concurrent/should_run/conc038.hs b/testsuite/tests/concurrent/should_run/conc038.hs index e4489e1cf3..bf7fd6d261 100644 --- a/testsuite/tests/concurrent/should_run/conc038.hs +++ b/testsuite/tests/concurrent/should_run/conc038.hs @@ -10,7 +10,7 @@ haskellFun c = putStrLn ("Haskell: " ++ show c) foreign export ccall "hFun" haskellFun :: Int -> IO () foreign import ccall safe "hFun" hFun :: Int -> IO () -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) foreign import stdcall safe "Sleep" _sleepBlock :: Int -> IO () sleepBlock n = _sleepBlock (n*1000) #else diff --git a/testsuite/tests/concurrent/should_run/conc059.hs b/testsuite/tests/concurrent/should_run/conc059.hs index 148c0ba63d..86e202c9a2 100644 --- a/testsuite/tests/concurrent/should_run/conc059.hs +++ b/testsuite/tests/concurrent/should_run/conc059.hs @@ -18,7 +18,7 @@ f x = do foreign export ccall "f" f :: Int -> IO () -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) # if defined(i386_HOST_ARCH) # define WINDOWS_CCONV stdcall # elif defined(x86_64_HOST_ARCH) diff --git a/testsuite/tests/concurrent/should_run/foreignInterruptible.hs b/testsuite/tests/concurrent/should_run/foreignInterruptible.hs index 73585ec43b..6cd18388ed 100644 --- a/testsuite/tests/concurrent/should_run/foreignInterruptible.hs +++ b/testsuite/tests/concurrent/should_run/foreignInterruptible.hs @@ -6,7 +6,7 @@ import Control.Exception import Foreign import System.IO -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) sleep n = sleepBlock (n*1000) foreign import stdcall interruptible "Sleep" sleepBlock :: Int -> IO () #else diff --git a/testsuite/tests/driver/T11763.hs b/testsuite/tests/driver/T11763.hs index 3fd5df9fce..6fcb4b97b5 100644 --- a/testsuite/tests/driver/T11763.hs +++ b/testsuite/tests/driver/T11763.hs @@ -1,5 +1,5 @@ {-# LANGUAGE CPP #-} main = do -#ifndef VERSION_containers +#if !defined(VERSION_containers) putStrLn "OK" #endif diff --git a/testsuite/tests/driver/T2464.hs b/testsuite/tests/driver/T2464.hs index 6bee708e4b..84a7c03cca 100644 --- a/testsuite/tests/driver/T2464.hs +++ b/testsuite/tests/driver/T2464.hs @@ -1,7 +1,7 @@ {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -DTEST #-} {-# OPTIONS_GHC -fffi #-} -- deprecation warning -#ifdef TEST +#if defined(TEST) {-# LANGUAGE EmptyDataDecls #-} #endif diff --git a/testsuite/tests/ffi/should_compile/T11983.h b/testsuite/tests/ffi/should_compile/T11983.h index 33c78cb9a4..c4b0a2038c 100644 --- a/testsuite/tests/ffi/should_compile/T11983.h +++ b/testsuite/tests/ffi/should_compile/T11983.h @@ -1,4 +1,4 @@ -#ifndef T11983_H +#if !defined(T11983_H) #define T11983_H #include <stdint.h> diff --git a/testsuite/tests/ffi/should_run/capi_ctype_001.h b/testsuite/tests/ffi/should_run/capi_ctype_001.h index 11add5bf3d..a51f030aa7 100644 --- a/testsuite/tests/ffi/should_run/capi_ctype_001.h +++ b/testsuite/tests/ffi/should_run/capi_ctype_001.h @@ -1,5 +1,5 @@ -#ifndef __capi_ctype_001_H__ +#if !defined(__capi_ctype_001_H__) #define __capi_ctype_001_H__ typedef struct { diff --git a/testsuite/tests/ffi/should_run/capi_ctype_002_A.h b/testsuite/tests/ffi/should_run/capi_ctype_002_A.h index 26928a3436..e6b5dc0504 100644 --- a/testsuite/tests/ffi/should_run/capi_ctype_002_A.h +++ b/testsuite/tests/ffi/should_run/capi_ctype_002_A.h @@ -1,5 +1,5 @@ -#ifndef __capi_ctype_002_A_H__ +#if !defined(__capi_ctype_002_A_H__) #define __capi_ctype_002_A_H__ typedef struct { diff --git a/testsuite/tests/ffi/should_run/capi_ctype_002_B.h b/testsuite/tests/ffi/should_run/capi_ctype_002_B.h index 6928290f47..fb6cef8caf 100644 --- a/testsuite/tests/ffi/should_run/capi_ctype_002_B.h +++ b/testsuite/tests/ffi/should_run/capi_ctype_002_B.h @@ -1,5 +1,5 @@ -#ifndef __capi_ctype_002_B_H__ +#if !defined(__capi_ctype_002_B_H__) #define __capi_ctype_002_B_H__ #define f(p) p->j diff --git a/testsuite/tests/ffi/should_run/fptr01.h b/testsuite/tests/ffi/should_run/fptr01.h index b50cc41776..8862c9b9ce 100644 --- a/testsuite/tests/ffi/should_run/fptr01.h +++ b/testsuite/tests/ffi/should_run/fptr01.h @@ -1,4 +1,4 @@ -#ifndef FPTR01_H_INCLUDED +#if !defined(FPTR01_H_INCLUDED) #define FPTR01_H_INCLUDED void f( HsInt * ); diff --git a/testsuite/tests/ffi/should_run/fptrfail01.h b/testsuite/tests/ffi/should_run/fptrfail01.h index 3e10d8bd7a..a1611b300a 100644 --- a/testsuite/tests/ffi/should_run/fptrfail01.h +++ b/testsuite/tests/ffi/should_run/fptrfail01.h @@ -1,4 +1,4 @@ -#ifndef FPTRFAIL01_H_INCLUDED +#if !defined(FPTRFAIL01_H_INCLUDED) #define FPTRFAIL01_H_INCLUDED void f( HsInt * ); diff --git a/testsuite/tests/hsc2hs/T10272.h b/testsuite/tests/hsc2hs/T10272.h index 6d8142d909..1f3d724930 100644 --- a/testsuite/tests/hsc2hs/T10272.h +++ b/testsuite/tests/hsc2hs/T10272.h @@ -1,4 +1,4 @@ -#ifndef _T10272_H_ +#if !defined(_T10272_H_) #define _T10272_H_ #include <stdint.h> diff --git a/testsuite/tests/indexed-types/should_compile/T12538.hs b/testsuite/tests/indexed-types/should_compile/T12538.hs index 9aff36e47d..4347197486 100644 --- a/testsuite/tests/indexed-types/should_compile/T12538.hs +++ b/testsuite/tests/indexed-types/should_compile/T12538.hs @@ -20,7 +20,7 @@ class (r ~ Tag a) => TagImpl a r | a -> r where instance {-# OVERLAPPING #-} (r ~ Tag (Tagged t a)) => TagImpl (Tagged t a) r where tag = id -#ifdef WRONG +#if defined(WRONG) instance {-# OVERLAPPING #-} (r ~ Tagged t a, r ~ Tag a) => TagImpl a r where #else instance {-# OVERLAPPING #-} (r ~ Tagged Int a, r ~ Tag a) => TagImpl a r where diff --git a/testsuite/tests/rename/should_fail/T9032.hs b/testsuite/tests/rename/should_fail/T9032.hs index 0a00ba37b0..2b62aa21fb 100644 --- a/testsuite/tests/rename/should_fail/T9032.hs +++ b/testsuite/tests/rename/should_fail/T9032.hs @@ -2,7 +2,7 @@ module T9032 where -#ifdef ERR +#if defined(ERR) import T9032 #endif diff --git a/testsuite/tests/rts/T12031/foo.h b/testsuite/tests/rts/T12031/foo.h index d3ca4aad2d..ce205b2c73 100644 --- a/testsuite/tests/rts/T12031/foo.h +++ b/testsuite/tests/rts/T12031/foo.h @@ -1,6 +1,6 @@ // Copyright (c) 2016, Ryan Scott // foo.h -#ifndef FOO_H +#if !defined(FOO_H) #define FOO_H extern int foo; diff --git a/testsuite/tests/rts/spalign.c b/testsuite/tests/rts/spalign.c index 0b776e17cc..fe615eecbd 100644 --- a/testsuite/tests/rts/spalign.c +++ b/testsuite/tests/rts/spalign.c @@ -1,12 +1,12 @@ #include "Rts.h" -#ifdef darwin_HOST_OS +#if defined(darwin_HOST_OS) #define STG_GLOBAL ".globl " #else #define STG_GLOBAL ".global " #endif -#ifdef LEADING_UNDERSCORE +#if defined(LEADING_UNDERSCORE) #define GETESP "_getesp" #else #define GETESP "getesp" diff --git a/testsuite/tests/rts/testheapalloced.c b/testsuite/tests/rts/testheapalloced.c index a28079572a..240f787c14 100644 --- a/testsuite/tests/rts/testheapalloced.c +++ b/testsuite/tests/rts/testheapalloced.c @@ -1,10 +1,10 @@ #include "Rts.h" #include "RtsFlags.h" -#ifdef DEBUG +#if defined(DEBUG) #define INLINE_HEADER #endif #include "MBlock.h" -#ifdef DEBUG +#if defined(DEBUG) extern void *getFirstMBlock(void); extern void *getNextMBlock(void *mblock); #endif @@ -42,7 +42,7 @@ int main (int argc, char *argv[]) a[j] = allocGroup_lock(rand() % MAXALLOC + 1); } -#ifdef DEBUG +#if defined(DEBUG) { void *p; i = 0; diff --git a/testsuite/tests/rts/testwsdeque.c b/testsuite/tests/rts/testwsdeque.c index 0a2a64d78e..8d3a88cf57 100644 --- a/testsuite/tests/rts/testwsdeque.c +++ b/testsuite/tests/rts/testwsdeque.c @@ -18,7 +18,7 @@ OSThreadId ids[THREADS]; // ----------------------------------------------------------------------------- // version of stealWSDeque() that logs its actions, for debugging -#ifdef DEBUG +#if defined(DEBUG) #define BUF 128 @@ -128,7 +128,7 @@ void OSThreadProcAttr thief(void *info) n = (StgWord)info; while (!done) { -#ifdef DEBUG +#if defined(DEBUG) p = myStealWSDeque(q,n); #else p = stealWSDeque(q); @@ -163,7 +163,7 @@ int main(int argc, char*argv[]) pushWSDeque(q,&scratch[n]); } -#ifdef DEBUG +#if defined(DEBUG) debugBelch("main thread finished, popped %d", count); #endif exit(0); diff --git a/testsuite/tests/simplCore/T9646/cbits/primitive-memops.h b/testsuite/tests/simplCore/T9646/cbits/primitive-memops.h index 700ef05a8d..cfafbb4f6d 100644 --- a/testsuite/tests/simplCore/T9646/cbits/primitive-memops.h +++ b/testsuite/tests/simplCore/T9646/cbits/primitive-memops.h @@ -1,4 +1,4 @@ -#ifndef haskell_primitive_memops_h +#if !defined(haskell_primitive_memops_h) #define haskell_primitive_memops_h #include <stdlib.h> diff --git a/testsuite/tests/simplCore/should_compile/T8832.hs b/testsuite/tests/simplCore/should_compile/T8832.hs index db5e3a78b6..0cbff6976b 100644 --- a/testsuite/tests/simplCore/should_compile/T8832.hs +++ b/testsuite/tests/simplCore/should_compile/T8832.hs @@ -17,7 +17,7 @@ T(i,Int) T(i8,Int8) T(i16,Int16) T(i32,Int32) -#ifdef T8832_WORDSIZE_64 +#if defined(T8832_WORDSIZE_64) T(i64,Int64) #endif @@ -25,7 +25,7 @@ T(w,Word) T(w8,Word8) T(w16,Word16) T(w32,Word32) -#ifdef T8832_WORDSIZE_64 +#if defined(T8832_WORDSIZE_64) T(w64,Word64) #endif diff --git a/testsuite/tests/typecheck/should_run/T1735.hs b/testsuite/tests/typecheck/should_run/T1735.hs index 8a23c9effe..44dc54197a 100644 --- a/testsuite/tests/typecheck/should_run/T1735.hs +++ b/testsuite/tests/typecheck/should_run/T1735.hs @@ -41,7 +41,7 @@ mkMyListConstr = mkConstr myListDataType "MkMyList" [] Prefix myListDataType :: DataType myListDataType = mkDataType "MyList" [mkMyListConstr] -#ifdef FOO +#if defined(FOO) rigidTests :: Maybe (Maybe [YesNo]) rigidTests = mkTest [Elem "No" []] (Just [No]) diff --git a/testsuite/tests/typecheck/should_run/T1735_Help/Main.hs b/testsuite/tests/typecheck/should_run/T1735_Help/Main.hs index 0c59d449fa..15dd583c6e 100644 --- a/testsuite/tests/typecheck/should_run/T1735_Help/Main.hs +++ b/testsuite/tests/typecheck/should_run/T1735_Help/Main.hs @@ -42,7 +42,7 @@ mkMyListConstr = mkConstr myListDataType "MkMyList" [] Prefix myListDataType :: DataType myListDataType = mkDataType "MyList" [mkMyListConstr] -#ifdef FOO +#if defined(FOO) rigidTests :: Maybe (Maybe [YesNo]) rigidTests = mkTest [Elem "No" []] (Just [No]) diff --git a/utils/iserv/src/Main.hs b/utils/iserv/src/Main.hs index 858cee8e94..15ea9f5030 100644 --- a/utils/iserv/src/Main.hs +++ b/utils/iserv/src/Main.hs @@ -26,7 +26,7 @@ dieWithUsage = do prog <- getProgName die $ prog ++ ": " ++ msg where -#ifdef WINDOWS +#if defined(WINDOWS) msg = "usage: iserv <write-handle> <read-handle> [-v]" #else msg = "usage: iserv <write-fd> <read-fd> [-v]" |