[commit: packages/bytestring] ghc-head: Fix warnings for different GHC versions, including 7.8 (bf73032)

git at git.haskell.org git
Fri Oct 4 08:28:09 UTC 2013


Repository : ssh://git at git.haskell.org/bytestring

On branch  : ghc-head
Link       : http://git.haskell.org/packages/bytestring.git/commitdiff/bf73032482ca63a1ca6a057d36d3a8ef78e3c879

>---------------------------------------------------------------

commit bf73032482ca63a1ca6a057d36d3a8ef78e3c879
Author: Duncan Coutts <duncan at community.haskell.org>
Date:   Thu Oct 3 21:17:14 2013 +0100

    Fix warnings for different GHC versions, including 7.8


>---------------------------------------------------------------

bf73032482ca63a1ca6a057d36d3a8ef78e3c879
 Data/ByteString.hs                                       |    2 +-
 Data/ByteString/Builder/Internal.hs                      |    5 +++++
 Data/ByteString/Builder/Prim.hs                          |    4 ++++
 Data/ByteString/Builder/Prim/Internal/Base16.hs          |    4 ++++
 Data/ByteString/Builder/Prim/Internal/UncheckedShifts.hs |    7 ++++++-
 5 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/Data/ByteString.hs b/Data/ByteString.hs
index 2da8cfe..04fdc9f 100644
--- a/Data/ByteString.hs
+++ b/Data/ByteString.hs
@@ -234,7 +234,7 @@ import Control.Monad            (when)
 
 import Foreign.C.String         (CString, CStringLen)
 import Foreign.C.Types          (CSize)
-#if MIN_VERSION_base(4,6,0)
+#if MIN_VERSION_base(4,5,0)
 import Foreign.ForeignPtr       (ForeignPtr, newForeignPtr, withForeignPtr
                                 ,touchForeignPtr)
 import Foreign.ForeignPtr.Unsafe(unsafeForeignPtrToPtr)
diff --git a/Data/ByteString/Builder/Internal.hs b/Data/ByteString/Builder/Internal.hs
index e3a7271..b48a464 100644
--- a/Data/ByteString/Builder/Internal.hs
+++ b/Data/ByteString/Builder/Internal.hs
@@ -150,11 +150,16 @@ import qualified Data.ByteString.Lazy as L
 import           System.IO (Handle)
 
 #if MIN_VERSION_base(4,4,0)
+#if MIN_VERSION_base(4,7,0)
+import           Foreign
+#else
 import           Foreign hiding (unsafeForeignPtrToPtr)
+#endif
 import           Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
 import           System.IO.Unsafe (unsafeDupablePerformIO)
 #else
 import           Foreign
+import           GHC.IO (unsafeDupablePerformIO)
 #endif
 
 ------------------------------------------------------------------------------
diff --git a/Data/ByteString/Builder/Prim.hs b/Data/ByteString/Builder/Prim.hs
index 9434f08..22a4b8f 100644
--- a/Data/ByteString/Builder/Prim.hs
+++ b/Data/ByteString/Builder/Prim.hs
@@ -466,7 +466,11 @@ import           Data.ByteString.Builder.Prim.Binary
 import           Data.ByteString.Builder.Prim.ASCII
 
 #if MIN_VERSION_base(4,4,0)
+#if MIN_VERSION_base(4,7,0)
+import           Foreign
+#else
 import           Foreign hiding (unsafeForeignPtrToPtr)
+#endif
 import           Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
 #else
 import           Foreign
diff --git a/Data/ByteString/Builder/Prim/Internal/Base16.hs b/Data/ByteString/Builder/Prim/Internal/Base16.hs
index a88da67..2965450 100644
--- a/Data/ByteString/Builder/Prim/Internal/Base16.hs
+++ b/Data/ByteString/Builder/Prim/Internal/Base16.hs
@@ -25,7 +25,11 @@ import qualified Data.ByteString          as S
 import qualified Data.ByteString.Internal as S
 
 #if MIN_VERSION_base(4,4,0)
+#if MIN_VERSION_base(4,7,0)
+import           Foreign
+#else
 import           Foreign hiding (unsafePerformIO, unsafeForeignPtrToPtr)
+#endif
 import           Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
 import           System.IO.Unsafe (unsafePerformIO)
 #else
diff --git a/Data/ByteString/Builder/Prim/Internal/UncheckedShifts.hs b/Data/ByteString/Builder/Prim/Internal/UncheckedShifts.hs
index d25288e..7673e9a 100644
--- a/Data/ByteString/Builder/Prim/Internal/UncheckedShifts.hs
+++ b/Data/ByteString/Builder/Prim/Internal/UncheckedShifts.hs
@@ -98,7 +98,12 @@ shiftr_w64 = shiftR
 caseWordSize_32_64 :: a -- Value to use for 32-bit 'Word's
                    -> a -- Value to use for 64-bit 'Word's
                    -> a
-caseWordSize_32_64 f32 f64 = case bitSize (undefined :: Word) of
+caseWordSize_32_64 f32 f64 =
+#if MIN_VERSION_base(4,7,0)
+  case finiteBitSize (undefined :: Word) of
+#else
+  case bitSize (undefined :: Word) of
+#endif
     32 -> f32
     64 -> f64
     s  -> error $ "caseWordSize_32_64: unsupported Word bit-size " ++ show s




More information about the ghc-commits mailing list