[glib] Deal with GLIB_VERSION_MIN_REQUIRED/MAX_ALLOWED being a "future" value



commit 40f0f66151c09a02b6355c7da02af081c30dd586
Author: Dan Winship <danw gnome org>
Date:   Thu Apr 26 11:08:23 2012 -0400

    Deal with GLIB_VERSION_MIN_REQUIRED/MAX_ALLOWED being a "future" value
    
    If GLIB_VERSION_MIN_REQUIRED or GLIB_VERSION_MAX_ALLOWED was defined
    to a future value, we were essentially treating it as
    GLIB_VERSION_0_0. Fix to treat it as being in the future instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674898

 glib/gversionmacros.h |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/glib/gversionmacros.h b/glib/gversionmacros.h
index d18b8eb..fd675d8 100644
--- a/glib/gversionmacros.h
+++ b/glib/gversionmacros.h
@@ -119,8 +119,15 @@
  *
  * Since: 2.32
  */
+/* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
+ * GLIB_VERSION_X_Y value that we don't know about, it will compare as
+ * 0 in preprocessor tests.
+ */
 #ifndef GLIB_VERSION_MIN_REQUIRED
 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE)
+#elif GLIB_VERSION_MIN_REQUIRED == 0
+# undef  GLIB_VERSION_MIN_REQUIRED
+# define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE + 2)
 #endif
 
 /**
@@ -139,11 +146,15 @@
  *
  * Since: 2.32
  */
-#ifndef GLIB_VERSION_MAX_ALLOWED
-# define GLIB_VERSION_MAX_ALLOWED      GLIB_VERSION_CUR_STABLE
+#if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
+# undef GLIB_VERSION_MAX_ALLOWED
+# define GLIB_VERSION_MAX_ALLOWED      (GLIB_VERSION_CUR_STABLE)
 #endif
 
 /* sanity checks */
+#if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
+#error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
+#endif
 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]