[commit: ghc] master: Fix `integer-gmp2` compilation with GMP 4.x (#9281) (63a9d93)

git at git.haskell.org git at git.haskell.org
Thu Nov 13 09:51:14 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/63a9d9387f27e5842bed5946c5f1381f209d2918/ghc

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

commit 63a9d9387f27e5842bed5946c5f1381f209d2918
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Thu Nov 13 10:49:43 2014 +0100

    Fix `integer-gmp2` compilation with GMP 4.x (#9281)
    
    GMP 4.x didn't provide the `mp_bitcnt_t` typedef yet, so we locally
    define one if GMP 4.x is detected.


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

63a9d9387f27e5842bed5946c5f1381f209d2918
 libraries/integer-gmp2/cbits/wrappers.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libraries/integer-gmp2/cbits/wrappers.c b/libraries/integer-gmp2/cbits/wrappers.c
index ecee592..930f5b8 100644
--- a/libraries/integer-gmp2/cbits/wrappers.c
+++ b/libraries/integer-gmp2/cbits/wrappers.c
@@ -14,6 +14,15 @@
 #include "HsFFI.h"
 #include "MachDeps.h"
 
+// GMP 4.x compatibility
+#if !defined(__GNU_MP_VERSION)
+# error __GNU_MP_VERSION not defined
+#elif __GNU_MP_VERSION < 4
+# error need GMP 4.0 or later
+#elif __GNU_MP_VERSION < 5
+typedef unsigned long int mp_bitcnt_t;
+#endif
+
 #if (GMP_NUMB_BITS) != (GMP_LIMB_BITS)
 # error GMP_NUMB_BITS != GMP_LIMB_BITS not supported
 #endif



More information about the ghc-commits mailing list