summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2018-02-03 11:37:01 -0500
committerBen Gamari <ben@smart-cactus.org>2018-02-03 11:37:14 -0500
commit217e4170bdce3df28a667803ce5e619553bfecdd (patch)
tree1e548bae29aecc72ce257dc962025c1388a7a7b5 /mk
parentfdf518c708dc5a34ae810c5d5f3a4db812d226f0 (diff)
downloadhaskell-217e4170bdce3df28a667803ce5e619553bfecdd.tar.gz
ghc-prim: Emulate C11 atomics when not available
GCC's __sync primitives apparently "usually" imply a full barrier, meaning they can be used to emulate the more precise C11 atomics albeit with a loss of efficiency. This restores compatibility with GCC 4.4. This partially reverts commit 59de290928e6903337f31c1f8107ac8a98ea145d. Test Plan: Validate on Centos Reviewers: hvr, simonmar, trommler Subscribers: rwbarton, thomie, erikd, carter GHC Trac Issues: #14244 Differential Revision: https://phabricator.haskell.org/D4364
Diffstat (limited to 'mk')
-rw-r--r--mk/config.mk.in1
-rw-r--r--mk/warnings.mk4
2 files changed, 4 insertions, 1 deletions
diff --git a/mk/config.mk.in b/mk/config.mk.in
index b046abe112..86c626dccd 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -522,6 +522,7 @@ GccVersion = @GccVersion@
# TargetPlatformFull retains the string passed to configure so we have it in
# the necessary format to pass to libffi's configure.
TargetPlatformFull = @TargetPlatformFull@
+GccLT46 = @GccLT46@
GccIsClang = @GccIsClang@
CC = @CC@
diff --git a/mk/warnings.mk b/mk/warnings.mk
index 9426db2a1d..0ae81bfcac 100644
--- a/mk/warnings.mk
+++ b/mk/warnings.mk
@@ -20,11 +20,13 @@ GhcStage2HcOpts += -Wcpp-undef
ifneq "$(GccIsClang)" "YES"
# Debian doesn't turn -Werror=unused-but-set-variable on by default, so
-# we turn it on explicitly for consistency with other users.
+# we turn it on explicitly for consistency with other users
+ifeq "$(GccLT46)" "NO"
# Never set the flag on Windows as the host gcc may be too old.
ifneq "$(HostOS_CPP)" "mingw32"
SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable
endif
+endif
# Suppress the warning about __sync_fetch_and_nand (#9678).
libraries/ghc-prim/cbits/atomic_CC_OPTS += -Wno-sync-nand