[commit: packages/containers] master: Improve MIN_VERSION_base fall-back (3dddb04)
git at git.haskell.org
git at git.haskell.org
Sun Dec 20 16:24:31 UTC 2015
Repository : ssh://git@git.haskell.org/containers
On branch : master
Link : http://git.haskell.org/packages/containers.git/commitdiff/3dddb04bf514e37a87d7f8c5fd7ac58cda89d94f
>---------------------------------------------------------------
commit 3dddb04bf514e37a87d7f8c5fd7ac58cda89d94f
Author: David Feuer <David.Feuer at gmail.com>
Date: Fri Jan 16 13:51:06 2015 -0500
Improve MIN_VERSION_base fall-back
Guess the base library version based on `__GLASGOW_HASKELL__`
when compiling without Cabal.
>---------------------------------------------------------------
3dddb04bf514e37a87d7f8c5fd7ac58cda89d94f
include/containers.h | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/include/containers.h b/include/containers.h
index ea895d1..b075799 100644
--- a/include/containers.h
+++ b/include/containers.h
@@ -51,11 +51,30 @@
/*
* We use cabal-generated MIN_VERSION_base to adapt to changes of base.
* Nevertheless, as a convenience, we also allow compiling without cabal by
- * defining trivial MIN_VERSION_base if needed.
+ * defining an approximate MIN_VERSION_base if needed. The alternative version
+ * guesses the version of base using the version of GHC. This is usually
+ * sufficiently accurate. However, it completely ignores minor version numbers,
+ * and it makes the assumption that a pre-release version of GHC will ship with
+ * base libraries with the same version numbers as the final release. This
+ * assumption is violated in certain stages of GHC development, but in practice
+ * this should very rarely matter, and will not affect any released version.
*/
#ifndef MIN_VERSION_base
-#define MIN_VERSION_base(major1,major2,minor) 0
+#if __GLASGOW_HASKELL__ >= 709
+#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=8)))
+#elif __GLASGOW_HASKELL__ >= 707
+#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=7)))
+#elif __GLASGOW_HASKELL__ >= 705
+#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=6)))
+#elif __GLASGOW_HASKELL__ >= 703
+#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=5)))
+#elif __GLASGOW_HASKELL__ >= 701
+#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=4)))
+#elif __GLASGOW_HASKELL__ >= 700
+#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=3)))
+#else
+#define MIN_VERSION_base(major1,major2,minor) (0)
#endif
+#endif // MIN_VERSION_base was not defined
-
-#endif
+#endif // This file was already included
More information about the ghc-commits
mailing list