From 40f0f66151c09a02b6355c7da02af081c30dd586 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 26 Apr 2012 11:08:23 -0400 Subject: [PATCH] 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 file changed, 13 insertions(+), 2 deletions(-) diff --git a/glib/gversionmacros.h b/glib/gversionmacros.h index d18b8ebd0..fd675d8ce 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