ghc-prim: Silence -Wsync-nand warning in atomic.c
authorBen Gamari <bgamari.foss@gmail.com>
Thu, 8 Mar 2018 18:22:37 +0000 (13:22 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 8 Mar 2018 21:08:04 +0000 (16:08 -0500)
GCC throws this warning to inform us that __sync_fetch_and_nand's
behavior changed in GCC 4.4. However, this causes the build to fail when
-Werror is used.

Test Plan: Validate with -Werror

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4481

libraries/ghc-prim/cbits/atomic.c

index 722d261..80d4f39 100644 (file)
@@ -122,6 +122,10 @@ hs_atomic_and64(StgWord x, StgWord64 val)
 #define __has_builtin(x) 0
 #endif
 
+// Otherwise this fails with -Werror
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsync-nand"
+
 extern StgWord hs_atomic_nand8(StgWord x, StgWord val);
 StgWord
 hs_atomic_nand8(StgWord x, StgWord val)
@@ -168,6 +172,8 @@ hs_atomic_nand64(StgWord x, StgWord64 val)
 }
 #endif
 
+#pragma GCC diagnostic pop
+
 // FetchOrByteArrayOp_Int
 
 extern StgWord hs_atomic_or8(StgWord x, StgWord val);