[glib] gtype: guard uses of new fundamental type check
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gtype: guard uses of new fundamental type check
- Date: Fri, 6 Jun 2014 14:59:56 +0000 (UTC)
commit d558e87c65517e3646f3b8ebc8f11448e25ccbf2
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Jun 6 10:45:51 2014 -0400
gtype: guard uses of new fundamental type check
g_type_is_fundamentally_a (see bug 730984) is a new API/ABI and is
marked with a version macro. We should therefore avoid its
unconditional use from G_IS_OBJECT() and G_IS_PARAM_SPEC() which are
APIs that have been around for a long time.
This prevents deprecation warnings from being emitted when these
functions are used with an older GLIB_VERSION_MAX_ALLOWED and also
prevents linking to the new ABI in that case (so that it's possible to
use the resulting binary with an older version of GLib).
https://bugzilla.gnome.org/show_bug.cgi?id=731335
gobject/gobject.h | 4 ++++
gobject/gparam.h | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gobject/gobject.h b/gobject/gobject.h
index a2f9af3..522011f 100644
--- a/gobject/gobject.h
+++ b/gobject/gobject.h
@@ -62,7 +62,11 @@ G_BEGIN_DECLS
*
* Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_OBJECT.
*/
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42
#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((object), G_TYPE_OBJECT))
+#else
+#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT))
+#endif
/**
* G_IS_OBJECT_CLASS:
* @class: a #GObjectClass
diff --git a/gobject/gparam.h b/gobject/gparam.h
index 8f216e4..7f77ca8 100644
--- a/gobject/gparam.h
+++ b/gobject/gparam.h
@@ -50,7 +50,11 @@ G_BEGIN_DECLS
* Checks whether @pspec "is a" valid #GParamSpec structure of type %G_TYPE_PARAM
* or derived.
*/
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42
#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((pspec), G_TYPE_PARAM))
+#else
+#define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM))
+#endif
/**
* G_PARAM_SPEC_CLASS:
* @pclass: a valid #GParamSpecClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]