Commit 819c3db7 authored by Ben Gamari's avatar Ben Gamari 🐢

Revert "Enable new warning for fragile/incorrect CPP #if usage"

This is causing too much platform dependent breakage at the moment. We
will need a more rigorous testing strategy before this can be
merged again.

This reverts commit 7e340c2b.
parent 4a1eed40
...@@ -1345,7 +1345,7 @@ type HasCallStack = (() :: Constraint) ...@@ -1345,7 +1345,7 @@ type HasCallStack = (() :: Constraint)
#endif #endif
-- | A call stack constraint, but only when 'isDebugOn'. -- | A call stack constraint, but only when 'isDebugOn'.
#ifdef DEBUG #if DEBUG
type HasDebugCallStack = HasCallStack type HasDebugCallStack = HasCallStack
#else #else
type HasDebugCallStack = (() :: Constraint) type HasDebugCallStack = (() :: Constraint)
......
...@@ -379,7 +379,7 @@ findEditor :: IO String ...@@ -379,7 +379,7 @@ findEditor :: IO String
findEditor = do findEditor = do
getEnv "EDITOR" getEnv "EDITOR"
`catchIO` \_ -> do `catchIO` \_ -> do
#ifdef mingw32_HOST_OS #if mingw32_HOST_OS
win <- System.Win32.getWindowsDirectory win <- System.Win32.getWindowsDirectory
return (win </> "notepad.exe") return (win </> "notepad.exe")
#else #else
......
import CmmExpr import CmmExpr
#if !(defined(MACHREGS_i386) || defined(MACHREGS_x86_64) \ #if !(MACHREGS_i386 || MACHREGS_x86_64 || MACHREGS_sparc || MACHREGS_powerpc)
|| defined(MACHREGS_sparc) || defined(MACHREGS_powerpc))
import Panic import Panic
#endif #endif
import Reg import Reg
...@@ -9,9 +8,9 @@ import Reg ...@@ -9,9 +8,9 @@ import Reg
#include "ghcautoconf.h" #include "ghcautoconf.h"
#include "stg/MachRegs.h" #include "stg/MachRegs.h"
#if defined(MACHREGS_i386) || defined(MACHREGS_x86_64) #if MACHREGS_i386 || MACHREGS_x86_64
# if defined(MACHREGS_i386) # if MACHREGS_i386
# define eax 0 # define eax 0
# define ebx 1 # define ebx 1
# define ecx 2 # define ecx 2
...@@ -22,7 +21,7 @@ import Reg ...@@ -22,7 +21,7 @@ import Reg
# define esp 7 # define esp 7
# endif # endif
# if defined(MACHREGS_x86_64) # if MACHREGS_x86_64
# define rax 0 # define rax 0
# define rbx 1 # define rbx 1
# define rcx 2 # define rcx 2
...@@ -104,8 +103,7 @@ import Reg ...@@ -104,8 +103,7 @@ import Reg
-- I'm not sure if these are the correct numberings. -- I'm not sure if these are the correct numberings.
-- Normally, the register names are just stringified as part of the REG() macro -- Normally, the register names are just stringified as part of the REG() macro
#elif defined(MACHREGS_powerpc) || defined(MACHREGS_arm) \ #elif MACHREGS_powerpc || MACHREGS_arm || MACHREGS_aarch64
|| defined(MACHREGS_aarch64)
# define r0 0 # define r0 0
# define r1 1 # define r1 1
...@@ -140,10 +138,9 @@ import Reg ...@@ -140,10 +138,9 @@ import Reg
# define r30 30 # define r30 30
# define r31 31 # define r31 31
-- See note above. These aren't actually used for anything except satisfying -- See note above. These aren't actually used for anything except satisfying the compiler for globalRegMaybe
-- the compiler for globalRegMaybe so I'm unsure if they're the correct -- so I'm unsure if they're the correct numberings, should they ever be attempted to be used in the NCG.
-- numberings, should they ever be attempted to be used in the NCG. #if MACHREGS_aarch64 || MACHREGS_arm
#if defined(MACHREGS_aarch64) || defined(MACHREGS_arm)
# define s0 32 # define s0 32
# define s1 33 # define s1 33
# define s2 34 # define s2 34
...@@ -211,7 +208,7 @@ import Reg ...@@ -211,7 +208,7 @@ import Reg
# define d31 63 # define d31 63
#endif #endif
# if defined(MACHREGS_darwin) # if MACHREGS_darwin
# define f0 32 # define f0 32
# define f1 33 # define f1 33
# define f2 34 # define f2 34
...@@ -279,7 +276,7 @@ import Reg ...@@ -279,7 +276,7 @@ import Reg
# define fr31 63 # define fr31 63
# endif # endif
#elif defined(MACHREGS_sparc) #elif MACHREGS_sparc
# define g0 0 # define g0 0
# define g1 1 # define g1 1
...@@ -634,9 +631,7 @@ haveRegBase = False ...@@ -634,9 +631,7 @@ haveRegBase = False
-- in a real machine register, otherwise returns @'Just' reg@, where -- in a real machine register, otherwise returns @'Just' reg@, where
-- reg is the machine register it is stored in. -- reg is the machine register it is stored in.
globalRegMaybe :: GlobalReg -> Maybe RealReg globalRegMaybe :: GlobalReg -> Maybe RealReg
#if defined(MACHREGS_i386) || defined(MACHREGS_x86_64) \ #if MACHREGS_i386 || MACHREGS_x86_64 || MACHREGS_sparc || MACHREGS_powerpc || MACHREGS_arm || MACHREGS_aarch64
|| defined(MACHREGS_sparc) || defined(MACHREGS_powerpc) \
|| defined(MACHREGS_arm) || defined(MACHREGS_aarch64)
# ifdef REG_Base # ifdef REG_Base
globalRegMaybe BaseReg = Just (RealRegSingle REG_Base) globalRegMaybe BaseReg = Just (RealRegSingle REG_Base)
# endif # endif
...@@ -690,7 +685,7 @@ globalRegMaybe (FloatReg 6) = Just (RealRegSingle REG_F6) ...@@ -690,7 +685,7 @@ globalRegMaybe (FloatReg 6) = Just (RealRegSingle REG_F6)
# endif # endif
# ifdef REG_D1 # ifdef REG_D1
globalRegMaybe (DoubleReg 1) = globalRegMaybe (DoubleReg 1) =
# if defined(MACHREGS_sparc) # if MACHREGS_sparc
Just (RealRegPair REG_D1 (REG_D1 + 1)) Just (RealRegPair REG_D1 (REG_D1 + 1))
# else # else
Just (RealRegSingle REG_D1) Just (RealRegSingle REG_D1)
...@@ -698,7 +693,7 @@ globalRegMaybe (DoubleReg 1) = ...@@ -698,7 +693,7 @@ globalRegMaybe (DoubleReg 1) =
# endif # endif
# ifdef REG_D2 # ifdef REG_D2
globalRegMaybe (DoubleReg 2) = globalRegMaybe (DoubleReg 2) =
# if defined(MACHREGS_sparc) # if MACHREGS_sparc
Just (RealRegPair REG_D2 (REG_D2 + 1)) Just (RealRegPair REG_D2 (REG_D2 + 1))
# else # else
Just (RealRegSingle REG_D2) Just (RealRegSingle REG_D2)
...@@ -706,7 +701,7 @@ globalRegMaybe (DoubleReg 2) = ...@@ -706,7 +701,7 @@ globalRegMaybe (DoubleReg 2) =
# endif # endif
# ifdef REG_D3 # ifdef REG_D3
globalRegMaybe (DoubleReg 3) = globalRegMaybe (DoubleReg 3) =
# if defined(MACHREGS_sparc) # if MACHREGS_sparc
Just (RealRegPair REG_D3 (REG_D3 + 1)) Just (RealRegPair REG_D3 (REG_D3 + 1))
# else # else
Just (RealRegSingle REG_D3) Just (RealRegSingle REG_D3)
...@@ -714,7 +709,7 @@ globalRegMaybe (DoubleReg 3) = ...@@ -714,7 +709,7 @@ globalRegMaybe (DoubleReg 3) =
# endif # endif
# ifdef REG_D4 # ifdef REG_D4
globalRegMaybe (DoubleReg 4) = globalRegMaybe (DoubleReg 4) =
# if defined(MACHREGS_sparc) # if MACHREGS_sparc
Just (RealRegPair REG_D4 (REG_D4 + 1)) Just (RealRegPair REG_D4 (REG_D4 + 1))
# else # else
Just (RealRegSingle REG_D4) Just (RealRegSingle REG_D4)
...@@ -722,7 +717,7 @@ globalRegMaybe (DoubleReg 4) = ...@@ -722,7 +717,7 @@ globalRegMaybe (DoubleReg 4) =
# endif # endif
# ifdef REG_D5 # ifdef REG_D5
globalRegMaybe (DoubleReg 5) = globalRegMaybe (DoubleReg 5) =
# if defined(MACHREGS_sparc) # if MACHREGS_sparc
Just (RealRegPair REG_D5 (REG_D5 + 1)) Just (RealRegPair REG_D5 (REG_D5 + 1))
# else # else
Just (RealRegSingle REG_D5) Just (RealRegSingle REG_D5)
...@@ -730,7 +725,7 @@ globalRegMaybe (DoubleReg 5) = ...@@ -730,7 +725,7 @@ globalRegMaybe (DoubleReg 5) =
# endif # endif
# ifdef REG_D6 # ifdef REG_D6
globalRegMaybe (DoubleReg 6) = globalRegMaybe (DoubleReg 6) =
# if defined(MACHREGS_sparc) # if MACHREGS_sparc
Just (RealRegPair REG_D6 (REG_D6 + 1)) Just (RealRegPair REG_D6 (REG_D6 + 1))
# else # else
Just (RealRegSingle REG_D6) Just (RealRegSingle REG_D6)
...@@ -756,7 +751,7 @@ globalRegMaybe (XmmReg 5) = Just (RealRegSingle REG_XMM5) ...@@ -756,7 +751,7 @@ globalRegMaybe (XmmReg 5) = Just (RealRegSingle REG_XMM5)
globalRegMaybe (XmmReg 6) = Just (RealRegSingle REG_XMM6) globalRegMaybe (XmmReg 6) = Just (RealRegSingle REG_XMM6)
# endif # endif
# endif # endif
# if defined MAX_REAL_YMM_REG && MAX_REAL_YMM_REG != 0 # if MAX_REAL_YMM_REG != 0
# ifdef REG_YMM1 # ifdef REG_YMM1
globalRegMaybe (YmmReg 1) = Just (RealRegSingle REG_YMM1) globalRegMaybe (YmmReg 1) = Just (RealRegSingle REG_YMM1)
# endif # endif
...@@ -776,7 +771,7 @@ globalRegMaybe (YmmReg 5) = Just (RealRegSingle REG_YMM5) ...@@ -776,7 +771,7 @@ globalRegMaybe (YmmReg 5) = Just (RealRegSingle REG_YMM5)
globalRegMaybe (YmmReg 6) = Just (RealRegSingle REG_YMM6) globalRegMaybe (YmmReg 6) = Just (RealRegSingle REG_YMM6)
# endif # endif
# endif # endif
# if defined MAX_REAL_ZMM_REG && MAX_REAL_ZMM_REG != 0 # if MAX_REAL_ZMM_REG != 0
# ifdef REG_ZMM1 # ifdef REG_ZMM1
globalRegMaybe (ZmmReg 1) = Just (RealRegSingle REG_ZMM1) globalRegMaybe (ZmmReg 1) = Just (RealRegSingle REG_ZMM1)
# endif # endif
...@@ -824,7 +819,7 @@ globalRegMaybe CurrentNursery = Just (RealRegSingle REG_CurrentNursery ...@@ -824,7 +819,7 @@ globalRegMaybe CurrentNursery = Just (RealRegSingle REG_CurrentNursery
globalRegMaybe MachSp = Just (RealRegSingle REG_MachSp) globalRegMaybe MachSp = Just (RealRegSingle REG_MachSp)
# endif # endif
globalRegMaybe _ = Nothing globalRegMaybe _ = Nothing
#elif defined MACHREGS_NO_REGS #elif MACHREGS_NO_REGS
globalRegMaybe _ = Nothing globalRegMaybe _ = Nothing
#else #else
globalRegMaybe = panic "globalRegMaybe not defined for this platform" globalRegMaybe = panic "globalRegMaybe not defined for this platform"
...@@ -832,14 +827,14 @@ globalRegMaybe = panic "globalRegMaybe not defined for this platform" ...@@ -832,14 +827,14 @@ globalRegMaybe = panic "globalRegMaybe not defined for this platform"
freeReg :: RegNo -> Bool freeReg :: RegNo -> Bool
#if defined(MACHREGS_i386) || defined(MACHREGS_x86_64) #if MACHREGS_i386 || MACHREGS_x86_64
# if defined(MACHREGS_i386) # if MACHREGS_i386
freeReg esp = False -- %esp is the C stack pointer freeReg esp = False -- %esp is the C stack pointer
freeReg esi = False -- Note [esi/edi not allocatable] freeReg esi = False -- Note [esi/edi not allocatable]
freeReg edi = False freeReg edi = False
# endif # endif
# if defined(MACHREGS_x86_64) # if MACHREGS_x86_64
freeReg rsp = False -- %rsp is the C stack pointer freeReg rsp = False -- %rsp is the C stack pointer
# endif # endif
...@@ -880,14 +875,14 @@ freeRegBase REG_HpLim = False ...@@ -880,14 +875,14 @@ freeRegBase REG_HpLim = False
-- their liveness accurately. -- their liveness accurately.
freeRegBase _ = True freeRegBase _ = True
#elif defined(MACHREGS_powerpc) #elif MACHREGS_powerpc
freeReg 0 = False -- Used by code setting the back chain pointer freeReg 0 = False -- Used by code setting the back chain pointer
-- in stack reallocations on Linux -- in stack reallocations on Linux
-- r0 is not usable in all insns so also reserved -- r0 is not usable in all insns so also reserved
-- on Darwin. -- on Darwin.
freeReg 1 = False -- The Stack Pointer freeReg 1 = False -- The Stack Pointer
# if !defined(MACHREGS_darwin) # if !MACHREGS_darwin
-- most non-darwin powerpc OSes use r2 as a TOC pointer or something like that -- most non-darwin powerpc OSes use r2 as a TOC pointer or something like that
freeReg 2 = False freeReg 2 = False
freeReg 13 = False -- reserved for system thread ID on 64 bit freeReg 13 = False -- reserved for system thread ID on 64 bit
...@@ -988,7 +983,7 @@ freeReg REG_HpLim = False ...@@ -988,7 +983,7 @@ freeReg REG_HpLim = False
# endif # endif
freeReg _ = True freeReg _ = True
#elif defined(MACHREGS_sparc) #elif MACHREGS_sparc
-- SPARC regs used by the OS / ABI -- SPARC regs used by the OS / ABI
-- %g0(r0) is always zero -- %g0(r0) is always zero
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
// to force gnu90-style 'external inline' semantics. // to force gnu90-style 'external inline' semantics.
#if defined(FORCE_GNU_INLINE) #if defined(FORCE_GNU_INLINE)
// disable auto-detection since HAVE_GNU_INLINE has been defined externally // disable auto-detection since HAVE_GNU_INLINE has been defined externally
#elif defined(__GNUC_GNU_INLINE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 #elif __GNUC_GNU_INLINE__ && __GNUC__ == 4 && __GNUC_MINOR__ == 2
// GCC 4.2.x didn't properly support C99 inline semantics (GCC 4.3 was the first // GCC 4.2.x didn't properly support C99 inline semantics (GCC 4.3 was the first
// release to properly support C99 inline semantics), and therefore warned when // release to properly support C99 inline semantics), and therefore warned when
// using 'extern inline' while in C99 mode unless `__attributes__((gnu_inline))` // using 'extern inline' while in C99 mode unless `__attributes__((gnu_inline))`
...@@ -155,14 +155,14 @@ ...@@ -155,14 +155,14 @@
# define FORCE_GNU_INLINE 1 # define FORCE_GNU_INLINE 1
#endif #endif
#ifdef FORCE_GNU_INLINE #if FORCE_GNU_INLINE
// Force compiler into gnu90 semantics // Force compiler into gnu90 semantics
# if defined(KEEP_INLINES) # if defined(KEEP_INLINES)
# define EXTERN_INLINE inline __attribute__((gnu_inline)) # define EXTERN_INLINE inline __attribute__((gnu_inline))
# else # else
# define EXTERN_INLINE extern inline __attribute__((gnu_inline)) # define EXTERN_INLINE extern inline __attribute__((gnu_inline))
# endif # endif
#elif defined(__GNUC_GNU_INLINE__) #elif __GNUC_GNU_INLINE__
// we're currently in gnu90 inline mode by default and // we're currently in gnu90 inline mode by default and
// __attribute__((gnu_inline)) may not be supported, so better leave it off // __attribute__((gnu_inline)) may not be supported, so better leave it off
# if defined(KEEP_INLINES) # if defined(KEEP_INLINES)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#if defined(HAVE_PTHREAD_H) && !defined(mingw32_HOST_OS) #if defined(HAVE_PTHREAD_H) && !defined(mingw32_HOST_OS)
#ifdef CMINUSMINUS #if CMINUSMINUS
#define OS_ACQUIRE_LOCK(mutex) foreign "C" pthread_mutex_lock(mutex) #define OS_ACQUIRE_LOCK(mutex) foreign "C" pthread_mutex_lock(mutex)
#define OS_RELEASE_LOCK(mutex) foreign "C" pthread_mutex_unlock(mutex) #define OS_RELEASE_LOCK(mutex) foreign "C" pthread_mutex_unlock(mutex)
...@@ -76,7 +76,7 @@ EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex) ...@@ -76,7 +76,7 @@ EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex)
# elif defined(HAVE_WINDOWS_H) # elif defined(HAVE_WINDOWS_H)
#ifdef CMINUSMINUS #if CMINUSMINUS
/* We jump through a hoop here to get a CCall EnterCriticalSection /* We jump through a hoop here to get a CCall EnterCriticalSection
and LeaveCriticalSection, as that's what C-- wants. */ and LeaveCriticalSection, as that's what C-- wants. */
......
...@@ -33,34 +33,14 @@ ...@@ -33,34 +33,14 @@
#define MACHREGS_NO_REGS 0 #define MACHREGS_NO_REGS 0
#ifdef i386_TARGET_ARCH #define MACHREGS_i386 i386_TARGET_ARCH
#define MACHREGS_i386 1 #define MACHREGS_x86_64 x86_64_TARGET_ARCH
#endif #define MACHREGS_powerpc (powerpc_TARGET_ARCH || powerpc64_TARGET_ARCH \
|| powerpc64le_TARGET_ARCH || rs6000_TARGET_ARCH)
#ifdef x86_64_TARGET_ARCH #define MACHREGS_sparc sparc_TARGET_ARCH
#define MACHREGS_x86_64 1 #define MACHREGS_arm arm_TARGET_ARCH
#endif #define MACHREGS_aarch64 aarch64_TARGET_ARCH
#define MACHREGS_darwin darwin_TARGET_OS
#if defined(powerpc_TARGET_ARCH) || defined(powerpc64_TARGET_ARCH) \
|| defined(powerpc64le_TARGET_ARCH) || defined(rs6000_TARGET_ARCH)
#define MACHREGS_powerpc 1
#endif
#ifdef sparc_TARGET_ARCH
#define MACHREGS_sparc 1
#endif
#ifdef arm_TARGET_ARCH
#define MACHREGS_arm 1
#endif
#ifdef aarch64_TARGET_ARCH
#define MACHREGS_aarch64 1
#endif
#ifdef darwin_TARGET_OS
#define MACHREGS_darwin 1
#endif
#endif #endif
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
Leaving SpLim out of the picture. Leaving SpLim out of the picture.
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#ifdef MACHREGS_i386 #if MACHREGS_i386
#define REG(x) __asm__("%" #x) #define REG(x) __asm__("%" #x)
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
--------------------------------------------------------------------------- */ --------------------------------------------------------------------------- */
#elif defined(MACHREGS_x86_64) #elif MACHREGS_x86_64
#define REG(x) __asm__("%" #x) #define REG(x) __asm__("%" #x)
...@@ -303,7 +303,7 @@ the stack. See Note [Overlapping global registers] for implications. ...@@ -303,7 +303,7 @@ the stack. See Note [Overlapping global registers] for implications.
We can do the Whole Business with callee-save registers only! We can do the Whole Business with callee-save registers only!
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#elif defined(MACHREGS_powerpc) #elif MACHREGS_powerpc
#define REG(x) __asm__(#x) #define REG(x) __asm__(#x)
...@@ -316,7 +316,7 @@ the stack. See Note [Overlapping global registers] for implications. ...@@ -316,7 +316,7 @@ the stack. See Note [Overlapping global registers] for implications.
#define REG_R7 r20 #define REG_R7 r20
#define REG_R8 r21 #define REG_R8 r21
#ifdef MACHREGS_darwin #if MACHREGS_darwin
#define REG_F1 f14 #define REG_F1 f14
#define REG_F2 f15 #define REG_F2 f15
...@@ -442,7 +442,7 @@ the stack. See Note [Overlapping global registers] for implications. ...@@ -442,7 +442,7 @@ the stack. See Note [Overlapping global registers] for implications.
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#elif defined(MACHREGS_sparc) #elif MACHREGS_sparc
#define REG(x) __asm__("%" #x) #define REG(x) __asm__("%" #x)
...@@ -521,7 +521,7 @@ the stack. See Note [Overlapping global registers] for implications. ...@@ -521,7 +521,7 @@ the stack. See Note [Overlapping global registers] for implications.
d16-d31/q8-q15 Argument / result/ scratch registers d16-d31/q8-q15 Argument / result/ scratch registers
----------------------------------------------------------------------------- */ ----------------------------------------------------------------------------- */
#elif defined(MACHREGS_arm) #elif MACHREGS_arm
#define REG(x) __asm__(#x) #define REG(x) __asm__(#x)
...@@ -578,7 +578,7 @@ the stack. See Note [Overlapping global registers] for implications. ...@@ -578,7 +578,7 @@ the stack. See Note [Overlapping global registers] for implications.
----------------------------------------------------------------------------- */ ----------------------------------------------------------------------------- */
#elif defined(MACHREGS_aarch64) #elif MACHREGS_aarch64
#define REG(x) __asm__(#x) #define REG(x) __asm__(#x)
......
...@@ -39,34 +39,14 @@ ...@@ -39,34 +39,14 @@
#define MACHREGS_NO_REGS 0 #define MACHREGS_NO_REGS 0
#ifdef i386_HOST_ARCH #define MACHREGS_i386 i386_HOST_ARCH
#define MACHREGS_i386 1 #define MACHREGS_x86_64 x86_64_HOST_ARCH
#endif #define MACHREGS_powerpc (powerpc_HOST_ARCH || powerpc64_HOST_ARCH \
|| powerpc64le_HOST_ARCH || rs6000_HOST_ARCH)
#ifdef x86_64_HOST_ARCH #define MACHREGS_sparc sparc_HOST_ARCH
#define MACHREGS_x86_64 1 #define MACHREGS_arm arm_HOST_ARCH
#endif #define MACHREGS_aarch64 aarch64_HOST_ARCH
#define MACHREGS_darwin darwin_HOST_OS
#if defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) \
|| defined(powerpc64le_HOST_ARCH) || defined(rs6000_HOST_ARCH)
#define MACHREGS_powerpc 1
#endif
#ifdef sparc_HOST_ARCH
#define MACHREGS_sparc 1
#endif
#ifdef arm_HOST_ARCH
#define MACHREGS_arm 1
#endif
#ifdef aarch64_HOST_ARCH
#define MACHREGS_aarch64 1
#endif
#ifdef darwin_HOST_OS
#define MACHREGS_darwin 1
#endif
#endif #endif
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#ifndef SMP_H #ifndef SMP_H
#define SMP_H #define SMP_H
#if defined(arm_HOST_ARCH) && defined(arm_HOST_ARCH_PRE_ARMv6) #if arm_HOST_ARCH && defined(arm_HOST_ARCH_PRE_ARMv6)
void arm_atomic_spin_lock(void); void arm_atomic_spin_lock(void);
void arm_atomic_spin_unlock(void); void arm_atomic_spin_unlock(void);
#endif #endif
...@@ -187,15 +187,14 @@ EXTERN_INLINE void ...@@ -187,15 +187,14 @@ EXTERN_INLINE void
write_barrier(void) { write_barrier(void) {
#if defined(NOSMP) #if defined(NOSMP)
return; return;
#elif defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH) #elif i386_HOST_ARCH || x86_64_HOST_ARCH
__asm__ __volatile__ ("" : : : "memory"); __asm__ __volatile__ ("" : : : "memory");
#elif defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) \ #elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH
|| defined(powerpc64le_HOST_ARCH)
__asm__ __volatile__ ("lwsync" : : : "memory"); __asm__ __volatile__ ("lwsync" : : : "memory");
#elif defined(sparc_HOST_ARCH) #elif sparc_HOST_ARCH
/* Sparc in TSO mode does not require store/store barriers. */ /* Sparc in TSO mode does not require store/store barriers. */
__asm__ __volatile__ ("" : : : "memory"); __asm__ __volatile__ ("" : : : "memory");
#elif defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH) #elif (arm_HOST_ARCH) || aarch64_HOST_ARCH
__asm__ __volatile__ ("dmb st" : : : "memory"); __asm__ __volatile__ ("dmb st" : : : "memory");
#else #else
#error memory barriers unimplemented on this architecture #error memory barriers unimplemented on this architecture
...@@ -206,18 +205,17 @@ EXTERN_INLINE void ...@@ -206,18 +205,17 @@ EXTERN_INLINE void
store_load_barrier(void) { store_load_barrier(void) {
#if defined(NOSMP)